Exemplo n.º 1
0
        public RepositorySession Start()
        {
            Metainfo       metainfo;
            RepositoryData data = new RepositoryData(20000);

            using (FileSandbox temp = new FileSandbox(new EmptyFileLocator()))
            {
                MetainfoBuilder builder = new MetainfoBuilder(temp.Directory);
                string          path    = temp.CreateFile("debian-8.5.0-amd64-CD-1.iso");

                File.WriteAllBytes(path, data.ToBytes());
                builder.AddFile(path);

                metainfo = builder.ToMetainfo();
            }

            FileSandbox sandbox     = new FileSandbox(new EmptyFileLocator());
            string      destination = Path.Combine(sandbox.Directory, metainfo.Hash.ToString());

            RepositoryService service =
                new RepositoryBuilder()
                .WithHash(metainfo.Hash)
                .WithDestination(destination)
                .WithFiles(files)
                .WithPipeline(pipeline)
                .WithMemory(new RepositoryMemoryImplementation())
                .Build();

            return(new RepositorySession(metainfo, service, sandbox, data));
        }
Exemplo n.º 2
0
 public RepositorySession(Metainfo metainfo, RepositoryService service, IFileSandbox sandbox, RepositoryData data)
 {
     this.metainfo = metainfo;
     this.service  = service;
     this.sandbox  = sandbox;
     this.data     = data;
 }