summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/C#/HandBrake.ApplicationServices/Functions/Logging.cs49
-rw-r--r--win/C#/HandBrake.ApplicationServices/Functions/System.cs (renamed from win/C#/Functions/System.cs)3
-rw-r--r--win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj2
-rw-r--r--win/C#/HandBrake.ApplicationServices/Init.cs14
-rw-r--r--win/C#/HandBrake.ApplicationServices/Model/Job.cs2
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/Encode.cs20
-rw-r--r--win/C#/HandBrake.ApplicationServices/Services/Scan.cs4
-rw-r--r--win/C#/HandBrakeCS.csproj1
-rw-r--r--win/C#/Program.cs3
-rw-r--r--win/C#/frmActivityWindow.cs46
-rw-r--r--win/C#/frmOptions.cs3
11 files changed, 76 insertions, 71 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs b/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs
new file mode 100644
index 000000000..aba92dbbe
--- /dev/null
+++ b/win/C#/HandBrake.ApplicationServices/Functions/Logging.cs
@@ -0,0 +1,49 @@
+/* Logging.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Functions
+{
+ using System;
+ using System.IO;
+ using System.Text;
+ using System.Windows.Forms;
+
+ using HandBrake.ApplicationServices.Model;
+
+ /// <summary>
+ /// The System Information.
+ /// </summary>
+ public class Logging
+ {
+ /// <summary>
+ /// Add the CLI Query to the Log File.
+ /// </summary>
+ /// <param name="encJob">
+ /// The Encode Job Object
+ /// </param>
+ public static string CreateCliLogHeader(Job encJob)
+ {
+ StringBuilder logHeader = new StringBuilder();
+
+ logHeader.AppendLine(String.Format("# {0}", Init.HandBrakeGuiVersionString));
+ logHeader.AppendLine(String.Format("# Running: {0}", Environment.OSVersion));
+ logHeader.AppendLine(String.Format("# CPU: {0}", SystemInfo.GetCpuCount));
+ logHeader.AppendLine(String.Format("# Ram: {0} MB", SystemInfo.TotalPhysicalMemory));
+ logHeader.AppendLine(String.Format("# Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
+ logHeader.AppendLine(String.Format("# Temp Dir: {0}", Path.GetTempPath()));
+ logHeader.AppendLine(String.Format("# Install Dir: {0}", Application.StartupPath));
+ logHeader.AppendLine(String.Format("# Data Dir: {0}\n", Application.UserAppDataPath));
+
+ if (encJob != null)
+ {
+ logHeader.AppendLine(String.Format("# CLI Query: {0}", encJob.Query));
+ logHeader.AppendLine(String.Format("# User Query: {0}", encJob.CustomQuery));
+ }
+ logHeader.AppendLine("-------------------------------------------");
+
+ return logHeader.ToString();
+ }
+ }
+} \ No newline at end of file
diff --git a/win/C#/Functions/System.cs b/win/C#/HandBrake.ApplicationServices/Functions/System.cs
index fb830fb8d..b2ee6edfe 100644
--- a/win/C#/Functions/System.cs
+++ b/win/C#/HandBrake.ApplicationServices/Functions/System.cs
@@ -3,9 +3,10 @@
Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
-namespace Handbrake.Functions
+namespace HandBrake.ApplicationServices.Functions
{
using System.Windows.Forms;
+
using Microsoft.Win32;
/// <summary>
diff --git a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 148ba78db..bc6c04db0 100644
--- a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -78,8 +78,10 @@
<Compile Include="frmExceptionWindow.Designer.cs">
<DependentUpon>frmExceptionWindow.cs</DependentUpon>
</Compile>
+ <Compile Include="Functions\Logging.cs" />
<Compile Include="Functions\GrowlCommunicator.cs" />
<Compile Include="Functions\Main.cs" />
+ <Compile Include="Functions\System.cs" />
<Compile Include="Functions\Win32.cs" />
<Compile Include="Functions\Win7.cs" />
<Compile Include="Init.cs" />
diff --git a/win/C#/HandBrake.ApplicationServices/Init.cs b/win/C#/HandBrake.ApplicationServices/Init.cs
index 7f1e1ed72..d279a0b11 100644
--- a/win/C#/HandBrake.ApplicationServices/Init.cs
+++ b/win/C#/HandBrake.ApplicationServices/Init.cs
@@ -16,6 +16,9 @@ namespace HandBrake.ApplicationServices
/// <summary>
/// Setup the Settings used by the applicaiton with this library
/// </summary>
+ /// <param name="versionString">
+ /// The version / name of the application that's using this DLL.
+ /// </param>
/// <param name="instanceId">
/// The Instance ID
/// </param>
@@ -49,11 +52,12 @@ namespace HandBrake.ApplicationServices
/// <param name="preventSleep">
/// Prevent the system from sleeping
/// </param>
- public static void SetupSettings(int instanceId, string completionOption, bool disableDvdNav,
+ public static void SetupSettings(string versionString, int instanceId, string completionOption, bool disableDvdNav,
bool growlEncode, bool growlQueue, string processPriority, string saveLogPath, bool saveLogToSpecifiedPath,
bool saveLogWithVideo, bool showCliForInGuiEncodeStatus, bool preventSleep)
{
InstanceId = instanceId;
+ HandBrakeGuiVersionString = versionString;
Properties.Settings.Default.CompletionOption = completionOption;
Properties.Settings.Default.disableDvdNav = disableDvdNav;
Properties.Settings.Default.growlEncode = growlEncode;
@@ -79,6 +83,14 @@ namespace HandBrake.ApplicationServices
return Assembly.GetExecutingAssembly().GetName().Version;
}
+ /// <summary>
+ /// The instance ID used by the Main Applicaiton
+ /// </summary>
public static int InstanceId;
+
+ /// <summary>
+ /// The Applicaiton that uses this DLL can pass in it's version string.
+ /// </summary>
+ public static string HandBrakeGuiVersionString;
}
}
diff --git a/win/C#/HandBrake.ApplicationServices/Model/Job.cs b/win/C#/HandBrake.ApplicationServices/Model/Job.cs
index 9d4b37510..536069153 100644
--- a/win/C#/HandBrake.ApplicationServices/Model/Job.cs
+++ b/win/C#/HandBrake.ApplicationServices/Model/Job.cs
@@ -8,7 +8,7 @@ namespace HandBrake.ApplicationServices.Model
/// <summary>
/// The job.
/// </summary>
- public struct Job
+ public class Job
{
/// <summary>
/// Gets or sets the job ID.
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
index 9ef1b2c9c..c21d83722 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs
@@ -261,22 +261,6 @@ namespace HandBrake.ApplicationServices.Services
/* Helpers */
/// <summary>
- /// Add the CLI Query to the Log File.
- /// </summary>
- /// <param name="encJob">
- /// The Encode Job Object
- /// </param>
- private static string CreateCliLogHeader(Job encJob)
- {
- StringBuilder logHeader = new StringBuilder();
- logHeader.AppendLine("# CLI Query: " + encJob.Query);
- logHeader.AppendLine("# User Query: " + encJob.CustomQuery);
- logHeader.AppendLine("-------------------------------------------");
-
- return logHeader.ToString();
- }
-
- /// <summary>
/// Save a copy of the log to the users desired location or a default location
/// if this feature is enabled in options.
/// </summary>
@@ -430,8 +414,8 @@ namespace HandBrake.ApplicationServices.Services
fileWriter = new StreamWriter(logFile) { AutoFlush = true };
- fileWriter.WriteLine(CreateCliLogHeader(encodeJob));
- logBuffer.AppendLine(CreateCliLogHeader(encodeJob));
+ fileWriter.WriteLine(Logging.CreateCliLogHeader(encodeJob));
+ logBuffer.AppendLine(Logging.CreateCliLogHeader(encodeJob));
}
catch (Exception exc)
{
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Scan.cs b/win/C#/HandBrake.ApplicationServices/Services/Scan.cs
index 039cb3f3d..04c35e36f 100644
--- a/win/C#/HandBrake.ApplicationServices/Services/Scan.cs
+++ b/win/C#/HandBrake.ApplicationServices/Services/Scan.cs
@@ -191,10 +191,11 @@ namespace HandBrake.ApplicationServices.Services
// Write the Buffer out to file.
StreamWriter scanLog = new StreamWriter(dvdInfoPath);
+ scanLog.WriteLine(Logging.CreateCliLogHeader(null));
scanLog.Write(this.readData.Buffer);
scanLog.Flush();
scanLog.Close();
- logBuffer = readData.Buffer;
+ logBuffer.AppendLine(this.readData.Buffer.ToString());
IsScanning = false;
@@ -268,6 +269,7 @@ namespace HandBrake.ApplicationServices.Services
{
logFilePosition = 0;
logBuffer = new StringBuilder();
+ logBuffer.AppendLine(Logging.CreateCliLogHeader(null));
}
/// <summary>
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj
index 76042e21b..0a947594b 100644
--- a/win/C#/HandBrakeCS.csproj
+++ b/win/C#/HandBrakeCS.csproj
@@ -272,7 +272,6 @@
<Compile Include="Functions\PresetLoader.cs" />
<Compile Include="Functions\QueryGenerator.cs" />
<Compile Include="Functions\Main.cs" />
- <Compile Include="Functions\System.cs" />
<Compile Include="Functions\UpdateCheckInformation.cs" />
<Compile Include="Functions\Win32.cs" />
<Compile Include="frmActivityWindow.cs">
diff --git a/win/C#/Program.cs b/win/C#/Program.cs
index f54a775f9..1c428c874 100644
--- a/win/C#/Program.cs
+++ b/win/C#/Program.cs
@@ -91,7 +91,8 @@ namespace Handbrake
/// </summary>
private static void InitializeApplicationServices()
{
- Init.SetupSettings(InstanceId, Settings.Default.CompletionOption, Settings.Default.noDvdNav,
+ string versionId = String.Format("Windows GUI {1} {0}", Settings.Default.hb_build, Settings.Default.hb_version);
+ Init.SetupSettings(versionId, InstanceId, Settings.Default.CompletionOption, Settings.Default.noDvdNav,
Settings.Default.growlEncode, Settings.Default.growlQueue,
Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,
Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs
index d890a7834..62799e926 100644
--- a/win/C#/frmActivityWindow.cs
+++ b/win/C#/frmActivityWindow.cs
@@ -12,7 +12,6 @@ namespace Handbrake
using System.Text;
using System.Threading;
using System.Windows.Forms;
- using Functions;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -231,7 +230,6 @@ namespace Handbrake
appendText.AppendFormat("Waiting for the log to be generated ...\n");
position = 0;
ClearWindowText();
- PrintLogHeader();
return appendText;
}
@@ -247,7 +245,6 @@ namespace Handbrake
appendText.AppendFormat("Waiting for the log to be generated ...\n");
position = 0;
ClearWindowText();
- PrintLogHeader();
return appendText;
}
@@ -343,48 +340,6 @@ namespace Handbrake
}
/// <summary>
- /// Display the log header
- /// </summary>
- private void PrintLogHeader()
- {
- try
- {
- if (IsHandleCreated)
- {
- if (rtf_actLog.InvokeRequired)
- {
- IAsyncResult invoked = BeginInvoke(new SetTextClearCallback(PrintLogHeader));
- EndInvoke(invoked);
- }
- else
- {
- lock (rtf_actLog)
- {
- // Print the log header. This function will be re-implimented later. Do not delete.
- StringBuilder header = new StringBuilder();
-
- header.Append(String.Format("### Windows GUI {1} {0} \n", Properties.Settings.Default.hb_build, Properties.Settings.Default.hb_version));
- header.Append(String.Format("### Running: {0} \n###\n", Environment.OSVersion));
- header.Append(String.Format("### CPU: {0} \n", SystemInfo.GetCpuCount));
- header.Append(String.Format("### Ram: {0} MB \n", SystemInfo.TotalPhysicalMemory));
- header.Append(String.Format("### Screen: {0}x{1} \n", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
- header.Append(String.Format("### Temp Dir: {0} \n", Path.GetTempPath()));
- header.Append(String.Format("### Install Dir: {0} \n", Application.StartupPath));
- header.Append(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath));
- header.Append("#########################################\n\n");
-
- rtf_actLog.AppendText(header.ToString());
- }
- }
- }
- }
- catch (Exception)
- {
- return;
- }
- }
-
- /// <summary>
/// Reset Everything
/// </summary>
private void Reset()
@@ -393,7 +348,6 @@ namespace Handbrake
windowTimer.Dispose();
position = 0;
ClearWindowText();
- PrintLogHeader();
windowTimer = new Timer(new TimerCallback(LogMonitor), null, 1000, 1000);
}
diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs
index 7ca71dc30..4475d9071 100644
--- a/win/C#/frmOptions.cs
+++ b/win/C#/frmOptions.cs
@@ -473,7 +473,8 @@ namespace Handbrake
/// </summary>
private static void UpdateApplicationServicesSettings()
{
- Init.SetupSettings(Program.InstanceId, Settings.Default.CompletionOption, Settings.Default.noDvdNav,
+ string versionId = String.Format("Windows GUI {1} {0}", Settings.Default.hb_build, Settings.Default.hb_version);
+ Init.SetupSettings(versionId, Program.InstanceId, Settings.Default.CompletionOption, Settings.Default.noDvdNav,
Settings.Default.growlEncode, Settings.Default.growlQueue,
Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,
Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);