Make DiscJob abstract

This commit is contained in:
YoshiRulz 2020-05-19 22:35:39 +10:00 committed by James Groom
parent 6f813edbdb
commit b2982825d8
6 changed files with 11 additions and 9 deletions

View File

@ -399,7 +399,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
});
}
public void Run()
public override void Run()
{
//in params
var cue = IN_CueFile;

View File

@ -163,7 +163,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
OUT_Disc.RawTOCEntries.Add(new RawTOCEntry { QData = toc_sq });
}
public void Run()
public override void Run()
{
//params
var compiled = IN_CompileJob;

View File

@ -375,10 +375,10 @@ namespace BizHawk.Emulation.DiscSystem.CUE
job.FinishLog();
} //LoadFromString
public void Run(ParseCueJob job)
public override void Run()
{
job.OUT_CueFile = new CUE_File();
job.LoadFromString(job);
OUT_CueFile = new CUE_File();
LoadFromString(this);
}
}

View File

@ -8,7 +8,7 @@ namespace BizHawk.Emulation.DiscSystem
/// Returns WARNINGS for things which will are irregular or erroneous but later jobs might be able to handle, or which can be worked around by configuration assumptions.
/// TODO - make IDisposable so I don't have to remember to Finish() it?
/// </summary>
public class DiscJob
public abstract class DiscJob
{
internal int CurrentLine = -1;
@ -51,6 +51,8 @@ namespace BizHawk.Emulation.DiscSystem
OUT_ErrorLevel |= job.OUT_ErrorLevel;
swLog.Write(job.OUT_Log);
}
public abstract void Run();
}
internal class DiscJobAbortException : Exception

View File

@ -44,7 +44,7 @@ namespace BizHawk.Emulation.DiscSystem
public bool OUT_SlowLoadAborted { get; private set; }
/// <exception cref="NotSupportedException"><see cref="IN_DiscInterface"/> is <see cref="DiscInterface.LibMirage"/></exception>
public void Run()
public override void Run()
{
switch (IN_DiscInterface)
{
@ -136,7 +136,7 @@ namespace BizHawk.Emulation.DiscSystem
cue_content ??= File.ReadAllText(cuePath);
parseJob.IN_CueString = cue_content;
bool okParse = true;
try { parseJob.Run(parseJob); }
try { parseJob.Run(); }
catch (DiscJobAbortException) { okParse = false; parseJob.FinishLog(); }
if (!string.IsNullOrEmpty(parseJob.OUT_Log)) Console.WriteLine(parseJob.OUT_Log);
ConcatenateJobLog(parseJob);

View File

@ -21,7 +21,7 @@ namespace BizHawk.Emulation.DiscSystem.SBI
public SubQPatchData OUT_Data { get; private set; }
/// <exception cref="SBIParseException">file at <see cref="IN_Path"/> does not contain valid header or contains misformatted record</exception>
public void Run()
public override void Run()
{
using var fs = File.OpenRead(IN_Path);
BinaryReader br = new BinaryReader(fs);