public static void AddTracking(object obj, string path) { bool flag = StateTracker.instance != null; if (flag) { string item = string.Format("{0}_{1}_{2}", obj.GetType().FullName, obj.GetHashCode(), path); bool flag2 = !StateTracker.instance.trackedInfosAdded.Contains(item); if (flag2) { StateTracker.TrackedInfo trackedInfo = StateTracker.GetTrackedInfo(obj, path); StateTracker.instance.trackedInfos.Add(trackedInfo); StateTracker.instance.trackedInfosAdded.Add(item); int i = 0; int size = StateTracker.instance.states.size; while (i < size) { StateTracker.State @new = StateTracker.resourcePool.GetNew(); @new.SetInfo(trackedInfo); StateTracker.instance.states.Current().Add(@new); StateTracker.instance.states.MoveNext(); i++; } } } }
private static StateTracker.TrackedInfo GetTrackedInfo(object obj, string name) { string[] array = name.Split(new char[] { '.' }); int i = 0; int num = array.Length; StateTracker.TrackedInfo result; while (i < num) { string name2 = array[i]; bool flag = obj == null; if (flag) { result = null; } else { Type type = obj.GetType(); //MemberInfo memberInfo = type.GetProperty(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MemberInfo memberInfo = null; if (type.GetProperty(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) != null) { memberInfo = type.GetProperty(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } else { memberInfo = type.GetField(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } bool flag2 = memberInfo == null; if (flag2) { result = null; } else { bool flag3 = i == num - 1; if (!flag3) { obj = memberInfo.GetValue(obj); i++; continue; } result = new StateTracker.TrackedInfo { relatedObj = obj, propInfo = memberInfo }; } } return(result); } result = null; return(result); }
public void SetInfo(StateTracker.TrackedInfo trackedInfo) { this.trackedInfo = trackedInfo; this.SaveValue(); }