예제 #1
0
        static void Main(string[] args)
        {
            if (args.Length > 0 && args.Contains("kill"))
            {
                var processes =
                    Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Application.ExecutablePath));
                foreach (var process in processes)
                {
                    process.Kill();
                }
                return;
            }

            string logPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "log");

            if (!Directory.Exists(logPath))
            {
                Directory.CreateDirectory(logPath);
            }

            logPath = Path.Combine(logPath, "MicroFuturePlatform");

            MicroFurtureSystemClr.InitLogger(logPath, true);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MonitorForm());
        }
예제 #2
0
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main(string[] args)
        {
            string serverPath = Assembly.GetExecutingAssembly().Location;

            if (args.Contains("--install"))
            {
                ManagedInstallerClass.InstallHelper(new string[] { serverPath });
                return;
            }

            if (args.Contains("--uninstall"))
            {
                ManagedInstallerClass.InstallHelper(new string[] { "/u", serverPath });
                return;
            }

            var idx = Array.IndexOf(args, "--config");

            if (idx >= 0 && args.Length > idx + 1)
            {
                MFWinService.CONFIG_FILE = args[idx + 1];
            }

            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new MFWinService()
            };

            string logPath = Path.Combine(Path.GetDirectoryName(serverPath), "log");

            if (!Directory.Exists(logPath))
            {
                Directory.CreateDirectory(logPath);
            }

            logPath = Path.Combine(logPath, "MicroFuturePlatform");

            MicroFurtureSystemClr.InitLogger(logPath, true);
            ServiceBase.Run(ServicesToRun);
        }