private void _ProcessProperty(P.Property prop)
		{
			Dictionary<string, object> childs = prop.GetChilds();
			foreach (string name in childs.Keys)
			{
				object sub = childs[name];
				if (sub == null)
					continue;

				if (name == "ClassName")
				{
					_AddClassName(sub.ToString());
				}
				else if (sub is str)
				{
					string s = sub.ToString();
					if (s.StartsWith("/Game/FactoryGame/") && s.EndsWith("_C"))
						_AddClassName(s);
				}

				if (sub is P.Property)
					_ProcessProperty(sub as P.Property);
				else
					_Process(sub);
			}
		}
Beispiel #2
0
        private void _TraverseProperty(P.Property prop, Runner action)
        {
            if (prop == null)
            {
                return;
            }

            if (_callback != null)
            {
                _callback.Update(++_count, null, prop.ToString());
            }

            action(prop);

            Dictionary <string, object> childs = prop.GetChilds();

            foreach (string name in childs.Keys)
            {
                object sub = childs[name];
                if (sub is P.Property)
                {
                    _TraverseProperty(sub as P.Property, action);
                }
                else
                {
                    _TraverseObject(sub, action);
                }
            }
        }
Beispiel #3
0
 public override F.IResult Test(object value)
 {
     if (value is P.Property)
     {
         P.Property prop   = value as P.Property;
         var        result = prop
                             .GetChilds()
                             .Select(pair => {
             if (pair.Value != null)
             {
                 if (pair.Value is string)
                 {
                     return(_filter.Test(pair.Value));
                 }
                 return(_filter.Test(pair.Value.ToString()));
             }
             return(F.EMPTY_RESULT);
         })
                             .Where(r => r.Success)
         ;
         if (result.Count() >= 1)
         {
             return(new F.Result(result));
         }
     }
     return(F.EMPTY_RESULT);
 }
Beispiel #4
0
 public override F.IResult Test(object value)
 {
     if (value is P.Property)
     {
         P.Property prop   = value as P.Property;
         var        childs = prop.GetChilds();
         if (childs.ContainsKey(_name))
         {
             F.IResult result = _filter.Test(childs[_name].ToString());
             if (result.Success)
             {
                 return(new F.Result(childs[_name]));
             }
         }
     }
     return(F.EMPTY_RESULT);
 }
        internal D.DifferenceNode _Compare(P.Property left, P.Property right)
        {
            D.DifferenceNode node = new D.DifferenceNode(left.ToString(), left, right);
            D.DifferenceNode sub;

            if ((left == null || right == null) && (left != right))
            {
                return(node);
            }

            // Do some by-name blacklisting to skips things like delta timestamps
            if (left is P.ValueProperty)
            {
                P.ValueProperty val_prop = left as P.ValueProperty;
                if (val_prop.Name != null)
                {
                    string name = val_prop.Name.ToString();
                    if (_blacklisted.Contains(name))
                    {
                        return(null);
                    }
                }
            }

            Dictionary <string, object> left_childs  = new Dictionary <string, object>(left.GetChilds());
            Dictionary <string, object> right_childs = new Dictionary <string, object>(right.GetChilds());

            while (left_childs.Count > 0)
            {
                var pair = left_childs.First();

                object left_sub = pair.Value;
                left_childs.Remove(pair.Key);

                object right_sub = null;
                if (right_childs.ContainsKey(pair.Key))
                {
                    right_sub = right_childs[pair.Key];
                    right_childs.Remove(pair.Key);
                }

                if (_blacklisted.Contains(pair.Key))
                {
                    continue;
                }

                if (right_sub == null && left_sub != null)
                {
                    sub = new D.DifferenceNode(null, left_sub, null);
                }
                else if (left_sub is P.Property)
                {
                    sub = _Compare(left_sub as P.Property, right_sub as P.Property);
                }
                else
                {
                    sub = _CompareObject(left_sub, right_sub);
                }
                if (sub != null)
                {
                    sub.Title = pair.Key;
                    node.Add(sub);
                }
            }

            foreach (var pair in right_childs)
            {
                if (!_blacklisted.Contains(pair.Key))
                {
                    node.Add(pair.Key, null, pair.Value);
                }
            }

            return((node.ChildCount > 0) ? node : null);
        }