Example #1
0
        void Initialize()
        {
            DrawLogo();

            Deserializer decoder       = TryInitStorageDecoder();
            bool         hasStoredData = decoder != null;

            sch     = new Scheduler();
            runtime = null;

            if (decoder != null)
            {
                try
                {
                    decoder.ReadObject(Log.D);
                    decoder.ReadObject(timerController = new TimerController());
                    decoder.ReadObject(runtime         = new RuntimeTask(timerController));
                    decoder.ReadObject(VariablesStorage.Shared);
                    decoder.ReadObject(CMMapper.Shared);
                }
                catch (Exception e)
                {
                    hasStoredData = false;
                    Log.WriteFormat(LOG_CAT, LogLevel.Error, "state restoring failed: {0}", e.ToString());
                }

                decoder.Dispose();
            }

            if (!hasStoredData)
            {
                LogLevels();
                timerController = new TimerController();
                runtime         = new RuntimeTask(timerController);
                VariablesStorage.Clear();
                CMMapper.Shared.Clear();

                ScheduleParse(true);
            }
        }
 internal static void Clear()
 {
     _shared = new VariablesStorage();
 }