Beispiel #1
0
        /*
         * static void Main()
         * {
         *
         *  ServiceBase[] ServicesToRun;
         *  ServicesToRun = new ServiceBase[]
         *  {
         *      new MainService()
         *  };
         *  ServiceBase.Run(ServicesToRun);
         *
         * }
         */
        /// <summary>
        /// Punto de entrada principal para la aplicación.
        /// </summary>
        static void Main()
        {
            log.Info("Se empezó a ejecutar el programa wololo");
            string[] args = Environment.GetCommandLineArgs();

            if (args == null || args.Length > 2)
            {
                Console.WriteLine("------------------------------------------");

                System.Reflection.Assembly ass = System.Reflection.Assembly.GetExecutingAssembly();
                FileVersionInfo            fvi = FileVersionInfo.GetVersionInfo(ass.Location);
                string pv = fvi.ProductVersion;

                Console.WriteLine(fvi.FileDescription + " - " + fvi.CompanyName);
                Console.WriteLine("Version: " + fvi.ProductVersion);

                Console.WriteLine();
                Console.WriteLine("CLI syntaxis: ");

                Console.WriteLine();
                Console.WriteLine("\tRun in Console Mode:");
                Console.WriteLine("\t..>LeeUsuariosEncriptadosWSEscribeEnActiveDirectory /CONSOLE");
                Console.WriteLine("------------------------------------------");
            }
            else if (args.Length == 2 && args[1].ToUpper().Equals("/CONSOLE"))
            {
                RunInConsole app = new RunInConsole(args);
            }
            else
            { //Run in Windows Service Mode.
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                    new MainService()
                };
                ServiceBase.Run(ServicesToRun);
            }
        }
        static void Main()
        {
            string[] args = Environment.GetCommandLineArgs();

            if (args == null || args.Length > 2)
            {
                log.Debug("------------------------------------------");

                System.Reflection.Assembly ass = System.Reflection.Assembly.GetExecutingAssembly();
                FileVersionInfo            fvi = FileVersionInfo.GetVersionInfo(ass.Location);
                string pv = fvi.ProductVersion;

                log.Debug(fvi.FileDescription + " - " + fvi.CompanyName);
                log.Debug("Version: " + fvi.ProductVersion);

                log.Debug("");
                log.Debug("CLI syntaxis: ");

                log.Debug(" ");
                log.Debug("\tRun in Console Mode:");
                log.Debug("\t..>PlugInService /CONSOLE");
                log.Debug("------------------------------------------");
            }
            else if (args.Length == 2 && args[1].ToUpper().Equals("/CONSOLE"))
            {
                RunInConsole app = new RunInConsole(args);
            }
            else
            { //Run in Windows Service Mode.
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                    new Service(args)
                };
                ServiceBase.Run(ServicesToRun);
            }
        }