summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/EventArgs/EncodeCompletedEventArgs.cs44
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs6
-rw-r--r--win/CS/HandBrakeWPF/Services/PrePostActionService.cs27
-rw-r--r--win/CS/HandBrakeWPF/Services/Queue/QueueService.cs2
4 files changed, 18 insertions, 61 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Encode/EventArgs/EncodeCompletedEventArgs.cs b/win/CS/HandBrakeWPF/Services/Encode/EventArgs/EncodeCompletedEventArgs.cs
index 1f2fe3bb0..5c8b95b46 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/EventArgs/EncodeCompletedEventArgs.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/EventArgs/EncodeCompletedEventArgs.cs
@@ -16,65 +16,29 @@ namespace HandBrakeWPF.Services.Encode.EventArgs
/// </summary>
public class EncodeCompletedEventArgs : EventArgs
{
- /// <summary>
- /// Initializes a new instance of the <see cref="EncodeCompletedEventArgs"/> class.
- /// </summary>
- /// <param name="sucessful">
- /// The sucessful.
- /// </param>
- /// <param name="exception">
- /// The exception.
- /// </param>
- /// <param name="errorInformation">
- /// The error information.
- /// </param>
- /// <param name="filename">
- /// The filename.
- /// </param>
- /// <param name="logPath">
- /// The path and filename of the log for this encode.
- /// </param>
- /// <param name="finalSizeInBytes">
- /// The final size of the file in bytes.
- /// </param>
- public EncodeCompletedEventArgs(bool sucessful, Exception exception, string errorInformation, string filename, string logPath, long finalSizeInBytes)
+ public EncodeCompletedEventArgs(bool sucessful, Exception exception, string errorInformation, string sourceFileName, string filename, string logPath, long finalSizeInBytes)
{
this.Successful = sucessful;
this.Exception = exception;
this.ErrorInformation = errorInformation;
+ this.SourceFileName = sourceFileName;
this.FileName = filename;
this.ActivityLogPath = logPath;
this.FinalFilesizeInBytes = finalSizeInBytes;
}
- /// <summary>
- /// Gets or sets the file name.
- /// </summary>
public string FileName { get; private set; }
- /// <summary>
- /// Gets or sets a value indicating whether Successful.
- /// </summary>
public bool Successful { get; private set; }
- /// <summary>
- /// Gets or sets Exception.
- /// </summary>
public Exception Exception { get; private set; }
- /// <summary>
- /// Gets or sets ErrorInformation.
- /// </summary>
public string ErrorInformation { get; private set; }
- /// <summary>
- ///
- /// </summary>
+ public string SourceFileName { get; private set; }
+
public string ActivityLogPath { get; private set; }
- /// <summary>
- /// Final filesize in bytes
- /// </summary>
public long FinalFilesizeInBytes { get; private set; }
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
index eb24d721e..417d77855 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
@@ -130,7 +130,7 @@ namespace HandBrakeWPF.Services.Encode
this.IsEncoding = false;
this.ServiceLogMessage("Failed to start encoding ..." + Environment.NewLine + exc);
- this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", task.Source, null, 0));
+ this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", this.currentTask.Source, this.currentTask.Destination, null, 0));
}
}
@@ -256,8 +256,8 @@ namespace HandBrakeWPF.Services.Encode
// Raise the Encode Completed Event.
this.InvokeEncodeCompleted(
e.Error
- ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Destination, hbLog, filesize)
- : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Destination, hbLog, filesize));
+ ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Source, this.currentTask.Destination, hbLog, filesize)
+ : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Source, this.currentTask.Destination, hbLog, filesize));
}
private long GetFilesize(string destination)
diff --git a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs
index 636f82d7b..e8118f2a3 100644
--- a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs
+++ b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs
@@ -83,7 +83,7 @@ namespace HandBrakeWPF.Services
// Send the file to the users requested application
if (e.Successful)
{
- this.SendToApplication(e.FileName);
+ this.SendToApplication(e.SourceFileName, e.FileName);
}
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PlaySoundWhenDone))
@@ -174,28 +174,21 @@ namespace HandBrakeWPF.Services
}
}
- /// <summary>
- /// Send a file to a 3rd party application after encoding has completed.
- /// </summary>
- /// <param name="file">
- /// The file path
- /// </param>
- private void SendToApplication(string file)
+ private void SendToApplication(string source, string destination)
{
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.SendFile) &&
!string.IsNullOrEmpty(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo)))
{
- string args = string.Format(
- "{0} \"{1}\"",
- this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs),
- file);
- var destination =
- new ProcessStartInfo(
- this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo), args);
+ string arguments = this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs);
+
+ arguments = arguments.Replace("{source}", string.Format("\"{0}\"", source));
+ arguments = arguments.Replace("{destination}", string.Format("\"{0}\"", destination));
+
+ var process = new ProcessStartInfo(this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo), arguments);
- this.ServiceLogMessage(string.Format("Sending output file to: {0}, with arguments: {1} ", destination, args));
+ this.ServiceLogMessage(string.Format("Sending output file to: {0}, with arguments: {1} ", destination, arguments));
- Process.Start(destination);
+ Process.Start(process);
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs
index cf7f642c2..477aacba3 100644
--- a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs
+++ b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs
@@ -509,7 +509,7 @@ namespace HandBrakeWPF.Services.Queue
if (!Directory.Exists(Path.GetDirectoryName(job.Task.Destination)))
{
- this.EncodeServiceEncodeCompleted(null, new EncodeCompletedEventArgs(false, null, "Destination Directory Missing", null, null, 0));
+ this.EncodeServiceEncodeCompleted(null, new EncodeCompletedEventArgs(false, null, "Destination Directory Missing", null, null, null, 0));
this.BackupQueue(string.Empty);
return;
}