Emulation.DiscSystem - cleanup - use extension method, using declarations
This commit is contained in:
parent
3f9b93be59
commit
4cf29c5169
|
@ -19,11 +19,9 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
|
||||
public void WriteFile(string fname)
|
||||
{
|
||||
using (FileStream fs = new FileStream(fname, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
{
|
||||
using FileStream fs = new FileStream(fname, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||
WriteStream(fs);
|
||||
}
|
||||
}
|
||||
|
||||
public Stream BaseStream;
|
||||
|
||||
|
|
|
@ -423,10 +423,8 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
var buf2448 = new byte[2448];
|
||||
DiscSectorReader dsr = new DiscSectorReader(disc);
|
||||
|
||||
using (var imgFile = File.OpenWrite(imgPath))
|
||||
using (var subFile = File.OpenWrite(subPath))
|
||||
{
|
||||
|
||||
using var imgFile = File.OpenWrite(imgPath);
|
||||
using var subFile = File.OpenWrite(subPath);
|
||||
int nLBA = disc.Session1.LeadoutLBA;
|
||||
for (int lba = 0; lba < nLBA; lba++)
|
||||
{
|
||||
|
@ -436,8 +434,6 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SS_CCD : ISectorSynthJob2448
|
||||
{
|
||||
public void Synth(SectorSynthJob job)
|
||||
|
|
|
@ -251,8 +251,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
|||
//TODO - fix exception-throwing inside
|
||||
//TODO - verify stream-disposing semantics
|
||||
var fs = File.OpenRead(choice);
|
||||
using (var blob = new Disc.Blob_WaveFile())
|
||||
{
|
||||
using var blob = new Disc.Blob_WaveFile();
|
||||
try
|
||||
{
|
||||
blob.Load(fs);
|
||||
|
@ -263,7 +262,6 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
|||
cfi.Type = CompiledCueFileType.DecodeAudio;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (blobPathExt == ".APE") cfi.Type = CompiledCueFileType.DecodeAudio;
|
||||
else if (blobPathExt == ".MP3") cfi.Type = CompiledCueFileType.DecodeAudio;
|
||||
else if (blobPathExt == ".MPC") cfi.Type = CompiledCueFileType.DecodeAudio;
|
||||
|
|
|
@ -357,10 +357,10 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
{
|
||||
var data = ReadSectorCached(lba);
|
||||
if (data == null) return false;
|
||||
byte[] cmp = System.Text.Encoding.ASCII.GetBytes(s);
|
||||
byte[] cmp = Encoding.ASCII.GetBytes(s);
|
||||
byte[] cmp2 = new byte[cmp.Length];
|
||||
Buffer.BlockCopy(data, n, cmp2, 0, cmp.Length);
|
||||
return System.Linq.Enumerable.SequenceEqual(cmp, cmp2);
|
||||
return cmp.SequenceEqual(cmp2);
|
||||
}
|
||||
|
||||
private bool SectorContains(string s, int lba = 0)
|
||||
|
|
|
@ -23,8 +23,7 @@ namespace BizHawk.Emulation.DiscSystem.SBI
|
|||
/// <exception cref="SBIParseException">file at <see cref="IN_Path"/> does not contain valid header or contains misformatted record</exception>
|
||||
public void Run()
|
||||
{
|
||||
using (var fs = File.OpenRead(IN_Path))
|
||||
{
|
||||
using var fs = File.OpenRead(IN_Path);
|
||||
BinaryReader br = new BinaryReader(fs);
|
||||
string sig = br.ReadStringFixedAscii(4);
|
||||
if (sig != "SBI\0")
|
||||
|
@ -76,5 +75,4 @@ namespace BizHawk.Emulation.DiscSystem.SBI
|
|||
OUT_Data = ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue