From db7164860c6d50c56a0a14689ee6251011a6a994 Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 30 Oct 2008 21:15:28 +0000 Subject: WinGui: - Activity logs for individual encodes can now be saved either: + With the encoded file + or to a a directory which is configured from options. Log file format: "YYYY-MM-DD HH-MM-SS {Destination File Name}.txt" Feature is disabled by default git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1883 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Functions/Encode.cs | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'win/C#/Functions') diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs index f2fb11440..f79f45a9b 100644 --- a/win/C#/Functions/Encode.cs +++ b/win/C#/Functions/Encode.cs @@ -16,7 +16,7 @@ using System.Runtime.InteropServices; namespace Handbrake.Functions { public class Encode - { + { /// /// CLI output is based on en-US locale, /// we use this CultureInfo as IFormatProvider to *.Parse() calls @@ -106,5 +106,38 @@ namespace Handbrake.Functions break; } } + + public void copyLog(string query) + { + // The user may wish to do something with the log. + if (Properties.Settings.Default.saveLog == "Checked") + { + string logPath = Path.Combine(Path.GetTempPath(), "hb_encode_log.dat"); + Functions.QueryParser parsed = Functions.QueryParser.Parse(query); + + if (Properties.Settings.Default.saveLogWithVideo == "Checked") + { + string[] destName = parsed.Destination.Split('\\'); + string destinationFile = ""; + for (int i = 0; i < destName.Length - 1; i++) + { + destinationFile += destName[i] + "\\"; + } + + destinationFile += DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + " " + destName[destName.Length - 1] + ".txt"; + + File.Copy(logPath, destinationFile); + } + else if (Properties.Settings.Default.saveLogPath != String.Empty) + { + string[] destName = parsed.Destination.Split('\\'); + string dest = destName[destName.Length - 1]; + string filename = DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + " " + dest + ".txt"; + string useDefinedLogPath = Path.Combine(Properties.Settings.Default.saveLogPath, filename); + + File.Copy(logPath, useDefinedLogPath); + } + } + } } } -- cgit v1.2.3