Example #1
0
        static void Main(string[] args)
        {
            if (Updater.ApplyUpdate(args))
            {
                return;
            }

            I18n.Instance.ApplyLanguage(new DefaultI18n());

            while (true)
            {
                SyncHost.Instance = new SyncHost();
                SyncHost.Instance.Load();

                CurrentIO.WriteWelcome();

                SyncHost.Instance.Plugins.ReadySync();

                string cmd = CurrentIO.ReadCommand();
                while (true)
                {
                    SyncHost.Instance.Commands.invokeCmdString(cmd);
                    cmd = CurrentIO.ReadCommand();
                }
            }
        }
Example #2
0
        internal void Start()
        {
            PerLuanchChecker(ForceStart);

            InitSync();
            CurrentIO.WriteWelcome();

            while (true)
            {
                var cmd = CurrentIO.ReadCommand();
                SyncHost.Instance.Commands.invokeCmdString(cmd);
            }
        }
Example #3
0
        /// <summary>
        /// Invoke to load plugins
        /// </summary>
        internal void Load()
        {
            CurrentIO.Write(LANG_Loading);

            //Initial plugins manager
            plugins = new PluginManager();
            CurrentIO.WriteColor(String.Format(LANG_Plugins, plugins.LoadPlugins()), ConsoleColor.Green);

            //Initial danmaku source
            sources = new SourceManager();
            CurrentIO.WriteColor(String.Format(LANG_Sources, plugins.LoadSources()), ConsoleColor.Green);

            //select a danmaku source by config
            try
            {
                sourceWrapper = new SourceWorkWrapper(sources);
                PluginEvents.Instance.RaiseEvent(new PluginEvents.InitSourceWarpperEvent(sourceWrapper));
            }
            catch
            {
                CurrentIO.Write("");
                CurrentIO.WriteColor(LANG_Error, ConsoleColor.Red);
                CurrentIO.WriteColor("Press enter to continue", ConsoleColor.Red);
                CurrentIO.ReadCommand();
            }

            //Get clients singleton
            clients = ClientManager.Instance;
            CurrentIO.WriteColor(String.Format(LANG_Client, plugins.LoadClients()), ConsoleColor.Green);

            clientWrapper = new ClientWorkWrapper(clients);
            PluginEvents.Instance.RaiseEvent(new PluginEvents.InitClientWarpperEvent(clientWrapper));

            commands = new CommandManager();
            CurrentIO.WriteColor(String.Format(LANG_Commands, plugins.LoadCommnads()), ConsoleColor.Green);

            filters = new FilterManager();
            CurrentIO.WriteColor(String.Format(LANG_Filters, plugins.LoadFilters()), ConsoleColor.Green);

            messages = new MessageDispatcher(filters);

            plugins.ReadyProgram();

            CurrentIO.WriteColor(LANG_Ready, ConsoleColor.Cyan);
        }
Example #4
0
        internal void Start()
        {
            //Check sync.exe is run
            using (var syncMappedFile = MemoryMappedFile.CreateOrOpen(SYNC_GUID, 4))
            {
                PreInitSync();
                SyncInstanceLocker(syncMappedFile, ForceStart);

                InitSync();
                CurrentIO.WriteWelcome();

                while (true)
                {
                    var cmd = CurrentIO.ReadCommand();
                    SyncHost.Instance.Commands.invokeCmdString(cmd);
                }
            }
        }