summaryrefslogtreecommitdiffstats
path: root/win/C#/Functions/Main.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/C#/Functions/Main.cs')
-rw-r--r--win/C#/Functions/Main.cs27
1 files changed, 26 insertions, 1 deletions
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs
index 5cdbf520e..f21876764 100644
--- a/win/C#/Functions/Main.cs
+++ b/win/C#/Functions/Main.cs
@@ -205,7 +205,7 @@ namespace Handbrake.Functions
return;
Properties.Settings.Default.cliLastModified = lastModified;
-
+
Process cliProcess = new Process();
ProcessStartInfo handBrakeCLI = new ProcessStartInfo("HandBrakeCLI.exe", " -u -v0")
{
@@ -345,11 +345,36 @@ namespace Handbrake.Functions
{
if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log") && !file.Name.Contains("tmp_appReadable_log.txt"))
File.Delete(file.FullName);
+
}
}
}
/// <summary>
+ /// Clear old log files x days in the past
+ /// </summary>
+ public static void ClearOldLogs()
+ {
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+ if (Directory.Exists(logDir))
+ {
+ DirectoryInfo info = new DirectoryInfo(logDir);
+ FileInfo[] logFiles = info.GetFiles("*.txt");
+
+ foreach (FileInfo file in logFiles)
+ {
+ if (file.LastWriteTime < DateTime.Now.AddDays(-30))
+ {
+ if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log") && !file.Name.Contains("tmp_appReadable_log.txt"))
+ File.Delete(file.FullName);
+
+ }
+ }
+ }
+ }
+
+
+ /// <summary>
/// Begins checking for an update to HandBrake.
/// </summary>
/// <param name="callback">The method that will be called when the check is finished.</param>