Esempio n. 1
0
        private static void Install(WindowsServiceInstaller srv)
        {
            bool ok = srv.InstallService(System.Reflection.Assembly.GetExecutingAssembly().Location, ServiceName, DisplayName, Description);

            if (ok)
            {
                Console.WriteLine("Service installed.");
                Loger.Debug("Service installed.");
            }
            else
            {
                Console.WriteLine("There was a problem with installation.");
                Loger.Debug("There was a problem with installation.");
            }
        }
Esempio n. 2
0
        private static void Uninstall(WindowsServiceInstaller srv)
        {
            bool ok = srv.UnInstallService(ServiceName);

            if (ok)
            {
                Console.WriteLine("Service uninstalled.");
                Loger.Debug("Service uninstalled.");
            }
            else
            {
                Console.WriteLine("There was a problem with uninstallation.");
                Loger.Debug("There was a problem with uninstallation.");
            }
        }
Esempio n. 3
0
        private static void Install(WindowsServiceInstaller srv)
        {
            bool ok = srv.InstallService(System.Reflection.Assembly.GetExecutingAssembly().Location, ServiceName, DisplayName, Description);

            if (ok)
            {
                Console.WriteLine("Service installed.");
                Loger.Debug("Service installed.");
            }
            else
            {
                Console.WriteLine("There was a problem with installation.");
                Loger.Debug("There was a problem with installation.");
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            if (args.Length != 0)
            {
                WindowsServiceInstaller srv = new WindowsServiceInstaller();

                if (args.Length == 2)
                {
                    ServiceName += " " + args[1];
                    DisplayName += " " + args[1];
                    Description += " " + args[1];
                }

                switch (args[0].ToLower())
                {
                case "/r":
                    Common.Debug();
                    return;

                case "/i":
                    Loger.Debug("Install service start ...");
                    Install(srv);
                    return;

                case "/u":
                    Loger.Debug("Uninstall service start ...");
                    Uninstall(srv);
                    return;
                }
            }
            else
            {
                try
                {
                    Go();
                }
                catch (Exception ex)
                {
                    Loger.Debug("ManagerAgent::" + ex.Message);
                }
            }

            help();
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            if (args.Length != 0)
            {
                WindowsServiceInstaller srv = new WindowsServiceInstaller();

                if (args.Length == 2)
                {
                    ServiceName += " " + args[1];
                    DisplayName += " " + args[1];
                    Description += " " + args[1];
                }

                switch (args[0].ToLower())
                {
                    case "/r":
                        Common.Debug();
                        return;
                    case "/i":
                        Loger.Debug("Install service start ...");
                        Install(srv);
                        return;
                    case "/u":
                        Loger.Debug("Uninstall service start ...");
                        Uninstall(srv);
                        return;
                }
            }
            else
            {
                try
                {
                    Go();
                }
                catch (Exception ex)
                {
                    Loger.Debug("ManagerAgent::" + ex.Message);
                }
            }

            help();
        }
Esempio n. 6
0
        private static void Uninstall(WindowsServiceInstaller srv)
        {
            bool ok = srv.UnInstallService(ServiceName);

            if (ok)
            {
                Console.WriteLine("Service uninstalled.");
                Loger.Debug("Service uninstalled.");
            }
            else
            {
                Console.WriteLine("There was a problem with uninstallation.");
                Loger.Debug("There was a problem with uninstallation.");
            }
        }