예제 #1
0
        // Given a hash for an SOG, return a handle for the SOG entry.
        // If there is no SOG info in the database, return 'null'.
        public async Task <LHandle> GetHandle(BHash pHash)
        {
            LHandle ret      = null;
            string  filename = PersistRules.GetFilename(PersistRules.AssetType.Scene,
                                                        _scene.RegionInfo.RegionName, pHash.ToString(), _context.parms);

            filename = Path.GetFileNameWithoutExtension(filename);
            string dir = PersistRules.StorageDirectory(pHash.ToString(), _context.parms);

            // Heavy handed async stuff but the checks for existance could take a while
            //     if the storage system is remote.
            if (await Task.Run(() => {
                return(Directory.Exists(dir) &&
                       (File.Exists(Path.Combine(dir, pHash + ".gltf")) ||
                        File.Exists(Path.Combine(dir, pHash + ".glb"))));
            }))
            {
                ret = new LHandle(pHash, dir);
            }
            return(ret);
        }
예제 #2
0
 // Given a filename, return the URI that would reference that file in the asset system
 private string CreateFileURI(string pFilename, IParameters pParams)
 {
     return(PersistRules.ReferenceURL(pParams.P <string>("URIBase"), pFilename));
 }