Example #1
0
 private UrlFile GetFile(UrlIdentifier id, int index)
 {
     if (index == id.UrlDepth)
     {
         int count = this._files.Count;
         for (int i = 0; i < count; i++)
         {
             if (id[index] == this._children[i].Name)
             {
                 return(this._files[i]);
             }
         }
     }
     else
     {
         int count2 = this._children.Count;
         for (int j = 0; j < count2; j++)
         {
             if (id[index] == this._children[j].Name)
             {
                 return(this._children[j].GetFile(id, index + 1));
             }
         }
     }
     return(null);
 }
Example #2
0
        private UrlDir CreateDirectory(UrlIdentifier id, int index)
        {
            if (index == id.UrlDepth)
            {
                int count = this._children.Count;
                for (int i = 0; i < count; i++)
                {
                    if (id[index] == this._children[i].Name)
                    {
                        return(this._children[i]);
                    }
                }
                DirectoryInfo info   = Directory.CreateDirectory(Path.Combine(this._fullPath, id[index]));
                UrlDir        urlDir = new UrlDir(this, info);
                this._children.Add(urlDir);
                return(urlDir);
            }
            int count2 = this._children.Count;

            for (int j = 0; j < count2; j++)
            {
                if (id[index] == this._children[j].Name)
                {
                    return(this._children[j].CreateDirectory(id, index + 1));
                }
            }
            return(null);
        }
Example #3
0
        public UrlFile GetFile(string url)
        {
            UrlIdentifier urlIdentifier = new UrlIdentifier(url);

            if (urlIdentifier.UrlDepth == -1)
            {
                return(null);
            }
            return(this.GetFile(new UrlIdentifier(url), 0));
        }
Example #4
0
        public UrlDir GetDirectory(string url)
        {
            UrlIdentifier urlIdentifier = new UrlIdentifier(url);

            if (urlIdentifier.UrlDepth == -1)
            {
                return(null);
            }
            return(this.GetDirectory(new UrlIdentifier(url), 0));
        }
Example #5
0
        public UrlDir CreateDirectory(string urlDir)
        {
            UrlIdentifier urlIdentifier = new UrlIdentifier(this.Url);

            if (urlIdentifier.UrlDepth == -1)
            {
                return(null);
            }
            return(this.CreateDirectory(urlIdentifier, 0));
        }
Example #6
0
 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);
 }
Example #7
0
        public UrlConfig GetConfig(string url)
        {
            UrlIdentifier urlIdentifier = new UrlIdentifier(url);

            if (urlIdentifier.UrlDepth == -1)
            {
                Debug.LogError("Invalid url: '" + url + "'");
                return(null);
            }
            return(this.GetConfig(urlIdentifier, 0));
        }
Example #8
0
 public bool Exists(UrlIdentifier url, int index)
 {
     if (url.UrlDepth == -1)
     {
         return(false);
     }
     if (index != url.UrlDepth)
     {
         return(false);
     }
     if (this.GetConfig(url[index]) == null)
     {
         return(false);
     }
     return(true);
 }
Example #9
0
 private void ConstructUrl(string url)
 {
     this._url      = url;
     this._urlSplit = UrlIdentifier.UrlSpliter(url);
     this._urlDepth = this._urlSplit.Length - 1;
 }