Esempio n. 1
0
 void AddToDictionnary <T>(SerializableDictionary <string, T> dic, string key, T value)
 {
     if (dic.ContainsKey(key))
     {
         dic.Remove(key);
     }
     dic.Add(key, value);
 }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex < 0)
            {
                return;
            }
            var pair = Commands.ElementAt(listBox1.SelectedIndex);
            var v    = new NewCommand(pair.Key, pair.Value);

            v.ShowDialog();
            if (v.IsOK)
            {
                Commands.Remove(pair.Key);
                Commands.Add(v.Key, v.Value);
                RefreshCommands();
            }
        }
Esempio n. 3
0
        public void RemoveState(Type type)
        {
            if (type == null || !_dockStates.ContainsKey(type.Name))
            {
                return;
            }

            _dockStates.Remove(type.Name);
        }
Esempio n. 4
0
        public void RemovePlayer(ulong steamId)
        {
            lock (Instance)
            {
                playerLogins.Remove(steamId);
            }

            Save();
        }
Esempio n. 5
0
        private static bool Remove <T>(string key, SerializableDictionary <string, T> target)
        {
            if (target != null)
            {
                return(target.Remove(key));
            }

            return(false);
        }
Esempio n. 6
0
        public void RemovePlayer(Guid id)
        {
            PlayerHandler player = Players[id];

            UsernameDatabase.Save(player.username, player);
            ChunkManager.Get.RemovePlayer(player);

            Destroy(player.gameObject);
            Players.Remove(id);
        }
Esempio n. 7
0
        internal static void Postfix(GameLocation __instance, Rectangle position)
        {
            SerializableDictionary <Vector2, Object> objects = __instance.objects;
            Vector2 key = new Vector2((position.Left / Game1.tileSize), (position.Top / Game1.tileSize));

            if (objects.ContainsKey(key) && objects[key] is Chest chest && chest.name.Equals("collider"))
            {
                objects.Remove(key);
            }
        }
