コード例 #1
0
ファイル: Core.cs プロジェクト: josemaripl/MBCon
        public void Run(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Console.Title = "MBCon - Connecting...";
#if DEBUG
            AppConsole.Log(String.Format("MBCon - WARNING THIS IS A DEBUG APP!!!"), ConsoleColor.Red);
            AppConsole.Log(String.Format("MBCon - WARNING THIS IS A DEBUG APP!!!"), ConsoleColor.Red);
            AppConsole.Log(String.Format("MBCon - WARNING THIS IS A DEBUG APP!!!"), ConsoleColor.Red);
            AppConsole.Log(String.Format("MBCon - WARNING THIS IS A DEBUG APP!!!"), ConsoleColor.Red);
            AppConsole.Log(String.Format("MBCon - WARNING THIS IS A DEBUG APP!!!"), ConsoleColor.Red);
#else
            AppConsole.Log(String.Format("=========================="), ConsoleColor.DarkCyan);
            AppConsole.Log(String.Format("MBCon - by maca134"), ConsoleColor.Cyan);
            AppConsole.Log(String.Format("*****@*****.**"), ConsoleColor.Gray);
            AppConsole.Log(String.Format("=========================="), ConsoleColor.DarkCyan);
            AppConsole.Log("");
            Thread.Sleep(4000);
#endif

            _args.Setup<string>("config")
                .Callback(val => _configPath = val)
                .SetDefault(Path.Combine(BasePath, "config.ini"));

            _args.Setup<int>("delay")
                .Callback(val => _startupDelay = val)
                .SetDefault(0);

            _args.Parse(args);

            if (!File.Exists(_configPath))
            {
                throw new CoreException(String.Format("Config file \"{0}\" was not found.", _configPath));
            }
            AppConsole.Log("Config file found, continuing to load...");
            var ini = new IniParser(_configPath);

            try
            {
                _settings = new Settings(ini);
            }
            catch (SettingsException ex)
            {
                throw new CoreException(String.Format("Error Loading Settings: {0}", ex.Message));
            }

            if (_startupDelay > 0)
            {
                AppConsole.Log(string.Format("Waiting for {0} seconds", _startupDelay));
                Thread.Sleep(_startupDelay * 1000);
            }

            _beclient = BEClient();
            _pluginManager = new PluginManager(PluginPath);

            _api = new Api(_beclient, _settings);
            _pluginManager.Init(_api);

            AppConsole.Log("Connecting to server...");

            Connect();
        }
コード例 #2
0
ファイル: Settings.cs プロジェクト: josemaripl/MBCon
 public static void Forge(IniParser ini)
 {
     Instance = new Settings(ini);
 }