Beispiel #1
0
        public static RuleInfo Deserialize(JObject obj)
        {
            int    id        = (int)obj[Props.ID];
            string checkerId = (string)obj[Props.CheckerID];
            string name      = (string)obj[Props.Name];
            string path      = (string)obj[Props.Path];
            string extension = (string)obj[Props.Extension];

            List <IData> data = AppState.DeserializeIData(obj[Props.Data]);

            /*
             * List<IData> data = new List<IData>();
             *
             * foreach (var c in obj[Props.Data].Children<JObject>())
             * {
             *  bool isFolder = (string) c[AppState.DataClassType] == Folder.FolderType;
             *
             *  IData child = isFolder ? Folder.Deserialize(c) : Value.Deserialize(c);
             *  data.Add(child);
             * }
             */

            RuleInfo rule = new RuleInfo(checkerId, name, data);

            rule.Path      = path;
            rule.Extension = extension;
            rule.ID        = id;

            return(rule);
        }
Beispiel #2
0
        public bool IsEqual(RuleInfo other)
        {
            var hc1 = this.GetHashCode2();
            var hc2 = other.GetHashCode2();

            return(this.CheckerId != other.CheckerId &&
                   hc1 == hc2);
        }
Beispiel #3
0
        public override bool Equals(object obj)
        {
            RuleInfo other = obj as RuleInfo;

            if (other == null || this.CheckerId != other.CheckerId)
            {
                return(false);
            }
            else
            {
                return(AppState.ChildrenEqual(this.Data, other.Data));
            }
        }