protected override void OnStart(string[] args)
        {
            string dbPath = @"Data Source=" + System.Environment.GetEnvironmentVariable("windir") + "\\system\\AccessTrackerDB.db";
            dbStatus = new DbStatusObject();
            dbUsageMonitor = new DbSizeMonitor(dbPath, dbStatus);
            if (dbUsageMonitor.isDBSizeOk() == true)
            {
                init = new EventProducer(dbStatus, dbPath);
                init.Start();
                dbUsageMonitor.Start();

                server = new Server();
            }
            else
            {
                this.Stop();
            }
        }
Example #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static int Main(string[] args)
        {
            bool console = false;

            CLogger.WriteLog(ELogLevel.INFO, "Starting new instance of service");

            try
            {
                foreach (string arg in args)
                {
                    switch (arg)
                    {
                        case "-c":
                            console = true;
                            break;

                        default:
                            CLogger.WriteLog(ELogLevel.ERROR, "Argument not expected: " + arg);
                            break;
                    }
                }

                if (console == true)
                {
                    string dbPath = @"Data Source=" + System.Environment.GetEnvironmentVariable("windir") + "\\system\\AccessTrackerDB";

                    //FamServer serviceObj = new FamServer();
                    EventProducer init = new EventProducer(null, dbPath);
                    init.Start();
                }
                else
                {
                    ServiceBase[] services = { new FamServer() };
                    ServiceBase.Run(services);
                }

                return 0;
            }
            catch (Exception ex)
            {
                CLogger.WriteLog(ELogLevel.FATAL, ex.Message);
                throw;
            }
        }
Example #3
0
 protected override void OnStart(string[] args)
 {
     init = new EventProducer();
     init.Start();
 }