예제 #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);
 }