示例#1
0
        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++;
                    }
                }
            }
        }
示例#2
0
        internal void SaveState()
        {
            List <StateTracker.State> list = this.states.Current();
            int i     = 0;
            int count = list.Count;

            while (i < count)
            {
                StateTracker.resourcePool.GiveBack(list[i]);
                i++;
            }
            list.Clear();
            int j      = 0;
            int count2 = this.trackedInfos.Count;

            while (j < count2)
            {
                StateTracker.State @new = StateTracker.resourcePool.GetNew();
                @new.SetInfo(this.trackedInfos[j]);
                list.Add(@new);
                j++;
            }
            this.MoveNextState();
        }