예제 #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            if ((!Platform.IsMono && !Environment.UserInteractive) ||//Windows Service
                (Platform.IsMono && !AppDomain.CurrentDomain.FriendlyName.Equals(Path.GetFileName(Assembly.GetEntryAssembly().CodeBase))))   //MonoService
            {
                RunAsService();
                return;
            }

            if (args != null && args.Length > 0)
            {
                if (args[0].Equals("-i", StringComparison.OrdinalIgnoreCase))
                {
                    SelfInstaller.InstallMe();
                    return;
                }
                else if (args[0].Equals("-u", StringComparison.OrdinalIgnoreCase))
                {
                    SelfInstaller.UninstallMe();
                    return;
                }

                Console.WriteLine("Invalid argument!");
                return;
            }

            Console.WriteLine("Press any key to start the SuperSocket Server Engine!");
            Console.ReadKey();
            Console.WriteLine();
            RunAsConsole();
            Console.ReadKey();
        }
예제 #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            if (!Environment.UserInteractive)
            {
                RunAsService();
                return;
            }

            if (args != null && args.Length > 0)
            {
                if (args[0].Equals("-i", StringComparison.OrdinalIgnoreCase))
                {
                    SelfInstaller.InstallMe();
                    return;
                }
                else if (args[0].Equals("-u", StringComparison.OrdinalIgnoreCase))
                {
                    SelfInstaller.UninstallMe();
                    return;
                }

                Console.WriteLine("Invalid argument!");
                return;
            }

            Console.WriteLine("Press any key to start server!");
            Console.ReadKey();
            Console.WriteLine();
            RunAsConsole();
            Console.ReadKey();
        }
예제 #3
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            LogUtil.Setup();

            if (args != null && args.Length > 0)
            {
                if (args[0].Equals("-i", StringComparison.OrdinalIgnoreCase))
                {
                    SelfInstaller.InstallMe();
                    return;
                }
                else if (args[0].Equals("-u", StringComparison.OrdinalIgnoreCase))
                {
                    SelfInstaller.UninstallMe();
                    return;
                }
                else if (args[0].Equals("-c", StringComparison.OrdinalIgnoreCase))
                {
                    Console.WriteLine("Press any key to start server!");
                    Console.ReadKey();
                    Console.WriteLine();
                    RunAsConsole();
                }
                else
                {
                    Console.WriteLine(args[0]);
                }
            }
            else
            {
                RunAsService();
            }
        }
예제 #4
0
        private static bool Run(string exeArg, string[] startArgs)
        {
            switch (exeArg.ToLower())
            {
            case ("i"):
                SelfInstaller.InstallMe();
                return(true);

            case ("u"):
                SelfInstaller.UninstallMe();
                return(true);

            case ("r"):
                RunAsConsole();
                return(true);

            case ("c"):
                RunAsController(startArgs);
                return(true);

            default:
                Console.WriteLine("Invalid argument!");
                return(false);
            }
        }