summaryrefslogtreecommitdiffstats
path: root/win/C#/Functions/Encode.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/C#/Functions/Encode.cs')
-rw-r--r--win/C#/Functions/Encode.cs68
1 files changed, 35 insertions, 33 deletions
diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs
index 870c24a90..044fad359 100644
--- a/win/C#/Functions/Encode.cs
+++ b/win/C#/Functions/Encode.cs
@@ -41,6 +41,7 @@ namespace Handbrake.Functions
if (Properties.Settings.Default.cli_minimized == "Checked")
cliStart.WindowStyle = ProcessWindowStyle.Minimized;
hbProc = Process.Start(cliStart);
+ processID = hbProc.Id;
isEncoding = true;
currentQuery = query;
@@ -137,40 +138,36 @@ namespace Handbrake.Functions
/// <param name="destination"></param>
public void copyLog(string destination)
{
- // The user may wish to do something with the log.
- if (Properties.Settings.Default.saveLogToSpecifiedPath == "Checked")
+ try
{
- try
- {
- string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
- string tempLogFile = Path.Combine(logDir, "last_encode_log.txt");
-
- string encodeDestinationPath = Path.GetDirectoryName(destination);
- String[] destName = destination.Split('\\');
- string destinationFile = destName[destName.Length - 1];
- string encodeLogFile = DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + " " + destinationFile + ".txt";
-
- // Make sure the log directory exists.
- if (!Directory.Exists(logDir))
- Directory.CreateDirectory(logDir);
-
- // Copy the Log to HandBrakes log folder in the users applciation data folder.
- File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));
-
- // Save a copy of the log file in the same location as the enocde.
- if (Properties.Settings.Default.saveLogWithVideo == "Checked")
- File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));
-
- // Save a copy of the log file to a user specified location
- if (Directory.Exists(Properties.Settings.Default.saveLogPath))
- if (Properties.Settings.Default.saveLogPath != String.Empty && Properties.Settings.Default.saveLogToSpecifiedPath == "Checked")
- File.Copy(tempLogFile, Path.Combine(Properties.Settings.Default.saveLogPath, encodeLogFile));
- }
- catch (Exception exc)
- {
- MessageBox.Show("Something went a bit wrong trying to copy your log file.\nError Information:\n\n" + exc, "Error",
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+ string tempLogFile = Path.Combine(logDir, "last_encode_log.txt");
+
+ string encodeDestinationPath = Path.GetDirectoryName(destination);
+ String[] destName = destination.Split('\\');
+ string destinationFile = destName[destName.Length - 1];
+ string encodeLogFile = DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + " " + destinationFile + ".txt";
+
+ // Make sure the log directory exists.
+ if (!Directory.Exists(logDir))
+ Directory.CreateDirectory(logDir);
+
+ // Copy the Log to HandBrakes log folder in the users applciation data folder.
+ File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));
+
+ // Save a copy of the log file in the same location as the enocde.
+ if (Properties.Settings.Default.saveLogWithVideo == "Checked")
+ File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));
+
+ // Save a copy of the log file to a user specified location
+ if (Directory.Exists(Properties.Settings.Default.saveLogPath))
+ if (Properties.Settings.Default.saveLogPath != String.Empty && Properties.Settings.Default.saveLogToSpecifiedPath == "Checked")
+ File.Copy(tempLogFile, Path.Combine(Properties.Settings.Default.saveLogPath, encodeLogFile));
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show("Something went a bit wrong trying to copy your log file.\nError Information:\n\n" + exc, "Error",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
@@ -184,5 +181,10 @@ namespace Handbrake.Functions
/// </summary>
public String currentQuery { get; set; }
+ /// <summary>
+ /// Get the process ID of the current encode.
+ /// </summary>
+ public int processID { get; set; }
+
}
}