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

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