public UrlFile[] GetFiles(UrlFile.FileType type) { List <UrlFile> list = new List <UrlFile>(); foreach (UrlFile file in this._files) { if (file.Type == type) { list.Add(file); } } foreach (UrlDir child in this._children) { list.AddRange(child.GetFiles(type)); } return(list.ToArray()); }
public void ConfigureFile(ConfigFileType[] fileConfig) { if (this._type != UrlFile.FileType.Unknown) { return; } int num = fileConfig.Length; for (int i = 0; i < num; i++) { ConfigFileType configFileType = fileConfig[i]; int count = configFileType.Extensions.Count; for (int j = 0; j < count; i++) { if (configFileType.Extensions[j] == this._extension) { this._type = configFileType.type; return; } } } }
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>(); } }
public ConfigFileType(UrlFile.FileType fileType, string[] extensions) { this.type = fileType; this._extensions = new List <string>(extensions); }
public ConfigFileType() { this.type = UrlFile.FileType.Unknown; this._extensions = new List <string>(); }