Exemplo n.º 1
0
        private FileInfo GetSystemFileInfo(IBiosFile biosFile)
        {
            var fileInfo = new FileInfo(Path.Combine(this.SystemFileRoot.FullName,
                                                     $"{biosFile.Md5Hash}.{biosFile.FileName}"));

            return(fileInfo);
        }
Exemplo n.º 2
0
 public void AddSystemFile(IBiosFile biosFile, Stream systemFileStream)
 {
     using (FileStream stream = File.Create(this.GetSystemFileInfo(biosFile).FullName))
     {
         stream.Position           = 0;
         systemFileStream.Position = 0;
         systemFileStream.CopyTo(stream);
         stream.Close();
     }
 }
Exemplo n.º 3
0
        public async Task AddSystemFileAsync(IBiosFile biosFile, Stream systemFileStream)
        {
            using (FileStream stream = File.Create(this.GetSystemFileInfo(biosFile).FullName))
            {
                stream.Position           = 0;
                systemFileStream.Position = 0;
                await systemFileStream.CopyToAsync(stream);

                stream.Close();
            }
        }
Exemplo n.º 4
0
        public FileInfo GetSystemFilePath(IBiosFile biosFile)
        {
            var fileInfo = this.GetSystemFileInfo(biosFile);

            if (!fileInfo.Exists)
            {
                throw new FileNotFoundException($"BIOS File with hash {biosFile.Md5Hash} does not exist.");
            }

            return(fileInfo);
        }
Exemplo n.º 5
0
 public bool ContainsSystemFile(IBiosFile biosFile)
 {
     return(this.GetSystemFileInfo(biosFile).Exists);
 }
Exemplo n.º 6
0
 public Stream GetSystemFile(IBiosFile biosFile)
 {
     return(File.OpenRead(this.GetSystemFileInfo(biosFile).FullName));
 }
Exemplo n.º 7
0
 public void AddSystemFile(IBiosFile biosFile, FileInfo systemFilePath)
 {
     systemFilePath.CopyTo(this.GetSystemFileInfo(biosFile).FullName, true);
 }