public static Open ( string file, XRefArchiveMode mode ) : |
||
file | string | |
mode | XRefArchiveMode | |
return |
public async Task <bool> DownloadAsync(Uri uri, string outputFile) { if (uri == null) { throw new ArgumentNullException(nameof(uri)); } if (!uri.IsAbsoluteUri) { throw new ArgumentException("Relative path is not allowed.", nameof(uri)); } using (new LoggerPhaseScope(PhaseName)) using (new LoggerFileScope(outputFile)) { Logger.LogInfo($"Creating xref archive file..."); try { using (var xa = XRefArchive.Open(outputFile, XRefArchiveMode.Create)) { await DownloadCoreAsync(uri, xa, true); } } catch (Exception ex) { Logger.LogError($"Unable to create archive: {ex.Message}"); return(false); } Logger.LogInfo($"Xref archive file created."); return(true); } }
private static IXRefContainer ReadLocalFile(string filePath) { if (".zip".Equals(Path.GetExtension(filePath), StringComparison.OrdinalIgnoreCase)) { return(XRefArchive.Open(filePath, XRefArchiveMode.Read)); } using var sr = File.OpenText(filePath); return(YamlUtility.Deserialize <XRefMap>(sr)); }
protected static IXRefContainer DownloadFromLocal(Uri uri) { var filePath = uri.LocalPath; if (".zip".Equals(Path.GetExtension(filePath), StringComparison.OrdinalIgnoreCase)) { return(XRefArchive.Open(filePath, XRefArchiveMode.Read)); } using (var sr = File.OpenText(filePath)) { return(YamlUtility.Deserialize <XRefMap>(sr)); } }