Esempio n. 8
0
        public void DeleteTest(string name)
        {
            SerializableDictionary <string, Experiment> tests = GetTests();

            if (tests.ContainsKey(name))
            {
                tests.Remove(name);
                SaveTests(tests);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Deletes a key from the Settings
        /// </summary>
        /// <param name="key">Name of setting</param>
        /// <returns>Boolean</returns>
        public bool Delete(string key)
        {
            if (!_settingsDictionary.ContainsKey(key))
            {
                return(false);
            }

            _settingsDictionary.Remove(key);

            return(true);
        }
Esempio n. 10
0
 public void UnregisterRecipeItem(int dataId)
 {
     if (RecipeItemPool.ContainsKey(dataId))
     {
         var newItem = RecipeItemPool[dataId];
         newItem.ItemCreated  -= newItem_Built;
         newItem.PriceChanged -= newItem_Crawled;
         RecipeItemPool[dataId].Items.Clear();
         RecipeItemPool.Remove(dataId);
     }
 }
Esempio n. 11
0
        public void AddComment(string key, string value)
        {
            if (DemoCommentDictionary.ContainsKey(key))
            {
                DemoCommentDictionary.Remove(key);
            }

            if (!string.IsNullOrEmpty(value))
            {
                DemoCommentDictionary.Add(key, value);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Delete the server
        /// If something wrong exception will be thrown
        /// </summary>
        public void DeleteServer(int serverId)
        {
            var server = _meta.getServer(serverId);

            // delete on remote side
            server.delete();

            // remove from cache
            if (_servers.ContainsKey(serverId))
            {
                _servers.Remove(serverId);
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Calculate the probability for each category,
        /// and will determine which one is the largest
        /// and whether it exceeds the next largest by more than its threshold
        /// </summary>
        /// <param name="item">Item</param>
        /// <param name="defaultCat">Default category</param>
        /// <returns>Category which item mostly belongs to</returns>
        public string Classify(string item, string defaultCat = "unknown")
        {
            SerializableDictionary <string, double> probs = new SerializableDictionary <string, double>();
            string best     = "";
            string possible = "";

            // Find the category with highest probability
            double max = 0.0;

            foreach (var category in Categories())
            {
                probs.Add(category, Probability(item, category));
                if (probs[category] > max)
                {
                    max  = probs[category];
                    best = category;
                }
            }

            // Find the second suitable category
            if (probs.ContainsKey(best))
            {
                probs.Remove(best);
            }
            max = 0.0;
            foreach (var category in probs)
            {
                if (category.Value > max)
                {
                    max      = category.Value;
                    possible = category.Key;
                }
            }
            probs.Add(best, Probability(item, best));


            // Make sure the probability exceeds threshould*next best
            foreach (var cat in probs)
            {
                if (cat.Key == best)
                {
                    continue;
                }
                if (cat.Value * GetThreshold(best) > probs[best])
                {
                    return(defaultCat);
                }
            }
            return(best + (possible.Length > 0 ? (" or " + possible) : ""));
        }
Esempio n. 14
0
        /// <summary>
        /// Calculate the probability for each category,
        /// and will determine which one is the largest
        /// and whether it exceeds the next largest by more than its threshold
        /// </summary>
        /// <param name="item">Item</param>
        /// <param name="defaultCat">Default category</param>
        /// <returns>Category which item mostly belongs to</returns>
        public string Classify(string item, string defaultCat = "unknown")
        {
            SerializableDictionary<string, double> probs = new SerializableDictionary<string, double>();
            string best = "";
            string possible = "";

            // Find the category with highest probability
            double max = 0.0;
            foreach (var category in Categories())
            {
                probs.Add(category, Probability(item, category));
                if (probs[category] > max)
                {
                    max = probs[category];
                    best = category;
                }
            }

                // Find the second suitable category
                if (probs.ContainsKey(best))
                {
                    probs.Remove(best);
                }
                max = 0.0;
                foreach (var category in probs)
                {
                    if (category.Value > max)
                    {
                        max = category.Value;
                        possible = category.Key;
                    }
                }
            probs.Add(best, Probability(item, best));
            

            // Make sure the probability exceeds threshould*next best
            foreach (var cat in probs)
            {
                if (cat.Key == best)
                {
                    continue;
                }
                if (cat.Value * GetThreshold(best) > probs[best])
                {
                    return defaultCat;
                }
            }
            return best + (possible.Length > 0 ? (" or " + possible) : "");
        }
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            Dictionary <byte, object> requestParameter = operationRequest.Parameters;

            //拿到用户名,卡包类型,卡包数量
            String userName      = (String)DictionaryUtils.getValue <byte, object>(requestParameter, (byte)ParameterCode.UserName);
            Series packageSeries = (Series)DictionaryUtils.getValue <byte, object>(requestParameter, (byte)ParameterCode.Series);
            int    packageNumber = (int)DictionaryUtils.getValue <byte, object>(requestParameter, (byte)ParameterCode.PackageNumber);

            //操作用户的卡包字典
            User user = DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName);
            SerializableDictionary <Series, int> packageInfoDict = user.MyCardsPackage;
            int allPackageNumber = packageNumber + DictionaryUtils.getValue <Series, int>(packageInfoDict, packageSeries);

            packageInfoDict.Remove(packageSeries);
            packageInfoDict.Add(packageSeries, allPackageNumber);

            //重新封装包信息
            bool success = UserManager.disassembleCardPackageInfo(userName, packageInfoDict);
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            if (success)
            {
                DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName).MyCardsPackage = packageInfoDict;

                //减少钱
                user.Money -= packageNumber * 100;
                UserManager.Update(user);

                //改变user
                user.MyCardsPackage = packageInfoDict;
                Application.loginUserDict.Remove(user.UserName);
                Application.loginUserDict.Add(user.UserName, user);

                //封装返回信息
                responseParameter.Add((byte)ParameterCode.PurchaseCardPackageResult, 1);
            }
            else
            {
                responseParameter.Add((byte)ParameterCode.PurchaseCardPackageResult, 0);
            }

            Application.logger.Info("===================" + user.UserName + "买了" + packageNumber + "包" + packageSeries + "系列的卡包,还剩" + user.Money + "=====================");

            //响应客户端
            OperationResponse operationResponse = new OperationResponse((byte)OPCode.PurchaseCardPackage, responseParameter);

            peer.SendOperationResponse(operationResponse, sendParameters);
        }
Esempio n. 16
0
        public void SetAbilityPriority(EnhanceAbility abilityType, Priority priority)
        {
            Priority value = GetAbilityPriority(abilityType);

            if (value.AbilityType != EnhanceAbility.None)
            {
                _priorityList.Remove(abilityType);
            }
            if (priority.PriorityValue > 0)
            {
                _priorityList.Add(abilityType, priority);
            }
            // update the sorted list
            SortPriorities();
        }
Esempio n. 17
0
 public void SetProgramTag(string title, EProgramTag tag)
 {
     if (tag == EProgramTag.None)
     {
         TagedProgramms.Remove(title);
         HasChanged = true;
         return;
     }
     if (GetProgramTag(title) == tag)
     {
         return;
     }
     TagedProgramms[title] = tag;
     HasChanged            = true;
 }
Esempio n. 18
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     try
     {
         if (listBox1.SelectedItem != null)
         {
             string i  = (string)listBox1.SelectedItem;
             IPAddr ip = IPAddr.Parse(i.Split(' ')[2]);
             cache.Remove(ip);
             saap.UpdateCache(cache);
             cache = saap.GetCache();
             saap_UpdatedArpCache();
         }
     }
     catch { }
 }
Esempio n. 19
0
        /// <summary>
        /// Limpia la colección de disrupciones de posibles valores nulos
        /// </summary>
        public void LimpiarDiccionario()
        {
            List <string> keysForRemove = new List <string>();

            foreach (string id in _coleccion_disrupciones.Keys)
            {
                if (_coleccion_disrupciones[id] == null)
                {
                    keysForRemove.Add(id);
                }
            }
            foreach (string id in keysForRemove)
            {
                _coleccion_disrupciones.Remove(id);
            }
        }
 private void txtShowCheckBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (lstShowCheckBox.SelectedItem != null)
         {
             int index = lstShowCheckBox.SelectedIndex;
             lstShowCheckBox.Items.RemoveAt(index);
             lstShowCheckBox.Items.Insert(index, txtShowCheckBox.Text);
             SCBConfigs.Remove(lstShowCheckBox.SelectedItem.ToString());
         }
         else
         {
             lstShowCheckBox.Items.Add(txtShowCheckBox.Text);
         }
     }
 }
