From: <che...@us...> - 2009-11-13 12:04:19
|
Revision: 3149 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3149&view=rev Author: chef_koch Date: 2009-11-13 12:04:08 +0000 (Fri, 13 Nov 2009) Log Message: ----------- reverted changes all other changes made in 3098 and 3106: removed AdminHelperFile Modified Paths: -------------- trunk/plugins/IR Server Suite/IR Server Suite/IR Server/IR Server Configuration/Program.cs trunk/plugins/IR Server Suite/IR Server Suite/IR Server Suite.sln trunk/plugins/IR Server Suite/setup/setup.nsi Removed Paths: ------------- trunk/plugins/IR Server Suite/IR Server Suite/IR Server/IR Server AdminHelper/ Modified: trunk/plugins/IR Server Suite/IR Server Suite/IR Server/IR Server Configuration/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/IR Server/IR Server Configuration/Program.cs 2009-11-13 02:30:12 UTC (rev 3148) +++ trunk/plugins/IR Server Suite/IR Server Suite/IR Server/IR Server Configuration/Program.cs 2009-11-13 12:04:08 UTC (rev 3149) @@ -92,10 +92,10 @@ private static readonly string ConfigurationFile = Path.Combine(Common.FolderAppData, @"IR Server\IR Server.xml"); internal static readonly string IRServerFile = Path.Combine(Common.FolderProgramFiles, @"IR Server.exe"); - internal static readonly string AdminHelperFile = Path.Combine(Common.FolderProgramFiles, @"IR Server AdminHelper.exe"); internal static readonly Icon _iconGray = new Icon(Resources.iconGray, new Size(16, 16)); internal static readonly Icon _iconGreen = new Icon(Resources.iconGreen, new Size(16, 16)); + private static readonly TimeSpan defaultServiceTime = new TimeSpan(0, 0, 30); #endregion Constants @@ -110,7 +110,7 @@ private static NotifyIcon _notifyIcon; private static bool _inConfiguration; private static Thread thread; - //private static ServiceController serviceController; + private static ServiceController serviceController; private static ServiceController[] serviceControllers; private static IntPtr irsWindow; private static int waitCount; @@ -459,63 +459,97 @@ } } - private static void RunAdminHelper(string arguments) + private static ServiceController getServiceController() { - int exitCode = 0; + serviceControllers = ServiceController.GetServices(); + foreach (ServiceController sc in serviceControllers) + { + if (sc.ServiceName == ServerName) + return sc; + } + return null; + } - Process process = new Process(); - process.StartInfo = new ProcessStartInfo(); - process.StartInfo.FileName = AdminHelperFile; - process.StartInfo.Arguments = arguments; - process.StartInfo.CreateNoWindow = true; - process.StartInfo.UseShellExecute = true; - - // Must enable Exited event for both sync and async scenarios - process.EnableRaisingEvents = true; - + internal static void ServiceInstall() + { try { - process.Start(); - // Synchronously block until process is complete, then return exit code from process - process.WaitForExit(); - exitCode = process.ExitCode; + IrssLog.Info("Installing IR Server service"); + Process IRServer = Process.Start(Program.IRServerFile, "/INSTALL"); + IRServer.WaitForExit((int)defaultServiceTime.TotalMilliseconds); + IrssLog.Info("Installing IR Server service - done"); } catch (Exception ex) { + IrssLog.Error("Installing IR Server service - failed (see following...)"); IrssLog.Error(ex); - exitCode = 10; } - - - if (exitCode != 0) - { - IrssLog.Error("RunAdminHelper exitcode = " + exitCode); - MessageBox.Show("There occured an issue when trying to run AdminHelper." + Environment.NewLine + - "Do you have administration rights?" + Environment.NewLine + - "Did you accept the request for Administration rights?" + Environment.NewLine + Environment.NewLine + - "If you think you did everything right, please report the issue to the devlopers.", - "IR Server Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error); - } } - internal static void ServiceInstall() - { - RunAdminHelper("/INSTALL"); - } - internal static void ServiceUninstall() { - RunAdminHelper("/UNINSTALL"); + try + { + IrssLog.Info("Uninstalling IR Server service"); + Process IRServer = Process.Start(Program.IRServerFile, "/UNINSTALL"); + IRServer.WaitForExit((int)defaultServiceTime.TotalMilliseconds); + IrssLog.Info("Uninstalling IR Server service - done"); + } + catch (Exception ex) + { + IrssLog.Error("Uninstalling IR Server service - failed (see following...)"); + IrssLog.Error(ex); + } } internal static void ServiceStart() { - RunAdminHelper("/START"); + try + { + serviceController = getServiceController(); + if (serviceControllers != null) + { + IrssLog.Info("Starting IR Server (service)"); + serviceController.Start(); + serviceController.WaitForStatus(ServiceControllerStatus.Running, defaultServiceTime); + IrssLog.Info("Starting IR Server (service) - done"); + } + } + catch (TimeoutException ex) + { + IrssLog.Error("Starting IR Server (service) - failed (timeout error)"); + IrssLog.Error(ex); + } + catch (Exception ex) + { + IrssLog.Error("Starting IR Server (service) - failed (see following...)"); + IrssLog.Error(ex); + } } internal static void ServiceStop() { - RunAdminHelper("/STOP"); + try + { + serviceController = getServiceController(); + if (serviceControllers != null) + { + IrssLog.Info("Stopping IR Server (service)"); + serviceController.Stop(); + serviceController.WaitForStatus(ServiceControllerStatus.Stopped, defaultServiceTime); + IrssLog.Info("Stopping IR Server (service) - done"); + } + } + catch (TimeoutException ex) + { + IrssLog.Error("Stopping IR Server (service) - failed (timeout error)"); + IrssLog.Error(ex); + } + catch (Exception ex) + { + IrssLog.Error("Stopping IR Server (service) - failed (see following...)"); + IrssLog.Error(ex); + } } internal static void ApplicationStart() Modified: trunk/plugins/IR Server Suite/IR Server Suite/IR Server Suite.sln =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite/IR Server Suite.sln 2009-11-13 02:30:12 UTC (rev 3148) +++ trunk/plugins/IR Server Suite/IR Server Suite/IR Server Suite.sln 2009-11-13 12:04:08 UTC (rev 3149) @@ -127,8 +127,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FireDTV Receiver", "IR Server Plugins\FireDTV Receiver\FireDTV Receiver.csproj", "{D88EDBC1-D583-4149-9873-8239FA63F4FE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IR Server AdminHelper", "IR Server\IR Server AdminHelper\IR Server AdminHelper.csproj", "{F6C2B2FA-026A-4483-854C-735D6E59E69C}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -601,14 +599,6 @@ {D88EDBC1-D583-4149-9873-8239FA63F4FE}.Release|Any CPU.Build.0 = Release|Any CPU {D88EDBC1-D583-4149-9873-8239FA63F4FE}.Release|x86.ActiveCfg = Release|x86 {D88EDBC1-D583-4149-9873-8239FA63F4FE}.Release|x86.Build.0 = Release|x86 - {F6C2B2FA-026A-4483-854C-735D6E59E69C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F6C2B2FA-026A-4483-854C-735D6E59E69C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F6C2B2FA-026A-4483-854C-735D6E59E69C}.Debug|x86.ActiveCfg = Debug|x86 - {F6C2B2FA-026A-4483-854C-735D6E59E69C}.Debug|x86.Build.0 = Debug|x86 - {F6C2B2FA-026A-4483-854C-735D6E59E69C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F6C2B2FA-026A-4483-854C-735D6E59E69C}.Release|Any CPU.Build.0 = Release|Any CPU - {F6C2B2FA-026A-4483-854C-735D6E59E69C}.Release|x86.ActiveCfg = Release|x86 - {F6C2B2FA-026A-4483-854C-735D6E59E69C}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -669,7 +659,6 @@ {28098574-D22E-457C-AFFA-560554499EAC} = {E757F80C-23C5-4AD6-B178-16799E337E03} {46F1DB42-F082-4200-B939-6E4B72A8117C} = {DEE5AAD1-0110-4681-8FF9-662CEA72FD94} {1E84C2ED-92FC-43A4-9C12-374B3347F6D7} = {DEE5AAD1-0110-4681-8FF9-662CEA72FD94} - {F6C2B2FA-026A-4483-854C-735D6E59E69C} = {DEE5AAD1-0110-4681-8FF9-662CEA72FD94} {21E04B17-D850-43E7-AAD3-876C0E062BDB} = {F0D3A774-FE5E-4419-B9B6-C11FF1C4BB50} {106A69D2-670C-4DE5-A81C-A3CD5D3F21EB} = {F0D3A774-FE5E-4419-B9B6-C11FF1C4BB50} {D1BAC7A9-FFB6-44BA-825F-32506831DC3D} = {F0D3A774-FE5E-4419-B9B6-C11FF1C4BB50} Modified: trunk/plugins/IR Server Suite/setup/setup.nsi =================================================================== --- trunk/plugins/IR Server Suite/setup/setup.nsi 2009-11-13 02:30:12 UTC (rev 3148) +++ trunk/plugins/IR Server Suite/setup/setup.nsi 2009-11-13 12:04:08 UTC (rev 3149) @@ -380,8 +380,7 @@ File "..\IR Server Suite\IR Server\IR Server Configuration\bin\${Build_Type}\IR Server Configuration.*" File "..\IR Server Suite\IR Server\SourceGrid\DevAge*" File "..\IR Server Suite\IR Server\SourceGrid\SourceGrid*" - - File "..\IR Server Suite\IR Server\IR Server AdminHelper\bin\${Build_Type}\IR Server AdminHelper.*" + File "..\IR Server Suite\IR Server Plugins\IR Server Plugin Interface\bin\${Build_Type}\IRServerPluginInterface.*" ${LOG_TEXT} "INFO" "Installing IR Server Plugins..." @@ -472,7 +471,6 @@ Delete "$DIR_INSTALL\DevAge*" Delete "$DIR_INSTALL\SourceGrid*" - Delete "$DIR_INSTALL\IR Server AdminHelper.*" Delete "$DIR_INSTALL\IRServerPluginInterface.*" !macroend This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |