コード例 #1
0
 public static bool Stop()
 {
     Logger.Info("Stop core");
     internalStop();
     _loader = null;
     Logger.Info("End Stop core");
     return(true);
 }
コード例 #2
0
        public static bool Start(bool repeat = false)
        {
            Logger.Info("Start core");
            Sandbox.Logger = Logger;
            ConfigDispetcherClass.Logger = Logger;
            DataDispetcherClass.Logger   = Logger;
            ActionDispetcherClass.Logger = Logger;
            PluginDispetcherClass.Logger = Logger;

            Stop();
            var run = false;

            try
            {
                _loader = new CoreLoader(Logger);
                _loader.OnNeedRestart += _loader_OnNeedRestart;

                Logger.Debug("CoreLoader is been create");
                run = _loader.Init();
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex);
            }
            if (!run && !repeat)
            {
                if (_loader == null)
                {
                    CoreLoader.RemoveConfig();
                }
                else
                {
                    _loader.EmptySettings();
                }
                Logger.Warning("reset by default settings restart");

                run = Start(true);
            }
            else if (!run)
            {
                Logger.Error("Fail by reset config");
            }

            if (run)
            {
                run = internalStart();
            }
            else
            {
                Logger.Error("Fail by start");
            }


            return(run);
        }