public static void LoadLanguage(string ID) { Dictionary <string, string> dict = new Dictionary <string, string>(); INIEntity ent = GlobalVar.INI[ID]; foreach (INIPair p in ent.DataList) { dict[p.Name] = p.Value; } Language.DICT = new Lang(dict); }
public TechnoPair(INIEntity ent, string index, AbstractType abstractType = AbstractType.RegName, IndexType indexType = IndexType.Index) { Index = index; Name = ent["Name"]; RegName = ent.Name; UIName = ent["UIName"]; switch (indexType) { default: case IndexType.Index: abst = Index; break; case IndexType.Name: abst = Name; Index = Name; break; case IndexType.RegName: abst = RegName; Index = RegName; break; } switch (abstractType) { default: case AbstractType.RegName: abst += " " + RegName; break; case AbstractType.Name: abst += " " + Name; break; case AbstractType.UIName: abst += " " + UIName; break; case AbstractType.IndexOnly: abst += ""; break; } }
private void LoadTemplates(string path, TreeView tv, TreeNode parent) { using (INIFile thisINI = new INIFile(path)){ INIEntity node = thisINI.PopEnt("Node"); bool isBody = node.PopPair("IsBody").ParseBool(true); string displayName = node.PopPair("DisplayName").Value; bool hasChild = node.PopPair("HasChild").ParseBool(false); string[] children = null; if (hasChild) { children = node.PopPair("Children").ParseStringList(); } if (isBody) { INIEntity body = thisINI.PopEnt("Body"); NewTemplateMode defaultMode = Enum.Parse(typeof(NewTemplateMode), body.PopPair("GlobalMode").Value); List <int> data = new List <int>(); for (int i = 0; i < 256; i++) { INIPair pair = body.PopPair(i.ToString()); if (pair == INIPair.NullPair) { data.Add(Constant.Colors.PaletteBlack); continue; } string[] tmp = pair.ParseStringList(); int defLen = Misc.GetTemplateLength(defaultMode); if (tmp.Length > defLen) { NewTemplateMode curMode = (NewTemplateMode)Enum.Parse(typeof(NewTemplateMode), tmp[defLen]); int curLen = Misc.GetTemplateLength(curMode); if (tmp.Length != curLen + 1) { data.Add(Constant.Colors.PaletteBlack); continue; } // else data.Add(Misc.ReadColor(curMode, tmp)); } else if (tmp.Length == defLen) { data.Add(Misc.ReadColor(defaultMode, tmp)); } else { data.Add(Constant.Colors.PaletteBlack); } continue; } TreeNode tn = new TreeNode(displayName) { Tag = data }; parent.Nodes.Add(tn); return; } else { if (!hasChild) { return; } // else TreeNode newParent = new TreeNode(displayName); foreach (string child in children) { INIEntity thisEnt = thisINI.PopEnt(child); LoadTemplates(thisEnt.PopPair("Path").Value, tv, newParent); } if (parent == null) { tv.Nodes.Add(newParent); return; } else { parent.Nodes.Add(newParent); } } } }