public async Task <LfxBlob> LoadAsync(LfxPointer pointer) { LfxBlob blob; if (TryGet(pointer.Hash, out blob)) { return(blob); } if (pointer.Type == LfxPointerType.Archive) { await LoadArchiveAsync(pointer.Url); } else if (pointer.Type == LfxPointerType.SelfExtractingArchive) { await LoadSelfExtractingArchiveAsync(pointer.Url, pointer.Args); } else if (pointer.Type == LfxPointerType.Curl) { await LoadAsync(pointer.Url); } if (!TryGet(pointer.Hash, out blob)) { throw new Exception($"Expected LfxPointer not found in downloaded content. Pointer:\n{pointer}"); } return(blob); }
public static IEnumerable <GitFile> Load( string filter = null, string dir = null, LfxFileFlags flags = LfxFileFlags.Default) { GitFileFlags gitFlags = default(GitFileFlags); if ((flags & LfxFileFlags.Tracked) != 0) { gitFlags |= GitFileFlags.Tracked; } if ((flags & LfxFileFlags.Untracked) != 0) { gitFlags |= GitFileFlags.Untracked; } var lfxFiles = GitFile.Load(filter, dir, gitFlags) .Where(o => o.IsDefined("filter", "lfx")); if ((flags & LfxFileFlags.Content) != 0) { lfxFiles = lfxFiles.Where(o => !LfxPointer.CanLoad(o.Path)); } if ((flags & LfxFileFlags.Pointer) != 0) { lfxFiles = lfxFiles.Where(o => LfxPointer.CanLoad(o.Path)); } return(lfxFiles); }
public LfxBlob Load(LfxPointer pointer) { return(LoadAsync(pointer).Result); }