Ejemplo n.º 1
0
        public void FWExecuteRule()
        {
            while (Directory.GetFiles(rule.DirStart, rule.FileMask).Except(recheсk.Keys).ToList().Count > 0)//.Where(o => o < 4).Length > 0)
            {
                string f = new DirectoryInfo(rule.DirStart)
                           .GetFiles(rule.FileMask, SearchOption.TopDirectoryOnly)
                           .Where(w => !recheсk.Keys.Contains(w.FullName))
                           .OrderBy(p => p.CreationTime)
                           .First().FullName;

                FileAction(f);
            }

            while (recheсk.Where(o => o.Value < Const.MaxRecheckFile).ToList().Count > 0)
            {
                var s = recheсk.Where(o => o.Value < Const.MaxRecheckFile).First();

                Thread.Sleep((int)Math.Pow((int)s.Value, 3) * 1000);

                if (!File.Exists(s.Key))
                {
                    recheсk.Remove(s.Key);
                }
                else
                {
                    FileAction(s.Key);
                }
            }

            if (historyContext.history.Item.Count > settingsContext.settings.MaxCountHistory)
            {
                historyContext.history.Item.RemoveAll(x => x.DateMove < settingsContext.settings.LastClearHistory);
                historyContext.EditHistory();
                settingsContext.settings.LastClearHistory = DateTime.Now;
                settingsContext.EditSettings();
            }
        }
Ejemplo n.º 2
0
 private void buttonClearLog_Click(object sender, EventArgs e)
 {
     historyContext.history.Item.Clear();
     historyContext.EditHistory();
     GridRefresh();
 }