Esempio n. 21
0
 private void SaveEvents_BeforeSave(object sender, EventArgs e)
 {
     //resolve bug 3 (issue 46)
     foreach (GameLocation location in Game1.locations)
     {
         for (int index = location.terrainFeatures.Count - 1; index >= 0; --index)
         {
             KeyValuePair <Vector2, TerrainFeature> keyValuePair = location.terrainFeatures.ElementAt <KeyValuePair <Vector2, TerrainFeature> >(index);
             if (!location.isTileOnMap(keyValuePair.Key))
             {
                 SerializableDictionary <Vector2, TerrainFeature> terrainFeatures = location.terrainFeatures;
                 keyValuePair = location.terrainFeatures.ElementAt <KeyValuePair <Vector2, TerrainFeature> >(index);
                 Vector2 key = keyValuePair.Key;
                 terrainFeatures.Remove(key);
             }
         }
     }
 }
        public static void RemoveNodeFromList(string profName)
        {
            List <profileNode> toRemove = new List <profileNode>();

            foreach (var item in internalList)
            {
                if (item.Key.profName == profName)
                {
                    toRemove.Add(item.Key);
                }
            }
            foreach (var item in toRemove)
            {
                internalList.Remove(item);
            }

            SaveProfiles();
        }
        private void RemoveCountInfoForOther()
        {
            if (_oneLedInfos != null && _oneLedInfos.Count > 0)
            {
                List <string>       addrTempList      = new List <string>();
                string              addr              = "";
                ScanBoardRegionInfo scanBoardTempInfo = null;
                foreach (ILEDDisplayInfo led in _oneLedInfos)
                {
                    if (led == null)
                    {
                        continue;
                    }
                    for (int j = 0; j < led.ScannerCount; j++)
                    {
                        if (led[j] == null || led[j].SenderIndex == 255)
                        {
                            continue;
                        }
                        scanBoardTempInfo = (ScanBoardRegionInfo)led[j].Clone();
                        addr = StaticFunction.GetSBAddr(_commPort,
                                                        scanBoardTempInfo.SenderIndex,
                                                        scanBoardTempInfo.PortIndex,
                                                        scanBoardTempInfo.ConnectIndex);
                        addrTempList.Add(addr);
                    }
                }

                List <string> otherScanBoardAddrList = new List <string>();

                foreach (string key in _curConfigDic.Keys)
                {
                    if (!addrTempList.Contains(key))
                    {
                        otherScanBoardAddrList.Add(key);
                    }
                }

                for (int i = 0; i < otherScanBoardAddrList.Count; i++)
                {
                    _curConfigDic.Remove(otherScanBoardAddrList[i]);
                }
            }
        }
