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

            return(fileInfo);
        }
Example #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();
     }
 }
Example #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();
            }
        }
Example #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);
        }
Example #5
0
 public bool ContainsSystemFile(IBiosFile biosFile)
 {
     return(this.GetSystemFileInfo(biosFile).Exists);
 }
Example #6
0
 public Stream GetSystemFile(IBiosFile biosFile)
 {
     return(File.OpenRead(this.GetSystemFileInfo(biosFile).FullName));
 }
Example #7
0
 public void AddSystemFile(IBiosFile biosFile, FileInfo systemFilePath)
 {
     systemFilePath.CopyTo(this.GetSystemFileInfo(biosFile).FullName, true);
 }