예제 #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(String[] args)
        {
            if (Environment.UserInteractive)
            {
                if (args != null && args.Length == 1 && args[0].StartsWith("-i", StringComparison.OrdinalIgnoreCase))
                {
                    TcmCDService.Configuration.Installer.Install(Assembly.GetExecutingAssembly().Location);
                    return;
                }

                if (args != null && args.Length == 1 && args[0].StartsWith("-u", StringComparison.OrdinalIgnoreCase))
                {
                    TcmCDService.Configuration.Installer.Uninstall(Assembly.GetExecutingAssembly().Location);
                    return;
                }

                Console.WriteLine("[i] Starting TcmCacheService");
                Logger.Info("TcmCacheService starting...");

                using (ZeroMQBroker cache = new ZeroMQBroker(new TcmCDService.Configuration.Settings(Config.Instance.Settings)))
                {
                    cache.Connect();

                    Console.WriteLine("[i] Press any key to exit.");
                    Console.ReadKey();

                    Logger.Info("TcmCacheService stopping...");
                }

                Console.WriteLine("[i] Stopping TcmCacheService");
            }
            else
                ServiceBase.Run(new WindowsService());
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WindowsService"/> class.
 /// </summary>
 public WindowsService()
 {
     InitializeComponent();
     mZeroMQBroker = new ZeroMQBroker(new TcmCDService.Configuration.Settings(Config.Instance.Settings));
 }