Esempio n. 24
0
 public void Remove(IPAddr ip)
 {
     try
     {
         locker.AcquireReaderLock(new TimeSpan(0, 1, 0));
         try
         {
             if (list.ContainsKey(ip))
             {
                 LockCookie lc = new LockCookie();
                 try
                 {
                     lc = locker.UpgradeToWriterLock(new TimeSpan(0, 1, 0));
                     try
                     {
                         list.Remove(ip);
                     }
                     finally
                     {
                         locker.DowngradeFromWriterLock(ref lc);
                     }
                 }
                 catch (ApplicationException e)
                 {
                     Logging.LogCenter.Instance.LogException(e);
                 }
             }
         }
         finally
         {
             locker.ReleaseReaderLock();
         }
     }
     catch (ApplicationException aex)
     {
         Logging.LogCenter.Instance.LogException(aex);
     }
 }
Esempio n. 25
0
        public bool DeleteFeatureCategoryCombination(string feature, string category)
        {
            SerializableKeyValuePair <string, string> pair =
                new SerializableKeyValuePair <string, string>(feature, category);

            if (FeatureCategoryCombinations.ContainsKey(pair))
            {
                int count = FeatureCategoryCombinations[pair];
                FeatureCategoryCombinations.Remove(pair);
                if (ItemsCountInCategory[category] >= count)
                {
                    ItemsCountInCategory[category] -= count;
                }
                else
                {
                    ItemsCountInCategory.Remove(category);
                    Thresholds.Remove(category);
                }

                return(true);
            }
            return(false);
        }
Esempio n. 26
0
        private void RemoveSelected()
        {
            ListViewItem     item = null;
            ConnectionParams cp   = null;
            string           key  = null;

            while (lv.SelectedItems.Count > 0)
            {
                item = lv.SelectedItems[0];
                cp   = item.Tag as ConnectionParams;
                lv.Items.Remove(item);
                if (cp == null)
                {
                    continue;
                }

                key = ConnectionParams.PrepareConnKeyWithDb(cp);
                if (_selectedConnections.ContainsKey(key))
                {
                    _selectedConnections.Remove(key);
                }
            }
        }
Esempio n. 27
0
            public bool doAbort(int TxId)
            {
                lock (_stateLockObj) {
                    if (isFail)
                    {
                        Console.WriteLine("[!doAbort] Error: DataServer " + name + " is set to [Fail] mode!");
                        Console.WriteLine("---");
                        while (true)
                        {
                            ;
                        }
                        //throw new RemotingException("Server is in Fail Mode");
                    }
                    else if (isFreeze)
                    {
                        lock (SingletonCounter.Instance) {
                            SingletonCounter.Instance.incrementLockCounter();
                            Monitor.Wait(SingletonCounter.Instance);
                        }
                    }
                }
                Console.WriteLine("[doAbort] Master Request with id " + TxId);
                Console.WriteLine("---");
                if (!this.Transactions.ContainsKey(TxId))
                {
                    Console.WriteLine("Error transaction not found : " + TxId);
                    return(false);
                }
                ServerTransaction transaction = Transactions[TxId];

                transaction.rollback();
                //Let's release the locks (reverse order?)
                _lockManager.unLock(TxId);
                transactions.Remove(TxId);
                return(true);
            }
