static public string ReolveUrl(string Url) { // turn local urls into file urls if (ResolveFileUrl(ref Url)) { return(Url); } if (ResolveSdcardUrl(ref Url)) { return(Url); } if (ResolveStreamingAssetsUrl(ref Url)) { return(Url); } if (ResolvePersistentDataUrl(ref Url)) { return(Url); } // assuming http, clean up for WWW (which doesn't escape spaces so sends malformed HTTP1.x headers return(PopUrl.EscapeUrl(Url)); }
// returns cached url if the file is there public static string GetCachedUrl(string url) { // if url is local, no cache if (PopUrl.IsLocalUrl(url)) { return(url); } string path = urlToCachePath(url); if (!File.Exists(path)) { //Debug.LogWarning("dont have cache url:"+url); return(url); } return(PopUrl.MakeFileUrl(path)); }
public static void WriteCache(WWW www) { // skip if url in cached path var CachePrefix = PopUrl.MakeFileUrl(GetCachePath()); if (www.url.StartsWith(CachePrefix)) { return; } try { var CachePath = urlToCachePath(www.url); File.WriteAllBytes(CachePath, www.bytes); Debug.Log("Wrote " + www.url + " cache to " + CachePath); } catch (System.Exception e) { Debug.LogError("Failed to write cache (" + www.url + "); " + e.Message); } }
void Update() { if (Dirty) { ClearClouds(); LoadQueue.Clear(); foreach (var _Path in Paths) { var Path = PopUrl.ReolveUrl(_Path); if (Path.StartsWith(PopUrl.FileProtocol)) { Path = Path.Substring(PopUrl.FileProtocol.Length); } try { EnumDirectory(Path); } catch (System.Exception e) { Debug.LogWarning("failed to iterate path: " + Path + ": " + e.Message); } } Dirty = false; } if (Template == null) { Debug.LogWarning("failed to load, no template"); return; } // load next if (LoadQueue.Count > 0) { var Filename = LoadQueue [0]; LoadQueue.RemoveAt(0); LoadPointCloud(Filename); } }