コード例 #1
0
ファイル: MainService.cs プロジェクト: seanthompson/conduktor
        private bool ValidateIntervalProcessSettings(IntervalProcessSettings settings)
        {
            bool hasValidSettings = true;

            try
            {
                if (!File.Exists(settings.Filename))
                {
                    hasValidSettings = false;
                }

            }
            catch (Exception ex)
            {
                logger.ErrorException("Error validating interval process settings.", ex);
                hasValidSettings = false;
            }

            return hasValidSettings;
        }
コード例 #2
0
ファイル: MainService.cs プロジェクト: seanthompson/conduktor
        private IntervalProcessSettings GetIntervalProcessSettings(XElement process)
        {
            IntervalProcessSettings settings = new IntervalProcessSettings();

            try
            {
                XElement timer = process.Element("timer");
                XElement timeout = process.Element("timeout");

                settings.Filename = (string)process.Attribute("filename");
                settings.Arguments = (string)process.Attribute("arguments");
                settings.TimerDuration = CreateTimeSpan(timer);
                settings.KillAfter = CreateTimeSpan(timeout);
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error getting interval process settings.", ex);
            }

            return settings;
        }
コード例 #3
0
ファイル: MainService.cs プロジェクト: seanthompson/conduktor
        private void StartIntervalProcess(IntervalProcessSettings settings)
        {
            TimerCallback timerCallback = RunIntervalProcess;
            var timer = new System.Threading.Timer(timerCallback, settings, new TimeSpan(0), settings.TimerDuration);

            Thread.Sleep(Timeout.Infinite);
        }