Esempio n. 28
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        CheckInitialize(property, label);

        position.height = 17f;

        var foldoutRect = position;

        foldoutRect.width -= 2 * kButtonWidth;
        EditorGUI.BeginChangeCheck();
        _Foldout = EditorGUI.Foldout(foldoutRect, _Foldout, label, true);
        if (EditorGUI.EndChangeCheck())
        {
            EditorPrefs.SetBool(label.text, _Foldout);
        }

        var buttonRect = position;

        buttonRect.x     = position.width - kButtonWidth + position.x;
        buttonRect.width = kButtonWidth + 2;

        if (GUI.Button(buttonRect, new GUIContent("+", "Add item"), EditorStyles.miniButton))
        {
            AddNewItem();
            EditorUtility.SetDirty(property.serializedObject.targetObject);
        }

        buttonRect.x -= kButtonWidth;

        if (GUI.Button(buttonRect, new GUIContent("X", "Clear dictionary"), EditorStyles.miniButtonRight))
        {
            ClearDictionary();
            EditorUtility.SetDirty(property.serializedObject.targetObject);
        }

        if (!_Foldout)
        {
            return;
        }

        foreach (var item in _Dictionary)
        {
            var key   = item.Key;
            var value = item.Value;

            position.y += 17f;

            var keyRect = position;
            keyRect.width /= 2;
            keyRect.width -= 4;
            EditorGUI.BeginChangeCheck();
            var newKey = DoField(keyRect, typeof(TK), key);
            if (EditorGUI.EndChangeCheck())
            {
                try
                {
                    _Dictionary.Remove(key);
                    _Dictionary.Add(newKey, value);
                    EditorUtility.SetDirty(property.serializedObject.targetObject);
                }
                catch (Exception e)
                {
                    Debug.Log(e.Message);
                }
                break;
            }

            var valueRect = position;
            valueRect.x     = position.width / 2 + 15;
            valueRect.width = keyRect.width - kButtonWidth;
            EditorGUI.BeginChangeCheck();
            value = DoField(valueRect, typeof(TV), value);
            if (EditorGUI.EndChangeCheck())
            {
                //_Dictionary[key] = value;
                _Dictionary.Remove(key);
                _Dictionary.Add(newKey, value);
                EditorUtility.SetDirty(property.serializedObject.targetObject);
                break;
            }

            var removeRect = valueRect;
            removeRect.x     = valueRect.xMax + 2;
            removeRect.width = kButtonWidth;
            if (GUI.Button(removeRect, new GUIContent("x", "Remove item"), EditorStyles.miniButtonRight))
            {
                RemoveItem(key);
                EditorUtility.SetDirty(property.serializedObject.targetObject);
                break;
            }
        }
    }
Esempio n. 29
0
 public void RemoveParameter(string parameterName)
 {
     parameters.Remove(parameterName);
 }
 public override void Remove(int slot)
 {
     items.Remove(slot);
 }
