예제 #1
0
        private void InitPolicy()
        {
            _policy = new ProcessPolicy();
            ProcessArbiterConfig paConfig = new ProcessArbiterConfig();

            if (!_UsePolicyConfig)
            {
                _policy.GovernorProcessorPercent = (int)(Properties.Settings.Default.GovernorProcessorPercent / _numberOfProcessors);
                _policy.GovernorTimeInterval     = Properties.Settings.Default.GovernorTimeIntervalMilliseconds;
                _policy.RelaxProcessorPercent    = (int)(Properties.Settings.Default.RelaxProcessorPercent / _numberOfProcessors);
                _policy.RelaxTimeInterval        = Properties.Settings.Default.RelaxTimeIntervalMilliseconds;

                if (Properties.Settings.Default.WmiWatcherIntervalMilliseconds >= 1000)
                {
                    _policy.WmiWatcherInterval = Properties.Settings.Default.WmiWatcherIntervalMilliseconds;
                }
                else
                {
                    _policy.WmiWatcherInterval = 1000;
                }
                _policy.IgnoreProcesses  = InitIgnoreProcesses(_policy.IgnoreProcesses);
                _policy.IncludeProcesses = InitIncludedProcesses(_policy.IncludeProcesses);
            }
            else
            {
                _policy = paConfig.Getconfig(_Settings);
            }
        }
예제 #2
0
        internal void Setconfig(ProcessPolicy _Policy, string Filename)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(ProcessPolicy));

            using (StreamWriter sr = new StreamWriter(Filename, false))
            {
                serializer.Serialize(sr, _Policy);
                sr.Flush();
            }
        }
예제 #3
0
        internal ProcessPolicy Getconfig(string Filename)
        {
            ProcessPolicy _Policy    = new ProcessPolicy();
            XmlSerializer serializer = new XmlSerializer(typeof(ProcessPolicy));

            using (StreamReader sr = new StreamReader(Filename))
            {
                _Policy = (ProcessPolicy)serializer.Deserialize(sr);
            }
            return(_Policy);
        }
        private void InitPolicy()
        {
            _policy = new ProcessPolicy();

            _policy.GovernorProcessorPercent = (int)(Properties.Settings.Default.GovernorProcessorPercent / _numberOfProcessors);
            _policy.GovernorTimeInterval = Properties.Settings.Default.GovernorTimeIntervalMilliseconds;
            _policy.RelaxProcessorPercent = (int)(Properties.Settings.Default.RelaxProcessorPercent / _numberOfProcessors);
            _policy.RelaxTimeInterval = Properties.Settings.Default.RelaxTimeIntervalMilliseconds;

            if (Properties.Settings.Default.WmiWatcherIntervalMilliseconds >= 1000)
                _policy.WmiWatcherInterval = Properties.Settings.Default.WmiWatcherIntervalMilliseconds;
            else
                _policy.WmiWatcherInterval = 1000;
        }