Example #1
0
        /// <summary>
        /// Opens a file stream to the given asset
        /// </summary>
        /// <param name="id">The Id of the file</param>
        /// <param name="hash">The hash of the file</param>
        /// <returns>A read only file handle to the asset</returns>
        public FileStream GetReadFileStream(Guid id, string hash)
        {
            string path = Path.Combine(this.root, CacheFile.GetFolder(hash), CacheFile.GetFileName(id, hash));

            File.SetLastAccessTime(path, DateTime.Now);
            return(File.OpenRead(path));
        }
 /// <summary>
 /// Returns the full path of a given file
 /// </summary>
 /// <param name="root">The root folder of the cache</param>
 /// <param name="id">The Id of the file</param>
 /// <param name="hash">The hash of the file</param>
 /// <returns>The full path of the file</returns>
 public static string GetFullFilePath(string root, Guid id, string hash)
 {
     return(Path.Combine(root, CacheFile.GetFolder(hash), CacheFile.GetFileName(id, hash)));
 }