Ejemplo n.º 1
0
    public BroadcastScheduler(IBroadcastDatabase db, FileStore store, Playback playback, int checkInterval)
    {
        timer          = new Timer();
        timer.Interval = checkInterval;
        timer.Elapsed += Timer_Elapsed;

        this.db       = db;
        this.store    = store;
        this.playback = playback;
    }
Ejemplo n.º 2
0
        public static void Run()
        {
            var settings = Settings.Default;

            // Initialization
            db = InitDatabase(settings); if (db == null)
            {
                return;
            }
            authenticator = InitAuthenticator(settings); if (authenticator == null)
            {
                return;
            }
            authorizator = InitAuthorizator(settings); if (authorizator == null)
            {
                return;
            }
            playback = InitPlayback(settings); if (playback == null)
            {
                return;
            }
            store = InitFileStore(settings); if (store == null)
            {
                return;
            }
            scheduler = InitScheduler(settings, db, store, playback); if (scheduler == null)
            {
                return;
            }
            crypter = InitCrypter(settings); if (crypter == null)
            {
                return;
            }
            sessions = InitSessionManager(); if (sessions == null)
            {
                return;
            }
            server = InitTcpServer(settings); if (server == null)
            {
                return;
            }
            reciever = InitReciever(settings, server, crypter, authenticator, authorizator); if (reciever == null)
            {
                return;
            }

            ProgramOutput.Info("SERVER INITIALIZATION COMPLETED SUCCESSFULLY !!!\r\n");

            // Start server
            scheduler.StartChecking();
            ProgramOutput.Info("Scheduler started.");

            server.StartListening();
            ProgramOutput.Info("Server is listening on TCP port {0}...", server.Port);
        }
Ejemplo n.º 3
0
        private static BroadcastScheduler InitScheduler(Settings settins, IBroadcastDatabase db, FileStore store, Playback playback)
        {
            BroadcastScheduler scheduler;

            try
            {
                scheduler = new BroadcastScheduler(db, store, playback, (int)settins.SCHEDULER_CHECK_INTERVAL);
            }
            catch
            {
                ProgramOutput.Error("Cannot initialize scheduler. Please check the scheduler parameters in config file.");
                return(null);
            }
            MasterContainer.AddService <BroadcastScheduler>(scheduler);

            return(scheduler);
        }