Exemplo n.º 1
0
        public Program()
        {
            Debug.Initialise(Debug.Level.Info, Echo);
            ResourceMonitorDriver.StaticInitialise();

            configuration = new ConfigurationReader().Deserialise(RequestedConfiguration.GetDefault(), Storage);

            Runtime.UpdateFrequency = Constants.EXPECTED_UPDATE_MODE;
        }
Exemplo n.º 2
0
        private void EnsureInitialised()
        {
            if (instance != null)
            {
                return;
            }

            Debug.Write(Debug.Level.Info, "Configuration updated. Reinitialising...");
            instance = new ResourceMonitorDriver(configuration);
            Rescan();
            current    = null;
            yieldCount = 0;
        }
Exemplo n.º 3
0
        public void Main(string argument, UpdateType updateSource)
        {
            Clock.AddTime(Runtime.TimeSinceLastRun);

            if (current == null)
            {
                Debug.ClearBuffer();
            }
            else
            {
                Debug.RestoreBuffer();
            }

            if (commandLine.TryParse(argument))
            {
                var command = commandLine.Argument(0);
                switch (command?.ToLower())
                {
                case "configure":
                    configuration = new ConfigurationReader().UpdateFromCommandLine(configuration, commandLine.Items.Skip(1));
                    instance      = null;
                    break;

                case "reset":
                    configuration = RequestedConfiguration.GetDefault();
                    instance      = null;
                    break;

                case "rescan":
                    Rescan();
                    break;
                }
            }

            EnsureInitialised();

            if ((updateSource & (UpdateType.Update1 | UpdateType.Update10 | UpdateType.Update100)) != 0)
            {
                HandlePeriodicUpdate();
            }
        }