Exemple #1
0
        protected void RunInternal(string serviceName, string displayName, string servicePath)
        {
            ModuleProc PROC      = new ModuleProc(this.DYN_MODULE_NAME, "Process");
            bool       isGUIMode = false;

            try
            {
                if (_args != null)
                {
                    if (_args.Length >= 1)
                    {
                        string cmdArg = _args[0];
                        if (System.String.Compare(cmdArg, "/debug", System.StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            isGUIMode = true;
                        }
                        else
                        {
                            bool processed = false;

                            try
                            {
                                using (WindowsServiceManager serviceManager = new WindowsServiceManager(serviceName,
                                                                                                        displayName, servicePath, cmdArg, Console.Out))
                                {
                                    processed = serviceManager.Process(ServiceStart.SERVICE_AUTO_START, null);
                                }
                            }
                            catch (Exception ex)
                            {
                                Log.Exception(PROC, ex);
                            }

                            if (processed)
                            {
                                return;
                            }
                        }
                    }
                }

                Show(isGUIMode);
            }
            catch (Exception ex)
            {
                //Debugger.Break();
                Log.Exception(PROC, ex);
            }
        }
        protected void RunInternal(string serviceName, string displayName, string servicePath){
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Process");
            bool isGUIMode = false;

            try
            {
                if (_args != null)
                {
                    if (_args.Length >= 1)
                    {
                        string cmdArg = _args[0];
                        if (System.String.Compare(cmdArg, "/debug", System.StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            isGUIMode = true;
                        }
                        else
                        {
                            bool processed = false;

                            try
                            {
                                using (WindowsServiceManager serviceManager = new WindowsServiceManager(serviceName,
                                    displayName, servicePath, cmdArg, Console.Out))
                                {
                                    processed = serviceManager.Process(ServiceStart.SERVICE_AUTO_START, null);
                                }
                            }
                            catch (Exception ex)
                            {
                                Log.Exception(PROC, ex);
                            }

                            if (processed) return;
                        }
                    }
                }

                Show(isGUIMode);
            }
            catch (Exception ex)
            {
                //Debugger.Break();
                Log.Exception(PROC, ex);
            }
        }