Example #1
0
        private static Dictionary <string, FileInfo> GetFiles(string dir)
        {
            Dictionary <string, FileInfo> files = new Dictionary <string, FileInfo>();

            foreach (FileInfo f in AssetUtil.ListFiles(dir))
            {
                string path = f.FullName.ToUnixPath();
                if (path.StartsWith(dir))
                {
                    files.Add(PathUtil.GetRelativePath(path, dir), f);
                }
                else
                {
                    Debug.LogError("not Reachable");
                }
            }
            return(files);
        }
Example #2
0
 /// <summary>
 /// List the files and generate url to local path map
 /// </summary>
 public void ClearCache(string dir)
 {
     log.Debug("Clear Cache Directory: {0}", dir);
     if (dir.Is(FileType.Zip))
     {
         dir = PathUtil.DetachExt(dir);
     }
     if (Directory.Exists(dir))
     {
         foreach (FileInfo f in AssetUtil.ListFiles(dir, "*" + EXT))
         {
             string path = f.FullName;
             if (File.Exists(path))
             {
                 Entry entry = new Entry(File.ReadAllText(path, Encoding.UTF8));
                 url2file.Remove(entry.url);
                 DeleteLocalFile(new FileInfo(path.Substring(0, path.Length - EXT.Length)));
             }
         }
     }
 }