public void Load(UrlConfig urlConfig, ConfigNode node) { this._partUrl = urlConfig.Url; this._urlConfig = urlConfig; this._configFileFullName = urlConfig.Parent.FullPath; this.Load(node); }
public Part Add(UrlConfig urlConfig) { ConfigNode node = urlConfig.Config; if (!node.HasValue("name")) { Debug.LogWarning("Config has no name field"); return(null); } string name = node.GetValue("name"); if (this.Contains(name)) { Debug.LogWarning("PartList: Already contains part of name '" + name + "'"); return(null); } Part part = new Part(); part.Load(urlConfig, node); Debug.Log(string.Concat(new object[] { "Part '", part.title, " (", part.name, ")' loaded from '", part.Mod, "' mod" })); this._dict.Add(part.name, part); return(part); }
public PartResourceDefinition Add(UrlConfig urlConfig) { ConfigNode node = urlConfig.Config; if (!node.HasValue("name")) { Debug.LogWarning("Config has no name field"); return(null); } string name = node.GetValue("name"); if (this.Contains(name)) { Debug.LogWarning("PartResourceList: Already contains resource of name '" + name + "'"); return(null); } PartResourceDefinition def = new PartResourceDefinition(); def.Load(urlConfig, node); Debug.Log(string.Concat(new object[] { "Resource definition '", def.name, "' loaded from '", def.Mod, "' mod" })); this._dict.Add(def.id, def); return(def); }
public ConfigNode GetConfigNode(string url) { UrlConfig config = this._root.GetConfig(url); if (config == null) { return(null); } return(config.Config); }
private UrlConfig GetConfig(UrlIdentifier id, int index) { if (index == id.UrlDepth) { int count = this._files.Count; for (int i = 0; i < count; i++) { UrlFile urlFile = this._files[i]; if (urlFile.Type == UrlFile.FileType.Config) { if (urlFile.ContainsConfig(id[index])) { return(urlFile.GetConfig(id[index])); } } } } else { int count2 = this._children.Count; for (int j = 0; j < count2; j++) { UrlDir urlDir = this._children[j]; if (urlDir.Name != string.Empty) { if (id[index] == urlDir.Name) { return(urlDir.GetConfig(id, index + 1)); } } else { UrlConfig config = urlDir.GetConfig(id, index); if (config != null) { return(config); } } } int count3 = this._files.Count; for (int k = 0; k < count3; k++) { UrlFile urlFile2 = this._files[k]; if (urlFile2.Type == UrlFile.FileType.Config) { if (id[index] == urlFile2.Name) { return(urlFile2.GetConfig(id[index + 1])); } } } } return(null); }
public UrlConfig[] GetConfigs(string typeName) { List <UrlConfig> list = new List <UrlConfig>(this._root.GetConfigs(typeName, true)); UrlConfig[] array = new UrlConfig[list.Count]; int count = list.Count; for (int i = 0; i < count; i++) { array[i] = list[i]; } return(array); }
public UrlFile(UrlDir parent, FileInfo info) { this._name = Path.GetFileNameWithoutExtension(info.Name); this._fullPath = info.FullName; this._extension = Path.GetExtension(info.Name); this._fileTime = info.LastWriteTime; if (this._extension.Length > 1) { this._extension = this._extension.Substring(1); } this._parent = parent; this._root = parent.Root; if (this._extension == "cfg") { this._type = UrlFile.FileType.Config; this._configs = UrlConfig.CreateNodeList(parent, this); } else { this._type = UrlFile.FileType.Unknown; this._configs = new List <UrlConfig>(); } }