Esempio n. 31
0
        internal static void placeElements()
        {
            OnBeforeRebuilding(EventArgs.Empty);

            findElements();

            elements = new List <object>();
            elements.AddRange(characters);
            elements.AddRange(animals);
            elements.AddRange(objects);
            elements.AddRange(storage);
            elements.AddRange(attachements);

            if (Game1.player.hat != null && Game1.player.hat.name.Contains("CEHe"))
            {
                string   name = Game1.player.hat.name;
                string[] data = name.Split('/');

                object replacement = rebuildElement(data, Game1.player.hat);

                Game1.player.hat = (Hat)replacement;
            }
            if (Game1.player.boots != null && Game1.player.boots.name.Contains("CEHe"))
            {
                string   name = Game1.player.boots.name;
                string[] data = name.Split('/');

                object replacement = rebuildElement(data, Game1.player.boots);
                Game1.player.boots = (Boots)replacement;
            }

            if (Game1.player.leftRing != null && Game1.player.leftRing.name.Contains("CEHe"))
            {
                string   name = Game1.player.leftRing.name;
                string[] data = name.Split('/');

                object replacement = rebuildElement(data, Game1.player.leftRing);
                Game1.player.leftRing = (Ring)replacement;
            }

            if (Game1.player.rightRing != null && Game1.player.rightRing.name.Contains("CEHe"))
            {
                string   name = Game1.player.rightRing.name;
                string[] data = name.Split('/');

                object replacement = rebuildElement(data, Game1.player.rightRing);
                Game1.player.rightRing = (Ring)replacement;
            }

            for (int i = 0; i < elements.Count; i++)
            {
                if (elements[i] is List <Item> )
                {
                    List <Item> list = (List <Item>)elements[i];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (list[j] != null && list[j].Name.Contains("CEHe"))
                        {
                            string name = list[j].Name;
                            if (list[j] is StardewValley.Object)
                            {
                                name = (list[j] as StardewValley.Object).name;
                            }

                            if (list[j] is StardewValley.Tool)
                            {
                                name = (list[j] as StardewValley.Tool).name;
                            }

                            string[] data = name.Split('/');

                            object replacement = rebuildElement(data, list[j]);
                            list[j] = (Item)replacement;
                        }
                    }
                }
                else if (elements[i] is SerializableDictionary <Vector2, StardewValley.Object> )
                {
                    SerializableDictionary <Vector2, StardewValley.Object> changes = new SerializableDictionary <Vector2, StardewValley.Object>();
                    SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature> terrainChanges = new SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature>();
                    SerializableDictionary <Vector2, StardewValley.Object> dict = (SerializableDictionary <Vector2, StardewValley.Object>)elements[i];
                    SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature> terrainDict = new SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature>();
                    if (elements[i + 1] is SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature> )
                    {
                        terrainDict = (SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature>)elements[i + 1];
                    }

                    foreach (Vector2 keyV in dict.Keys)
                    {
                        if (dict[keyV].Name.Contains("CEHe"))
                        {
                            string[] preData = dict[keyV].Name.Split('#');
                            string[] data    = preData[0].Split('/');

                            if (data[1] != "Terrain")
                            {
                                object replacement = rebuildElement(data, dict[keyV]);
                                changes.Add(keyV, (StardewValley.Object)replacement);
                            }
                            else
                            {
                                object replacement = rebuildElement(data, dict[keyV]);
                                terrainChanges.Add(keyV, (StardewValley.TerrainFeatures.TerrainFeature)replacement);

                                if (preData.Length == 1)
                                {
                                    changes.Add(keyV, new StardewValley.Object(-999, 1));
                                }
                                else
                                {
                                    if (!preData.Contains("CEHe"))
                                    {
                                        changes[keyV]      = dict[keyV];
                                        changes[keyV].name = preData[1];
                                    }
                                    else
                                    {
                                        string[] data2        = preData[1].Split('/');
                                        object   replacement2 = rebuildElement(data2, dict[keyV]);
                                        changes.Add(keyV, (StardewValley.Object)replacement2);
                                    }
                                }
                            }
                        }
                    }

                    foreach (Vector2 keyV in changes.Keys)
                    {
                        if (changes[keyV].parentSheetIndex != -999)
                        {
                            dict[keyV] = changes[keyV];
                        }
                        else
                        {
                            dict.Remove(keyV);
                        }
                    }

                    foreach (Vector2 keyV in terrainChanges.Keys)
                    {
                        terrainDict[keyV] = terrainChanges[keyV];
                    }
                }
                else if (elements[i] is StardewValley.Object[])
                {
                    StardewValley.Object[] list = (StardewValley.Object[])elements[i];
                    for (int j = 0; j < list.Length; j++)
                    {
                        if (list[j] != null && list[j].name.Contains("CEHe"))
                        {
                            string[] data = list[j].name.Split('/');

                            object replacement = rebuildElement(data, list[j]);
                            list[j] = (StardewValley.Object)replacement;
                        }
                    }
                }
                else if (elements[i] is SerializableDictionary <long, FarmAnimal> )
                {
                    SerializableDictionary <long, FarmAnimal> changes = new SerializableDictionary <long, FarmAnimal>();
                    SerializableDictionary <long, FarmAnimal> dict    = (SerializableDictionary <long, FarmAnimal>)elements[i];

                    foreach (long keyL in dict.Keys)
                    {
                        if (dict[keyL].name.Contains("CEHe"))
                        {
                            string[] data = dict[keyL].name.Split('/');

                            object replacement = rebuildElement(data, dict[keyL]);
                            changes[keyL] = (FarmAnimal)replacement;
                        }
                    }

                    foreach (long keyL in changes.Keys)
                    {
                        dict[keyL] = changes[keyL];
                    }
                }
                else if (elements[i] is List <NPC> )
                {
                    List <NPC> list = (List <NPC>)elements[i];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (list[j] != null && list[j].name.Contains("CEHe"))
                        {
                            string[] data = list[j].name.Split('/');

                            object replacement = rebuildElement(data, list[j]);
                            list[j] = (NPC)replacement;
                        }
                    }
                }
                else if (elements[i] is List <Furniture> )
                {
                    List <Furniture> list = (List <Furniture>)elements[i];
                    for (int j = 0; j < list.Count; j++)
                    {
                        if (list[j] != null && list[j].name.Contains("CEHe"))
                        {
                            string[] data = list[j].name.Split('/');

                            object replacement = rebuildElement(data, list[j]);
                            list[j] = (Furniture)replacement;
                        }
                    }
                }
            }

            OnFinishedRebuilding(EventArgs.Empty);
        }