示例#1
0
 public static void serviceUninstall(DirectServiceInstaller srv)
 {
     if (srv.UnInstallService(_serviceName))
     {
         Console.WriteLine("Service uninstalled.");
     }
     else
     {
         Console.WriteLine("There was a problem with uninstallation.");
     }
 }
示例#2
0
 public static void serviceInstall(DirectServiceInstaller srv)
 {
     if (srv.InstallService(Assembly.GetEntryAssembly().Location + " /s", _serviceName, _serviceDescription))
     {
         Console.WriteLine("Service installed.");
     }
     else
     {
         Console.WriteLine("There was a problem with installation.");
     }
 }
示例#3
0
        static void Main(string[] args)
        {
            LogManager.Configure("LOGS\\log.txt".Replace('\\', Path.DirectorySeparatorChar), 500, false);
            LogManager.SetLogLevel(2);

            if (args.Length == 1)
            {
                DirectServiceInstaller srv = new DirectServiceInstaller();
                switch (args[0].ToUpper())
                {
                case "/I":
                    Service.serviceInstall(srv);
                    return;

                case "/U":
                    Service.serviceUninstall(srv);
                    return;

                case "/R":
                    Service.runConsole();
                    return;

                case "/S":
                    Service.runService();
                    return;

                case "/H":
                case "/?":
                case "-H":
                case "-?":
                case "?":
                    help();
                    return;
                }
            }
            Service.runConsole();
        }