mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
More graceful handling of Ctrl-C by FLACCL
This commit is contained in:
@@ -73,7 +73,7 @@ namespace CUETools.FLACCL.cmd
|
||||
TextWriter stdout = Console.Out;
|
||||
Console.SetOut(Console.Error);
|
||||
|
||||
var settings = new FLACCLWriterSettings();
|
||||
var settings = new FLACCLWriterSettings() { AllowNonSubset = true };
|
||||
TimeSpan lastPrint = TimeSpan.FromMilliseconds(0);
|
||||
bool debug = false, quiet = false;
|
||||
string stereo_method = null;
|
||||
@@ -305,6 +305,16 @@ namespace CUETools.FLACCL.cmd
|
||||
Console.WriteLine("File Info : {0}kHz; {1} channel; {2} bit; {3}", audioSource.PCM.SampleRate, audioSource.PCM.ChannelCount, audioSource.PCM.BitsPerSample, TimeSpan.FromSeconds(audioSource.Length * 1.0 / audioSource.PCM.SampleRate));
|
||||
}
|
||||
|
||||
bool keepRunning = true;
|
||||
Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
|
||||
{
|
||||
keepRunning = false;
|
||||
if (e.SpecialKey == ConsoleSpecialKey.ControlC)
|
||||
e.Cancel = true;
|
||||
else
|
||||
audioDest.Delete();
|
||||
};
|
||||
|
||||
DateTime start = DateTime.Now;
|
||||
try
|
||||
{
|
||||
@@ -327,6 +337,8 @@ namespace CUETools.FLACCL.cmd
|
||||
lastPrint = elapsed;
|
||||
}
|
||||
}
|
||||
if (!keepRunning)
|
||||
throw new Exception("Aborted");
|
||||
}
|
||||
audioDest.Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user