mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-08-25 23:35:16 +02:00
Add verbose error logging to video player & tweak Reporter.Log
This commit is contained in:
@@ -55,11 +55,9 @@ namespace TweetDuck.Core.Other.Management{
|
|||||||
})) != 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 @@ namespace TweetDuck.Core.Other.Management{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 @@ namespace TweetDuck{
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 @@ namespace TweetDuck.Video{
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
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 @@ namespace TweetDuck.Video{
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user