internal static void ParseIDMatrixData(string packedData) { IsHostVanilla = false; MatrixReady = false; try { foreach (string dicEntry in packedData.Split('|')) { string[] splitDic = dicEntry.Split(new char[] { ':' }, 2); if (GameRegistry.IsRegistryRegistered(splitDic[0])) { Registry reg = GameRegistry.GetRegistry(splitDic[0]); IDConversionMatrixToHost[reg.GetRegistryName()] = new Dictionary <int, int>(); IDConversionMatrixToLocal[reg.GetRegistryName()] = new Dictionary <int, int>(); foreach (string regEntry in splitDic[1].Split(',')) { string[] splitReg = regEntry.Split('='); if (reg.reservedIDs.ContainsKey(splitReg[0])) { int hostID = int.Parse(splitReg[1]); IDConversionMatrixToHost[reg.GetRegistryName()][reg.reservedIDs[splitReg[0]]] = hostID; IDConversionMatrixToLocal[reg.GetRegistryName()][hostID] = reg.reservedIDs[splitReg[0]]; } } } } MatrixReady = true; } catch (Exception e) { GadgetCore.Log("Received bad host ID conversion data: " + packedData); GadgetCore.Log("Exception that occured while parsing host ID conversion data:" + Environment.NewLine + e.ToString()); Network.Disconnect(); } }
internal static void InitializeVanillaIDMatrix() { IsHostVanilla = true; MatrixReady = false; foreach (Registry reg in GameRegistry.ListAllRegistries()) { IDConversionMatrixToHost[reg.GetRegistryName()] = new Dictionary <int, int>(); IDConversionMatrixToLocal[reg.GetRegistryName()] = new Dictionary <int, int>(); } MatrixReady = true; }
internal static void UnregisterGadget(GadgetInfo mod) { gadgets.Remove(mod.Attribute.Name); foreach (Registry reg in GameRegistry.ListAllRegistries()) { reg.UnregisterGadget(mod); } mod.Mod.m_LoadedGadgets.Remove(mod); mod.Mod.m_UnloadedGadgets.Add(mod); if (!GadgetLoader.BatchLoading) { SortGadgets(); } }
internal static void UnregisterGadget(GadgetInfo mod) { gadgets.Remove(mod.Attribute.Name); foreach (MultiTreeList <GadgetInfo> node in LoadOrderTree.FindAll(mod)) { node.RemoveFromTree(); } foreach (Registry reg in GameRegistry.ListAllRegistries()) { reg.UnregisterGadget(mod); } mod.Mod.m_LoadedGadgets.Remove(mod); mod.Mod.m_UnloadedGadgets.Add(mod); if (!GadgetLoader.BatchLoading) { SortGadgets(); } }
internal static string GenerateIDMatrixData() { return(GameRegistry.ListAllRegistries().Select(x => x.GetRegistryName() + ":" + x.reservedIDs.Select(w => w.Key + "=" + w.Value).Aggregate(string.Empty, (y, z) => y + "," + z)).Aggregate(string.Empty, (y, z) => y + "|" + z)); }