public static List <string> GetAliveBattleTypes()
        {
            WeakReferenceInfo.Cleanup();

            var list = WeakReferenceInfo.weakReferencesBattle.Select(x => {
                var typeName = x.type.FullName;
                return(string.IsNullOrEmpty(x.comment) == true ? typeName : typeName + " = " + x.comment);
            }).ToList();

            return(list);
        }
        public static Dictionary <string, string> CompareTypenames()
        {
            WeakReferenceInfo.Cleanup();

            var dict1 = new Dictionary <System.Type, int>();
            var dict2 = new Dictionary <System.Type, int>();

            for (var i = 0; i < WeakReferenceInfo.weakReferences.Count; ++i)
            {
                var type = WeakReferenceInfo.weakReferences[i].type;
                if (dict1.ContainsKey(type) == true)
                {
                    ++dict1[type];
                }
                else
                {
                    dict1.Add(type, 1);
                }
            }

            for (var i = 0; i < WeakReferenceInfo.weakReferencesTemp.Count; ++i)
            {
                var type = WeakReferenceInfo.weakReferencesTemp[i].type;
                if (dict2.ContainsKey(type) == true)
                {
                    ++dict2[type];
                }
                else
                {
                    dict2.Add(type, 1);
                }
            }

            var compare = new Dictionary <string, string>();

            foreach (var pair in dict2)
            {
                int value;
                if (dict1.TryGetValue(pair.Key, out value) == false)
                {
                    continue;
                }
                var diff = value - pair.Value;
                if (diff == 0)
                {
                    continue;
                }

                compare.Add(pair.Key.FullName, string.Format("{0}-{1}={2}", value, pair.Value, diff));
            }

            return(compare);
        }
        public static void RegisterDB <T>(T obj, string path)
        {
            if (WindowSystem.IsDebugWeakReferences() == false)
            {
                return;
            }

            var stack = new System.Diagnostics.StackTrace(fNeedFileInfo: true);
            var info  = new WeakReferenceInfo(new System.WeakReference(obj), obj.GetType(), stack.ToString());

            WeakReferenceInfo.dbWeakReferences[path] = info;
        }
        public static void Register <T>(T obj)
        {
            if (WindowSystem.IsDebugWeakReferences() == true)
            {
                var stack = new System.Diagnostics.StackTrace(fNeedFileInfo: true);
                var info  = new WeakReferenceInfo(new System.WeakReference(obj), obj.GetType(), stack.ToString());

                /*if (MW2.Gameplay.Battle.current != null) {
                 *
                 *      WeakReferenceInfo.weakReferencesBattle.Add(info);
                 *
                 * } else {
                 *
                 *      WeakReferenceInfo.weakReferences.Add(info);
                 *
                 * }*/
                WeakReferenceInfo.weakReferences.Add(info);
            }
        }
        public static void Save()
        {
            WeakReferenceInfo.Cleanup();

            WeakReferenceInfo.weakReferencesTemp = new List <WeakReferenceInfo>(WeakReferenceInfo.weakReferences);
        }
        public static int GetAliveTypesCount()
        {
            WeakReferenceInfo.Cleanup();

            return(WeakReferenceInfo.weakReferences.Count);
        }