コード例 #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);
        }
コード例 #4
0
        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;
        }