Пример #1
0
        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());
        }
Пример #2
0
        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;
                    }
                }
            }
        }
Пример #3
0
 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>();
     }
 }
Пример #4
0
 public ConfigFileType(UrlFile.FileType fileType, string[] extensions)
 {
     this.type        = fileType;
     this._extensions = new List <string>(extensions);
 }
Пример #5
0
 public ConfigFileType()
 {
     this.type        = UrlFile.FileType.Unknown;
     this._extensions = new List <string>();
 }