public static string GetOfflineDocumentation(IOProxy IOProxy, IPackageVersion version) { if (version?.isAvailableOnDisk == true && version.packageInfo != null) { try { var docsFolder = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "Documentation~"); if (!IOProxy.DirectoryExists(docsFolder)) { docsFolder = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "Documentation"); } if (IOProxy.DirectoryExists(docsFolder)) { var mdFiles = IOProxy.DirectoryGetFiles(docsFolder, "*.md", System.IO.SearchOption.TopDirectoryOnly); var docsMd = mdFiles.FirstOrDefault(d => IOProxy.GetFileName(d).ToLower() == "index.md") ?? mdFiles.FirstOrDefault(d => IOProxy.GetFileName(d).ToLower() == "tableofcontents.md") ?? mdFiles.FirstOrDefault(); if (!string.IsNullOrEmpty(docsMd)) { return(docsMd); } } } catch (System.IO.IOException) {} } return(string.Empty); }
public virtual Texture2D LoadImage(long productId, string url) { if (string.IsNullOrEmpty(url)) { return(null); } var hash = Hash128.Compute(url); try { var path = m_IOProxy.PathsCombine(m_Application.userAppDataPath, "Asset Store", "Cache", "Images", productId.ToString(), hash.ToString()); if (m_IOProxy.FileExists(path)) { var texture = new Texture2D(2, 2); if (texture.LoadImage(m_IOProxy.FileReadAllBytes(path))) { return(texture); } } } catch (System.IO.IOException e) { Debug.Log($"[Package Manager] Cannot load image: {e.Message}"); } return(null); }
public static string GetOfflineLicenses(IOProxy IOProxy, IPackageVersion version) { if (version?.isAvailableOnDisk == true && version.packageInfo != null) { try { var licenseFile = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "LICENSE.md"); return(IOProxy.FileExists(licenseFile) ? licenseFile : string.Empty); } catch (System.IO.IOException) {} } return(string.Empty); }
public static string GetOfflineChangelog(IOProxy IOProxy, IPackageVersion version) { if (version?.isAvailableOnDisk == true && version.packageInfo != null) { try { var changelogFile = IOProxy.PathsCombine(version.packageInfo.resolvedPath, "CHANGELOG.md"); return(IOProxy.FileExists(changelogFile) ? changelogFile : string.Empty); } catch (System.IO.IOException) {} } return(string.Empty); }