mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-24 06:15:48 +02:00
Add verbose error logging to video player & tweak Reporter.Log
This commit is contained in:
parent
676df44985
commit
c4b2b3ab25
@ -55,11 +55,9 @@ public void Launch(string url, string username){
|
||||
})) != null){
|
||||
currentProcess.EnableRaisingEvents = true;
|
||||
currentProcess.Exited += process_Exited;
|
||||
|
||||
#if DEBUG
|
||||
|
||||
currentProcess.BeginOutputReadLine();
|
||||
currentProcess.OutputDataReceived += (sender, args) => Debug.WriteLine("VideoPlayer: "+args.Data);
|
||||
#endif
|
||||
currentProcess.OutputDataReceived += process_OutputDataReceived;
|
||||
}
|
||||
|
||||
currentPipe.DisposeToken();
|
||||
@ -146,6 +144,12 @@ private void owner_FormClosing(object sender, FormClosingEventArgs e){
|
||||
}
|
||||
}
|
||||
|
||||
private void process_OutputDataReceived(object sender, DataReceivedEventArgs e){
|
||||
if (!string.IsNullOrEmpty(e.Data)){
|
||||
Program.Reporter.Log("[VideoPlayer] "+e.Data);
|
||||
}
|
||||
}
|
||||
|
||||
private void process_Exited(object sender, EventArgs e){
|
||||
int exitCode = currentProcess.ExitCode;
|
||||
|
||||
|
@ -23,6 +23,10 @@ public void SetupUnhandledExceptionHandler(string caption){
|
||||
}
|
||||
|
||||
public bool Log(string data){
|
||||
#if DEBUG
|
||||
Debug.WriteLine(data);
|
||||
#endif
|
||||
|
||||
StringBuilder build = new StringBuilder();
|
||||
|
||||
if (!File.Exists(logFile)){
|
||||
|
@ -102,8 +102,10 @@ private void player_PlayStateChange(int newState){
|
||||
}
|
||||
|
||||
private void player_MediaError(object pMediaObject){
|
||||
Console.Out.WriteLine(((IWMPMedia2)pMediaObject).Error.errorDescription);
|
||||
IWMPErrorItem error = ((IWMPMedia2)pMediaObject).Error;
|
||||
Console.Out.WriteLine($"Media Error {error.errorCode}: {error.errorDescription}");
|
||||
|
||||
Marshal.ReleaseComObject(error);
|
||||
Marshal.ReleaseComObject(pMediaObject);
|
||||
Environment.Exit(Program.CODE_MEDIA_ERROR);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
namespace TweetDuck.Video{
|
||||
static class Program{
|
||||
internal const string Version = "1.2.1.0";
|
||||
internal const string Version = "1.2.2.0";
|
||||
|
||||
// referenced in VideoPlayer
|
||||
// set by task manager -- public const int CODE_PROCESS_KILLED = 1;
|
||||
@ -40,7 +40,7 @@ private static int Main(string[] args){
|
||||
try{
|
||||
Application.Run(new FormPlayer(ownerHandle, defaultVolume, videoUrl, pipeToken));
|
||||
}catch(Exception e){
|
||||
Console.Out.WriteLine(e.Message);
|
||||
Console.Out.WriteLine(e);
|
||||
return CODE_LAUNCH_FAIL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user