Exemplo n.º 1
0
        public GitPack(GetObjectFromRepositoryDelegate getObjectFromRepositoryDelegate, Lazy <FileStream> indexStream, Func <FileStream> packStream, GitPackCache?cache = null)
        {
            this.GetObjectFromRepository = getObjectFromRepositoryDelegate ?? throw new ArgumentNullException(nameof(getObjectFromRepositoryDelegate));
            this.indexReader             = new Lazy <GitPackIndexReader>(this.OpenIndex);
            this.packStream  = packStream ?? throw new ArgumentException(nameof(packStream));
            this.indexStream = indexStream ?? throw new ArgumentNullException(nameof(indexStream));
            this.cache       = cache ?? new GitPackMemoryCache();

            this.packFile = MemoryMappedFile.CreateFromFile(this.packStream(), mapName: null, 0, MemoryMappedFileAccess.Read, HandleInheritability.None, leaveOpen: false);
            this.accessor = this.packFile.CreateViewAccessor(0, 0, MemoryMappedFileAccess.Read);
        }
Exemplo n.º 2
0
 public GitPack(GetObjectFromRepositoryDelegate getObjectFromRepositoryDelegate, string indexPath, string packPath, GitPackCache?cache = null)
     : this(getObjectFromRepositoryDelegate, new Lazy <FileStream>(() => File.OpenRead(indexPath)), () => File.OpenRead(packPath), cache)
 {
 }