public async Task <string> DownloadModelToLocalStorageAsync() { var worked = false; var mainFilePath = string.Empty; #if ENABLE_WINMD_SUPPORT // Grab the list of Uris/Files that make up the remote model. Note that there // is an assumption that the first file here will be the actual GLB/GLTF file // otherwise the code below which sets mainFilePath will not work. var remoteUrisForModel = await DownloadRemoteUriListForModelAsync(); if (remoteUrisForModel.Count > 0) { worked = true; // Add into that the URI for the anchor file so that we download this too var remoteAnchorFileUri = FileStorageManager.GetAnchorFileRelativeUri( this.modelIdentifier); remoteUrisForModel.Add(remoteAnchorFileUri); // Iterate through and download each one of those files if we need to. for (int i = 0; ((i < remoteUrisForModel.Count) && worked); i++) { // Recurse down & make sure we have a file in the right folder to store // this locally. var localFile = await FileStorageManager.GetStorageFileForRelativeUriAsync( remoteUrisForModel[i]); // Store off the first local file path as we assume that will be the .GLB or // GLTF file. if (i == 0) { mainFilePath = localFile.Path; } // We want the size of that file. var properties = await localFile.GetBasicPropertiesAsync(); // If the file was already there with > 0 size then we will not overwrite it. // (as a cheap form of caching) if (properties.Size == 0) { // Go grab the file from the remote HoloLens web server and store // the bits locally. worked = await DownloadToStorageFileAsync(remoteUrisForModel[i], localFile); } } } #endif // ENABLE_WINMD_SUPPORT return(worked ? mainFilePath : string.Empty); }