示例#1
0
        public static void CheckForChanges(bool silent = true)
        {
            try
            {
                CheckRulesSet();

                List <RuleViewModel> changed = new List <RuleViewModel>();

                foreach (var rule in rules)
                {
                    var      original = rule.Original;
                    var      checker  = AppState.Instance.GetChecker(original.CheckerId);
                    RuleInfo updated  = checker.GetValues(original.Path, original.Extension);

                    if (!updated.Equals(original))
                    {
                        InvokeOnUI(() => rule.SetChanged(updated));
                    }

                    if (rule.Current != null)
                    {
                        changed.Add(rule);
                    }
                }

                InvokeOnUI(() => onUpdated.Invoke(changed));

                //return changed;
            }
            catch (Exception e)
            {
                if (!silent)
                {
                    throw;
                }

                /*
                 * else
                 *  return new List<RuleViewModel>();
                 */
            }
        }
示例#2
0
 public bool Equals(RuleApplication other)
 {
     if (!m_rule.Equals(other.m_rule))
     {
         return(false);
     }
     if (m_data.Count != other.m_data.Count)
     {
         return(false);
     }
     foreach (var kvp in m_data)
     {
         Justification otherValue;
         if (!other.m_data.TryGetValue(kvp.Key, out otherValue))
         {
             return(false);
         }
         if (!kvp.Value.Equals(otherValue))
         {
             return(false);
         }
     }
     return(true);
 }