mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-03 05:34:07 +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){
|
})) != null){
|
||||||
currentProcess.EnableRaisingEvents = true;
|
currentProcess.EnableRaisingEvents = true;
|
||||||
currentProcess.Exited += process_Exited;
|
currentProcess.Exited += process_Exited;
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
currentProcess.BeginOutputReadLine();
|
currentProcess.BeginOutputReadLine();
|
||||||
currentProcess.OutputDataReceived += (sender, args) => Debug.WriteLine("VideoPlayer: "+args.Data);
|
currentProcess.OutputDataReceived += process_OutputDataReceived;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPipe.DisposeToken();
|
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){
|
private void process_Exited(object sender, EventArgs e){
|
||||||
int exitCode = currentProcess.ExitCode;
|
int exitCode = currentProcess.ExitCode;
|
||||||
|
|
||||||
|
@ -23,6 +23,10 @@ public void SetupUnhandledExceptionHandler(string caption){
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool Log(string data){
|
public bool Log(string data){
|
||||||
|
#if DEBUG
|
||||||
|
Debug.WriteLine(data);
|
||||||
|
#endif
|
||||||
|
|
||||||
StringBuilder build = new StringBuilder();
|
StringBuilder build = new StringBuilder();
|
||||||
|
|
||||||
if (!File.Exists(logFile)){
|
if (!File.Exists(logFile)){
|
||||||
|
@ -102,8 +102,10 @@ private void player_PlayStateChange(int newState){
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void player_MediaError(object pMediaObject){
|
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);
|
Marshal.ReleaseComObject(pMediaObject);
|
||||||
Environment.Exit(Program.CODE_MEDIA_ERROR);
|
Environment.Exit(Program.CODE_MEDIA_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace TweetDuck.Video{
|
namespace TweetDuck.Video{
|
||||||
static class Program{
|
static class Program{
|
||||||
internal const string Version = "1.2.1.0";
|
internal const string Version = "1.2.2.0";
|
||||||
|
|
||||||
// referenced in VideoPlayer
|
// referenced in VideoPlayer
|
||||||
// set by task manager -- public const int CODE_PROCESS_KILLED = 1;
|
// set by task manager -- public const int CODE_PROCESS_KILLED = 1;
|
||||||
@ -40,7 +40,7 @@ private static int Main(string[] args){
|
|||||||
try{
|
try{
|
||||||
Application.Run(new FormPlayer(ownerHandle, defaultVolume, videoUrl, pipeToken));
|
Application.Run(new FormPlayer(ownerHandle, defaultVolume, videoUrl, pipeToken));
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Console.Out.WriteLine(e.Message);
|
Console.Out.WriteLine(e);
|
||||||
return CODE_LAUNCH_FAIL;
|
return CODE_LAUNCH_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user