Merge branch 'auto-backup-cleanup'

This commit is contained in:
Jaex 2020-12-29 19:37:31 +03:00
commit 3c6212a536
7 changed files with 478 additions and 189 deletions

View file

@ -108,6 +108,14 @@ public ApplicationConfig()
#endregion Paths
#region Settings
public bool AutoCleanupBackupFiles = false;
public bool AutoCleanupLogFiles = false;
public int CleanupKeepFileCount = 10;
#endregion
#region Proxy
public ProxyInfo ProxySettings = new ProxyInfo();

106
ShareX/CleanupManager.cs Normal file
View file

@ -0,0 +1,106 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2020 ShareX Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
*/
#endregion License Information (GPL v3)
using ShareX.HelpersLib;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace ShareX
{
public static class CleanupManager
{
public static void Cleanup()
{
if (Program.Settings == null) return;
int keepFileCount = Math.Max(Program.Settings.CleanupKeepFileCount, 0);
try
{
CleanupAppTempFolder();
if (Program.Settings.AutoCleanupBackupFiles)
{
CleanupFolder(SettingManager.BackupFolder, "ApplicationConfig-*.json", keepFileCount);
CleanupFolder(SettingManager.BackupFolder, "HotkeysConfig-*.json", keepFileCount);
CleanupFolder(SettingManager.BackupFolder, "UploadersConfig-*.json", keepFileCount);
CleanupFolder(SettingManager.BackupFolder, "History-*.json", keepFileCount);
}
if (Program.Settings.AutoCleanupLogFiles)
{
CleanupFolder(Program.LogsFolder, "ShareX-Log-*.txt", keepFileCount);
}
}
catch (Exception e)
{
DebugHelper.WriteException(e);
}
}
public static void CleanupAsync()
{
Task.Run(() =>
{
Cleanup();
});
}
private static void CleanupFolder(string folderPath, string fileNamePattern, int keepFileCount)
{
DirectoryInfo directoryInfo = new DirectoryInfo(folderPath);
IEnumerable<FileInfo> files = directoryInfo.GetFiles(fileNamePattern).
OrderByDescending(f => f.LastWriteTime.Year <= 1601 ? f.CreationTime : f.LastWriteTime).Skip(keepFileCount);
foreach (FileInfo file in files)
{
file.Delete();
DebugHelper.WriteLine($"File deleted: {file.FullName}");
}
}
private static void CleanupAppTempFolder()
{
string tempFolder = Path.GetTempPath();
if (!string.IsNullOrEmpty(tempFolder))
{
string folderPath = Path.Combine(tempFolder, "ShareX");
if (Directory.Exists(folderPath))
{
Directory.Delete(folderPath, true);
DebugHelper.WriteLine($"ShareX temp folder cleaned: {folderPath}");
}
}
}
}
}

View file

@ -45,7 +45,6 @@ private void InitializeComponent()
this.btnEditQuickTaskMenu = new System.Windows.Forms.Button();
this.cbShowTray = new System.Windows.Forms.CheckBox();
this.cbTrayIconProgressEnabled = new System.Windows.Forms.CheckBox();
this.btnLanguages = new ShareX.HelpersLib.MenuButton();
this.cmsLanguages = new System.Windows.Forms.ContextMenuStrip(this.components);
this.cbRememberMainFormPosition = new System.Windows.Forms.CheckBox();
this.cbSilentRun = new System.Windows.Forms.CheckBox();
@ -54,7 +53,6 @@ private void InitializeComponent()
this.lblLanguage = new System.Windows.Forms.Label();
this.tpTheme = new System.Windows.Forms.TabPage();
this.btnThemeReset = new System.Windows.Forms.Button();
this.eiTheme = new ShareX.HelpersLib.ExportImportControl();
this.btnThemeRemove = new System.Windows.Forms.Button();
this.btnThemeAdd = new System.Windows.Forms.Button();
this.cbThemes = new System.Windows.Forms.ComboBox();
@ -110,19 +108,10 @@ private void InitializeComponent()
this.btnClipboardFormatEdit = new System.Windows.Forms.Button();
this.btnClipboardFormatRemove = new System.Windows.Forms.Button();
this.btnClipboardFormatAdd = new System.Windows.Forms.Button();
this.lvClipboardFormats = new ShareX.HelpersLib.MyListView();
this.chDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chFormat = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tpUploadRetry = new System.Windows.Forms.TabPage();
this.gbSecondaryFileUploaders = new System.Windows.Forms.GroupBox();
this.lvSecondaryFileUploaders = new ShareX.HelpersLib.MyListView();
this.chSecondaryFileUploaders = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.gbSecondaryImageUploaders = new System.Windows.Forms.GroupBox();
this.lvSecondaryImageUploaders = new ShareX.HelpersLib.MyListView();
this.chSecondaryImageUploaders = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.gbSecondaryTextUploaders = new System.Windows.Forms.GroupBox();
this.lvSecondaryTextUploaders = new ShareX.HelpersLib.MyListView();
this.chSecondaryTextUploaders = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chkUseSecondaryUploaders = new System.Windows.Forms.CheckBox();
this.cbIfUploadFailRetryOnce = new System.Windows.Forms.Label();
this.nudRetryUpload = new System.Windows.Forms.NumericUpDown();
@ -154,6 +143,21 @@ private void InitializeComponent()
this.txtProxyUsername = new System.Windows.Forms.TextBox();
this.tpAdvanced = new System.Windows.Forms.TabPage();
this.pgSettings = new System.Windows.Forms.PropertyGrid();
this.cbAutomaticallyCleanupBackupFiles = new System.Windows.Forms.CheckBox();
this.lblCleanupKeepFileCount = new System.Windows.Forms.Label();
this.nudCleanupKeepFileCount = new System.Windows.Forms.NumericUpDown();
this.cbAutomaticallyCleanupLogFiles = new System.Windows.Forms.CheckBox();
this.btnLanguages = new ShareX.HelpersLib.MenuButton();
this.eiTheme = new ShareX.HelpersLib.ExportImportControl();
this.lvClipboardFormats = new ShareX.HelpersLib.MyListView();
this.chDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chFormat = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lvSecondaryFileUploaders = new ShareX.HelpersLib.MyListView();
this.chSecondaryFileUploaders = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lvSecondaryImageUploaders = new ShareX.HelpersLib.MyListView();
this.chSecondaryImageUploaders = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lvSecondaryTextUploaders = new ShareX.HelpersLib.MyListView();
this.chSecondaryTextUploaders = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tttvMain = new ShareX.HelpersLib.TabToTreeView();
this.tcSettings.SuspendLayout();
this.tpGeneral.SuspendLayout();
@ -185,6 +189,7 @@ private void InitializeComponent()
this.tpProxy.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudProxyPort)).BeginInit();
this.tpAdvanced.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudCleanupKeepFileCount)).BeginInit();
this.SuspendLayout();
//
// tcSettings
@ -308,13 +313,6 @@ private void InitializeComponent()
this.cbTrayIconProgressEnabled.UseVisualStyleBackColor = true;
this.cbTrayIconProgressEnabled.CheckedChanged += new System.EventHandler(this.cbTrayIconProgressEnabled_CheckedChanged);
//
// btnLanguages
//
resources.ApplyResources(this.btnLanguages, "btnLanguages");
this.btnLanguages.Menu = this.cmsLanguages;
this.btnLanguages.Name = "btnLanguages";
this.btnLanguages.UseVisualStyleBackColor = true;
//
// cmsLanguages
//
this.cmsLanguages.Name = "cmsLanguages";
@ -356,12 +354,12 @@ private void InitializeComponent()
// tpTheme
//
this.tpTheme.Controls.Add(this.btnThemeReset);
this.tpTheme.Controls.Add(this.eiTheme);
this.tpTheme.Controls.Add(this.btnThemeRemove);
this.tpTheme.Controls.Add(this.btnThemeAdd);
this.tpTheme.Controls.Add(this.cbThemes);
this.tpTheme.Controls.Add(this.pgTheme);
this.tpTheme.Controls.Add(this.cbUseCustomTheme);
this.tpTheme.Controls.Add(this.eiTheme);
resources.ApplyResources(this.tpTheme, "tpTheme");
this.tpTheme.Name = "tpTheme";
this.tpTheme.UseVisualStyleBackColor = true;
@ -373,16 +371,6 @@ private void InitializeComponent()
this.btnThemeReset.UseVisualStyleBackColor = true;
this.btnThemeReset.Click += new System.EventHandler(this.BtnThemeReset_Click);
//
// eiTheme
//
this.eiTheme.DefaultFileName = null;
resources.ApplyResources(this.eiTheme, "eiTheme");
this.eiTheme.Name = "eiTheme";
this.eiTheme.ObjectType = null;
this.eiTheme.SerializationBinder = null;
this.eiTheme.ExportRequested += new ShareX.HelpersLib.ExportImportControl.ExportEventHandler(this.EiTheme_ExportRequested);
this.eiTheme.ImportRequested += new ShareX.HelpersLib.ExportImportControl.ImportEventHandler(this.EiTheme_ImportRequested);
//
// btnThemeRemove
//
resources.ApplyResources(this.btnThemeRemove, "btnThemeRemove");
@ -628,6 +616,10 @@ private void InitializeComponent()
// tpSettings
//
this.tpSettings.BackColor = System.Drawing.SystemColors.Window;
this.tpSettings.Controls.Add(this.cbAutomaticallyCleanupLogFiles);
this.tpSettings.Controls.Add(this.nudCleanupKeepFileCount);
this.tpSettings.Controls.Add(this.lblCleanupKeepFileCount);
this.tpSettings.Controls.Add(this.cbAutomaticallyCleanupBackupFiles);
this.tpSettings.Controls.Add(this.pbExportImportNote);
this.tpSettings.Controls.Add(this.cbExportHistory);
this.tpSettings.Controls.Add(this.cbExportSettings);
@ -801,28 +793,6 @@ private void InitializeComponent()
this.btnClipboardFormatAdd.UseVisualStyleBackColor = true;
this.btnClipboardFormatAdd.Click += new System.EventHandler(this.btnAddClipboardFormat_Click);
//
// lvClipboardFormats
//
resources.ApplyResources(this.lvClipboardFormats, "lvClipboardFormats");
this.lvClipboardFormats.AutoFillColumn = true;
this.lvClipboardFormats.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chDescription,
this.chFormat});
this.lvClipboardFormats.FullRowSelect = true;
this.lvClipboardFormats.HideSelection = false;
this.lvClipboardFormats.Name = "lvClipboardFormats";
this.lvClipboardFormats.UseCompatibleStateImageBehavior = false;
this.lvClipboardFormats.View = System.Windows.Forms.View.Details;
this.lvClipboardFormats.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvClipboardFormats_MouseDoubleClick);
//
// chDescription
//
resources.ApplyResources(this.chDescription, "chDescription");
//
// chFormat
//
resources.ApplyResources(this.chFormat, "chFormat");
//
// tpUploadRetry
//
this.tpUploadRetry.BackColor = System.Drawing.SystemColors.Window;
@ -842,24 +812,6 @@ private void InitializeComponent()
this.gbSecondaryFileUploaders.Name = "gbSecondaryFileUploaders";
this.gbSecondaryFileUploaders.TabStop = false;
//
// lvSecondaryFileUploaders
//
this.lvSecondaryFileUploaders.AllowDrop = true;
this.lvSecondaryFileUploaders.AllowItemDrag = true;
this.lvSecondaryFileUploaders.AutoFillColumn = true;
this.lvSecondaryFileUploaders.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lvSecondaryFileUploaders.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chSecondaryFileUploaders});
resources.ApplyResources(this.lvSecondaryFileUploaders, "lvSecondaryFileUploaders");
this.lvSecondaryFileUploaders.FullRowSelect = true;
this.lvSecondaryFileUploaders.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSecondaryFileUploaders.HideSelection = false;
this.lvSecondaryFileUploaders.MultiSelect = false;
this.lvSecondaryFileUploaders.Name = "lvSecondaryFileUploaders";
this.lvSecondaryFileUploaders.UseCompatibleStateImageBehavior = false;
this.lvSecondaryFileUploaders.View = System.Windows.Forms.View.Details;
this.lvSecondaryFileUploaders.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lvSecondaryUploaders_MouseUp);
//
// gbSecondaryImageUploaders
//
this.gbSecondaryImageUploaders.Controls.Add(this.lvSecondaryImageUploaders);
@ -867,24 +819,6 @@ private void InitializeComponent()
this.gbSecondaryImageUploaders.Name = "gbSecondaryImageUploaders";
this.gbSecondaryImageUploaders.TabStop = false;
//
// lvSecondaryImageUploaders
//
this.lvSecondaryImageUploaders.AllowDrop = true;
this.lvSecondaryImageUploaders.AllowItemDrag = true;
this.lvSecondaryImageUploaders.AutoFillColumn = true;
this.lvSecondaryImageUploaders.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lvSecondaryImageUploaders.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chSecondaryImageUploaders});
resources.ApplyResources(this.lvSecondaryImageUploaders, "lvSecondaryImageUploaders");
this.lvSecondaryImageUploaders.FullRowSelect = true;
this.lvSecondaryImageUploaders.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSecondaryImageUploaders.HideSelection = false;
this.lvSecondaryImageUploaders.MultiSelect = false;
this.lvSecondaryImageUploaders.Name = "lvSecondaryImageUploaders";
this.lvSecondaryImageUploaders.UseCompatibleStateImageBehavior = false;
this.lvSecondaryImageUploaders.View = System.Windows.Forms.View.Details;
this.lvSecondaryImageUploaders.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lvSecondaryUploaders_MouseUp);
//
// gbSecondaryTextUploaders
//
this.gbSecondaryTextUploaders.Controls.Add(this.lvSecondaryTextUploaders);
@ -892,24 +826,6 @@ private void InitializeComponent()
this.gbSecondaryTextUploaders.Name = "gbSecondaryTextUploaders";
this.gbSecondaryTextUploaders.TabStop = false;
//
// lvSecondaryTextUploaders
//
this.lvSecondaryTextUploaders.AllowDrop = true;
this.lvSecondaryTextUploaders.AllowItemDrag = true;
this.lvSecondaryTextUploaders.AutoFillColumn = true;
this.lvSecondaryTextUploaders.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lvSecondaryTextUploaders.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chSecondaryTextUploaders});
resources.ApplyResources(this.lvSecondaryTextUploaders, "lvSecondaryTextUploaders");
this.lvSecondaryTextUploaders.FullRowSelect = true;
this.lvSecondaryTextUploaders.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSecondaryTextUploaders.HideSelection = false;
this.lvSecondaryTextUploaders.MultiSelect = false;
this.lvSecondaryTextUploaders.Name = "lvSecondaryTextUploaders";
this.lvSecondaryTextUploaders.UseCompatibleStateImageBehavior = false;
this.lvSecondaryTextUploaders.View = System.Windows.Forms.View.Details;
this.lvSecondaryTextUploaders.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lvSecondaryUploaders_MouseUp);
//
// chkUseSecondaryUploaders
//
resources.ApplyResources(this.chkUseSecondaryUploaders, "chkUseSecondaryUploaders");
@ -1147,6 +1063,134 @@ private void InitializeComponent()
this.pgSettings.PropertySort = System.Windows.Forms.PropertySort.Categorized;
this.pgSettings.ToolbarVisible = false;
//
// cbAutomaticallyCleanupBackupFiles
//
resources.ApplyResources(this.cbAutomaticallyCleanupBackupFiles, "cbAutomaticallyCleanupBackupFiles");
this.cbAutomaticallyCleanupBackupFiles.Name = "cbAutomaticallyCleanupBackupFiles";
this.cbAutomaticallyCleanupBackupFiles.UseVisualStyleBackColor = true;
this.cbAutomaticallyCleanupBackupFiles.CheckedChanged += new System.EventHandler(this.cbAutomaticallyCleanupBackupFiles_CheckedChanged);
//
// lblCleanupKeepFileCount
//
resources.ApplyResources(this.lblCleanupKeepFileCount, "lblCleanupKeepFileCount");
this.lblCleanupKeepFileCount.Name = "lblCleanupKeepFileCount";
//
// nudCleanupKeepFileCount
//
resources.ApplyResources(this.nudCleanupKeepFileCount, "nudCleanupKeepFileCount");
this.nudCleanupKeepFileCount.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudCleanupKeepFileCount.Name = "nudCleanupKeepFileCount";
this.nudCleanupKeepFileCount.Value = new decimal(new int[] {
1,
0,
0,
0});
this.nudCleanupKeepFileCount.ValueChanged += new System.EventHandler(this.nudCleanupKeepFileCount_ValueChanged);
//
// cbAutomaticallyCleanupLogFiles
//
resources.ApplyResources(this.cbAutomaticallyCleanupLogFiles, "cbAutomaticallyCleanupLogFiles");
this.cbAutomaticallyCleanupLogFiles.Name = "cbAutomaticallyCleanupLogFiles";
this.cbAutomaticallyCleanupLogFiles.UseVisualStyleBackColor = true;
this.cbAutomaticallyCleanupLogFiles.CheckedChanged += new System.EventHandler(this.cbAutomaticallyCleanupLogFiles_CheckedChanged);
//
// btnLanguages
//
resources.ApplyResources(this.btnLanguages, "btnLanguages");
this.btnLanguages.Menu = this.cmsLanguages;
this.btnLanguages.Name = "btnLanguages";
this.btnLanguages.UseVisualStyleBackColor = true;
//
// eiTheme
//
this.eiTheme.DefaultFileName = null;
resources.ApplyResources(this.eiTheme, "eiTheme");
this.eiTheme.Name = "eiTheme";
this.eiTheme.ObjectType = null;
this.eiTheme.SerializationBinder = null;
this.eiTheme.ExportRequested += new ShareX.HelpersLib.ExportImportControl.ExportEventHandler(this.EiTheme_ExportRequested);
this.eiTheme.ImportRequested += new ShareX.HelpersLib.ExportImportControl.ImportEventHandler(this.EiTheme_ImportRequested);
//
// lvClipboardFormats
//
resources.ApplyResources(this.lvClipboardFormats, "lvClipboardFormats");
this.lvClipboardFormats.AutoFillColumn = true;
this.lvClipboardFormats.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chDescription,
this.chFormat});
this.lvClipboardFormats.FullRowSelect = true;
this.lvClipboardFormats.HideSelection = false;
this.lvClipboardFormats.Name = "lvClipboardFormats";
this.lvClipboardFormats.UseCompatibleStateImageBehavior = false;
this.lvClipboardFormats.View = System.Windows.Forms.View.Details;
this.lvClipboardFormats.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvClipboardFormats_MouseDoubleClick);
//
// chDescription
//
resources.ApplyResources(this.chDescription, "chDescription");
//
// chFormat
//
resources.ApplyResources(this.chFormat, "chFormat");
//
// lvSecondaryFileUploaders
//
this.lvSecondaryFileUploaders.AllowDrop = true;
this.lvSecondaryFileUploaders.AllowItemDrag = true;
this.lvSecondaryFileUploaders.AutoFillColumn = true;
this.lvSecondaryFileUploaders.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lvSecondaryFileUploaders.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chSecondaryFileUploaders});
resources.ApplyResources(this.lvSecondaryFileUploaders, "lvSecondaryFileUploaders");
this.lvSecondaryFileUploaders.FullRowSelect = true;
this.lvSecondaryFileUploaders.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSecondaryFileUploaders.HideSelection = false;
this.lvSecondaryFileUploaders.MultiSelect = false;
this.lvSecondaryFileUploaders.Name = "lvSecondaryFileUploaders";
this.lvSecondaryFileUploaders.UseCompatibleStateImageBehavior = false;
this.lvSecondaryFileUploaders.View = System.Windows.Forms.View.Details;
this.lvSecondaryFileUploaders.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lvSecondaryUploaders_MouseUp);
//
// lvSecondaryImageUploaders
//
this.lvSecondaryImageUploaders.AllowDrop = true;
this.lvSecondaryImageUploaders.AllowItemDrag = true;
this.lvSecondaryImageUploaders.AutoFillColumn = true;
this.lvSecondaryImageUploaders.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lvSecondaryImageUploaders.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chSecondaryImageUploaders});
resources.ApplyResources(this.lvSecondaryImageUploaders, "lvSecondaryImageUploaders");
this.lvSecondaryImageUploaders.FullRowSelect = true;
this.lvSecondaryImageUploaders.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSecondaryImageUploaders.HideSelection = false;
this.lvSecondaryImageUploaders.MultiSelect = false;
this.lvSecondaryImageUploaders.Name = "lvSecondaryImageUploaders";
this.lvSecondaryImageUploaders.UseCompatibleStateImageBehavior = false;
this.lvSecondaryImageUploaders.View = System.Windows.Forms.View.Details;
this.lvSecondaryImageUploaders.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lvSecondaryUploaders_MouseUp);
//
// lvSecondaryTextUploaders
//
this.lvSecondaryTextUploaders.AllowDrop = true;
this.lvSecondaryTextUploaders.AllowItemDrag = true;
this.lvSecondaryTextUploaders.AutoFillColumn = true;
this.lvSecondaryTextUploaders.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lvSecondaryTextUploaders.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chSecondaryTextUploaders});
resources.ApplyResources(this.lvSecondaryTextUploaders, "lvSecondaryTextUploaders");
this.lvSecondaryTextUploaders.FullRowSelect = true;
this.lvSecondaryTextUploaders.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSecondaryTextUploaders.HideSelection = false;
this.lvSecondaryTextUploaders.MultiSelect = false;
this.lvSecondaryTextUploaders.Name = "lvSecondaryTextUploaders";
this.lvSecondaryTextUploaders.UseCompatibleStateImageBehavior = false;
this.lvSecondaryTextUploaders.View = System.Windows.Forms.View.Details;
this.lvSecondaryTextUploaders.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lvSecondaryUploaders_MouseUp);
//
// tttvMain
//
resources.ApplyResources(this.tttvMain, "tttvMain");
@ -1154,6 +1198,7 @@ private void InitializeComponent()
this.tttvMain.LeftPanelBackColor = System.Drawing.SystemColors.Window;
this.tttvMain.MainTabControl = null;
this.tttvMain.Name = "tttvMain";
this.tttvMain.SeparatorColor = System.Drawing.SystemColors.ControlDark;
this.tttvMain.TreeViewFont = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.tttvMain.TreeViewSize = 175;
this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged);
@ -1213,6 +1258,7 @@ private void InitializeComponent()
this.tpProxy.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudProxyPort)).EndInit();
this.tpAdvanced.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.nudCleanupKeepFileCount)).EndInit();
this.ResumeLayout(false);
}
@ -1345,5 +1391,9 @@ private void InitializeComponent()
private System.Windows.Forms.CheckBox cbExportHistory;
private System.Windows.Forms.CheckBox cbExportSettings;
private System.Windows.Forms.PictureBox pbExportImportNote;
private System.Windows.Forms.CheckBox cbAutomaticallyCleanupBackupFiles;
private System.Windows.Forms.NumericUpDown nudCleanupKeepFileCount;
private System.Windows.Forms.Label lblCleanupKeepFileCount;
private System.Windows.Forms.CheckBox cbAutomaticallyCleanupLogFiles;
}
}

View file

@ -156,6 +156,11 @@ private void UpdateControls()
txtCustomScreenshotsPath.Text = Program.Settings.CustomScreenshotsPath;
txtSaveImageSubFolderPattern.Text = Program.Settings.SaveImageSubFolderPattern;
// Settings
cbAutomaticallyCleanupBackupFiles.Checked = Program.Settings.AutoCleanupBackupFiles;
cbAutomaticallyCleanupLogFiles.Checked = Program.Settings.AutoCleanupLogFiles;
nudCleanupKeepFileCount.SetValue(Program.Settings.CleanupKeepFileCount);
// Proxy
cbProxyMethod.SelectedIndex = (int)Program.Settings.ProxySettings.ProxyMethod;
txtProxyUsername.Text = Program.Settings.ProxySettings.Username;
@ -684,7 +689,7 @@ private void btnOpenScreenshotsFolder_Click(object sender, EventArgs e)
#endregion Paths
#region Export / Import
#region Settings
private void cbExportSettings_CheckedChanged(object sender, EventArgs e)
{
@ -798,7 +803,22 @@ private void btnResetSettings_Click(object sender, EventArgs e)
}
}
#endregion Export / Import
private void cbAutomaticallyCleanupBackupFiles_CheckedChanged(object sender, EventArgs e)
{
Program.Settings.AutoCleanupBackupFiles = cbAutomaticallyCleanupBackupFiles.Checked;
}
private void cbAutomaticallyCleanupLogFiles_CheckedChanged(object sender, EventArgs e)
{
Program.Settings.AutoCleanupLogFiles = cbAutomaticallyCleanupLogFiles.Checked;
}
private void nudCleanupKeepFileCount_ValueChanged(object sender, EventArgs e)
{
Program.Settings.CleanupKeepFileCount = (int)nudCleanupKeepFileCount.Value;
}
#endregion Settings
#region Proxy

View file

@ -487,7 +487,7 @@
<value>btnLanguages</value>
</data>
<data name="&gt;&gt;btnLanguages.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=13.3.1.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=13.4.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;btnLanguages.Parent" xml:space="preserve">
<value>tpGeneral</value>
@ -672,6 +672,9 @@
<data name="&gt;&gt;tpGeneral.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="btnThemeReset.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnThemeReset.Location" type="System.Drawing.Point, System.Drawing">
<value>400, 40</value>
</data>
@ -696,27 +699,6 @@
<data name="&gt;&gt;btnThemeReset.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="eiTheme.Location" type="System.Drawing.Point, System.Drawing">
<value>208, 40</value>
</data>
<data name="eiTheme.Size" type="System.Drawing.Size, System.Drawing">
<value>185, 24</value>
</data>
<data name="eiTheme.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="&gt;&gt;eiTheme.Name" xml:space="preserve">
<value>eiTheme</value>
</data>
<data name="&gt;&gt;eiTheme.Type" xml:space="preserve">
<value>ShareX.HelpersLib.ExportImportControl, ShareX.HelpersLib, Version=13.3.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;eiTheme.Parent" xml:space="preserve">
<value>tpTheme</value>
</data>
<data name="&gt;&gt;eiTheme.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="btnThemeRemove.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
@ -742,7 +724,7 @@
<value>tpTheme</value>
</data>
<data name="&gt;&gt;btnThemeRemove.ZOrder" xml:space="preserve">
<value>2</value>
<value>1</value>
</data>
<data name="btnThemeAdd.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -769,7 +751,7 @@
<value>tpTheme</value>
</data>
<data name="&gt;&gt;btnThemeAdd.ZOrder" xml:space="preserve">
<value>3</value>
<value>2</value>
</data>
<data name="cbThemes.Location" type="System.Drawing.Point, System.Drawing">
<value>208, 14</value>
@ -790,7 +772,7 @@
<value>tpTheme</value>
</data>
<data name="&gt;&gt;cbThemes.ZOrder" xml:space="preserve">
<value>4</value>
<value>3</value>
</data>
<data name="pgTheme.HelpVisible" type="System.Boolean, mscorlib">
<value>False</value>
@ -814,7 +796,7 @@
<value>tpTheme</value>
</data>
<data name="&gt;&gt;pgTheme.ZOrder" xml:space="preserve">
<value>5</value>
<value>4</value>
</data>
<data name="cbUseCustomTheme.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -844,6 +826,27 @@
<value>tpTheme</value>
</data>
<data name="&gt;&gt;cbUseCustomTheme.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="eiTheme.Location" type="System.Drawing.Point, System.Drawing">
<value>208, 40</value>
</data>
<data name="eiTheme.Size" type="System.Drawing.Size, System.Drawing">
<value>185, 24</value>
</data>
<data name="eiTheme.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="&gt;&gt;eiTheme.Name" xml:space="preserve">
<value>eiTheme</value>
</data>
<data name="&gt;&gt;eiTheme.Type" xml:space="preserve">
<value>ShareX.HelpersLib.ExportImportControl, ShareX.HelpersLib, Version=13.4.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;eiTheme.Parent" xml:space="preserve">
<value>tpTheme</value>
</data>
<data name="&gt;&gt;eiTheme.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="tpTheme.Location" type="System.Drawing.Point, System.Drawing">
@ -853,7 +856,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpTheme.Size" type="System.Drawing.Size, System.Drawing">
<value>550, 370</value>
<value>556, 376</value>
</data>
<data name="tpTheme.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
@ -1237,7 +1240,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpIntegration.Size" type="System.Drawing.Size, System.Drawing">
<value>550, 370</value>
<value>556, 376</value>
</data>
<data name="tpIntegration.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
@ -1612,7 +1615,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpPaths.Size" type="System.Drawing.Size, System.Drawing">
<value>550, 370</value>
<value>556, 376</value>
</data>
<data name="tpPaths.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@ -1632,6 +1635,123 @@
<data name="&gt;&gt;tpPaths.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="cbAutomaticallyCleanupLogFiles.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbAutomaticallyCleanupLogFiles.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="cbAutomaticallyCleanupLogFiles.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 240</value>
</data>
<data name="cbAutomaticallyCleanupLogFiles.Size" type="System.Drawing.Size, System.Drawing">
<value>184, 17</value>
</data>
<data name="cbAutomaticallyCleanupLogFiles.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="cbAutomaticallyCleanupLogFiles.Text" xml:space="preserve">
<value>Automatically cleanup old log files</value>
</data>
<data name="&gt;&gt;cbAutomaticallyCleanupLogFiles.Name" xml:space="preserve">
<value>cbAutomaticallyCleanupLogFiles</value>
</data>
<data name="&gt;&gt;cbAutomaticallyCleanupLogFiles.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cbAutomaticallyCleanupLogFiles.Parent" xml:space="preserve">
<value>tpSettings</value>
</data>
<data name="&gt;&gt;cbAutomaticallyCleanupLogFiles.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="nudCleanupKeepFileCount.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 280</value>
</data>
<data name="nudCleanupKeepFileCount.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 20</value>
</data>
<data name="nudCleanupKeepFileCount.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="nudCleanupKeepFileCount.TextAlign" type="System.Windows.Forms.HorizontalAlignment, System.Windows.Forms">
<value>Center</value>
</data>
<data name="&gt;&gt;nudCleanupKeepFileCount.Name" xml:space="preserve">
<value>nudCleanupKeepFileCount</value>
</data>
<data name="&gt;&gt;nudCleanupKeepFileCount.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;nudCleanupKeepFileCount.Parent" xml:space="preserve">
<value>tpSettings</value>
</data>
<data name="&gt;&gt;nudCleanupKeepFileCount.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="lblCleanupKeepFileCount.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblCleanupKeepFileCount.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblCleanupKeepFileCount.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 264</value>
</data>
<data name="lblCleanupKeepFileCount.Size" type="System.Drawing.Size, System.Drawing">
<value>119, 13</value>
</data>
<data name="lblCleanupKeepFileCount.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="lblCleanupKeepFileCount.Text" xml:space="preserve">
<value>Number of files to keep:</value>
</data>
<data name="&gt;&gt;lblCleanupKeepFileCount.Name" xml:space="preserve">
<value>lblCleanupKeepFileCount</value>
</data>
<data name="&gt;&gt;lblCleanupKeepFileCount.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblCleanupKeepFileCount.Parent" xml:space="preserve">
<value>tpSettings</value>
</data>
<data name="&gt;&gt;lblCleanupKeepFileCount.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="cbAutomaticallyCleanupBackupFiles.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbAutomaticallyCleanupBackupFiles.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="cbAutomaticallyCleanupBackupFiles.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 216</value>
</data>
<data name="cbAutomaticallyCleanupBackupFiles.Size" type="System.Drawing.Size, System.Drawing">
<value>206, 17</value>
</data>
<data name="cbAutomaticallyCleanupBackupFiles.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="cbAutomaticallyCleanupBackupFiles.Text" xml:space="preserve">
<value>Automatically cleanup old backup files</value>
</data>
<data name="&gt;&gt;cbAutomaticallyCleanupBackupFiles.Name" xml:space="preserve">
<value>cbAutomaticallyCleanupBackupFiles</value>
</data>
<data name="&gt;&gt;cbAutomaticallyCleanupBackupFiles.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cbAutomaticallyCleanupBackupFiles.Parent" xml:space="preserve">
<value>tpSettings</value>
</data>
<data name="&gt;&gt;cbAutomaticallyCleanupBackupFiles.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="pbExportImportNote.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pbExportImportNote.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 16</value>
</data>
@ -1654,11 +1774,14 @@
<value>tpSettings</value>
</data>
<data name="&gt;&gt;pbExportImportNote.ZOrder" xml:space="preserve">
<value>0</value>
<value>4</value>
</data>
<data name="cbExportHistory.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbExportHistory.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="cbExportHistory.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 88</value>
</data>
@ -1681,11 +1804,14 @@
<value>tpSettings</value>
</data>
<data name="&gt;&gt;cbExportHistory.ZOrder" xml:space="preserve">
<value>1</value>
<value>5</value>
</data>
<data name="cbExportSettings.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbExportSettings.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="cbExportSettings.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 64</value>
</data>
@ -1708,7 +1834,10 @@
<value>tpSettings</value>
</data>
<data name="&gt;&gt;cbExportSettings.ZOrder" xml:space="preserve">
<value>2</value>
<value>6</value>
</data>
<data name="lblExportImportNote.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblExportImportNote.Location" type="System.Drawing.Point, System.Drawing">
<value>56, 16</value>
@ -1735,7 +1864,7 @@
<value>tpSettings</value>
</data>
<data name="&gt;&gt;lblExportImportNote.ZOrder" xml:space="preserve">
<value>3</value>
<value>7</value>
</data>
<data name="btnResetSettings.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -1762,7 +1891,7 @@
<value>tpSettings</value>
</data>
<data name="&gt;&gt;btnResetSettings.ZOrder" xml:space="preserve">
<value>4</value>
<value>8</value>
</data>
<data name="pbExportImport.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -1789,7 +1918,7 @@
<value>tpSettings</value>
</data>
<data name="&gt;&gt;pbExportImport.ZOrder" xml:space="preserve">
<value>5</value>
<value>9</value>
</data>
<data name="btnExport.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -1816,7 +1945,7 @@
<value>tpSettings</value>
</data>
<data name="&gt;&gt;btnExport.ZOrder" xml:space="preserve">
<value>6</value>
<value>10</value>
</data>
<data name="btnImport.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -1843,7 +1972,7 @@
<value>tpSettings</value>
</data>
<data name="&gt;&gt;btnImport.ZOrder" xml:space="preserve">
<value>7</value>
<value>11</value>
</data>
<data name="tpSettings.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 22</value>
@ -1852,7 +1981,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpSettings.Size" type="System.Drawing.Size, System.Drawing">
<value>550, 370</value>
<value>556, 376</value>
</data>
<data name="tpSettings.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
@ -2014,7 +2143,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpPerformance.Size" type="System.Drawing.Size, System.Drawing">
<value>536, 338</value>
<value>542, 344</value>
</data>
<data name="tpPerformance.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -2143,7 +2272,7 @@
<value>lvClipboardFormats</value>
</data>
<data name="&gt;&gt;lvClipboardFormats.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.3.1.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.4.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvClipboardFormats.Parent" xml:space="preserve">
<value>gbClipboardFormats</value>
@ -2182,7 +2311,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpUploadResults.Size" type="System.Drawing.Size, System.Drawing">
<value>536, 338</value>
<value>542, 344</value>
</data>
<data name="tpUploadResults.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
@ -2218,7 +2347,7 @@
<value>lvSecondaryFileUploaders</value>
</data>
<data name="&gt;&gt;lvSecondaryFileUploaders.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.3.1.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.4.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvSecondaryFileUploaders.Parent" xml:space="preserve">
<value>gbSecondaryFileUploaders</value>
@ -2269,7 +2398,7 @@
<value>lvSecondaryImageUploaders</value>
</data>
<data name="&gt;&gt;lvSecondaryImageUploaders.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.3.1.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.4.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvSecondaryImageUploaders.Parent" xml:space="preserve">
<value>gbSecondaryImageUploaders</value>
@ -2320,7 +2449,7 @@
<value>lvSecondaryTextUploaders</value>
</data>
<data name="&gt;&gt;lvSecondaryTextUploaders.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.3.1.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=13.4.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvSecondaryTextUploaders.Parent" xml:space="preserve">
<value>gbSecondaryTextUploaders</value>
@ -2446,7 +2575,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpUploadRetry.Size" type="System.Drawing.Size, System.Drawing">
<value>536, 338</value>
<value>542, 344</value>
</data>
<data name="tpUploadRetry.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@ -2473,7 +2602,7 @@
<value>3, 3</value>
</data>
<data name="tcUpload.Size" type="System.Drawing.Size, System.Drawing">
<value>544, 364</value>
<value>550, 370</value>
</data>
<data name="tcUpload.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -2497,7 +2626,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpUpload.Size" type="System.Drawing.Size, System.Drawing">
<value>550, 370</value>
<value>556, 376</value>
</data>
<data name="tpUpload.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
@ -2806,7 +2935,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpHistory.Size" type="System.Drawing.Size, System.Drawing">
<value>550, 370</value>
<value>556, 376</value>
</data>
<data name="tpHistory.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
@ -2920,7 +3049,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpPrint.Size" type="System.Drawing.Size, System.Drawing">
<value>550, 370</value>
<value>556, 376</value>
</data>
<data name="tpPrint.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
@ -3205,7 +3334,7 @@
<value>5, 5, 5, 5</value>
</data>
<data name="tpProxy.Size" type="System.Drawing.Size, System.Drawing">
<value>550, 370</value>
<value>556, 376</value>
</data>
<data name="tpProxy.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
@ -3232,7 +3361,7 @@
<value>3, 3</value>
</data>
<data name="pgSettings.Size" type="System.Drawing.Size, System.Drawing">
<value>544, 364</value>
<value>550, 370</value>
</data>
<data name="pgSettings.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -3256,7 +3385,7 @@
<value>3, 3, 3, 3</value>
</data>
<data name="tpAdvanced.Size" type="System.Drawing.Size, System.Drawing">
<value>550, 370</value>
<value>556, 376</value>
</data>
<data name="tpAdvanced.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
@ -3319,7 +3448,7 @@
<value>tttvMain</value>
</data>
<data name="&gt;&gt;tttvMain.Type" xml:space="preserve">
<value>ShareX.HelpersLib.TabToTreeView, ShareX.HelpersLib, Version=13.3.1.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.TabToTreeView, ShareX.HelpersLib, Version=13.4.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;tttvMain.Parent" xml:space="preserve">
<value>$this</value>
@ -3336,6 +3465,9 @@
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>737, 402</value>
</data>
<data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>640, 440</value>
</data>

View file

@ -32,7 +32,6 @@ You should have received a copy of the GNU General Public License
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
#if WindowsStore
@ -328,13 +327,13 @@ private static void Run()
RegisterExtensions();
CheckPuushMode();
DebugWriteFlags();
CleanTempFiles();
SettingManager.LoadInitialSettings();
Uploader.UpdateServicePointManager();
UpdateManager = new GitHubUpdateManager("ShareX", "ShareX", Dev, Portable);
LanguageHelper.ChangeLanguage(Settings.Language);
CleanupManager.CleanupAsync();
Helpers.TryFixHandCursor();
DebugHelper.WriteLine("MainForm init started.");
@ -665,32 +664,5 @@ private static void DebugWriteFlags()
DebugHelper.WriteLine("Flags: " + output);
}
}
private static void CleanTempFiles()
{
Task.Run(() =>
{
try
{
string tempFolder = Path.GetTempPath();
if (!string.IsNullOrEmpty(tempFolder))
{
string folderPath = Path.Combine(tempFolder, "ShareX");
if (Directory.Exists(folderPath))
{
Directory.Delete(folderPath, true);
DebugHelper.WriteLine($"Temp files cleaned: {folderPath}");
}
}
}
catch (Exception e)
{
DebugHelper.WriteException(e);
}
});
}
}
}

View file

@ -150,6 +150,7 @@
<Compile Include="CaptureHelpers\CaptureRegion.cs" />
<Compile Include="CaptureHelpers\CaptureWindow.cs" />
<Compile Include="ChromeManifest.cs" />
<Compile Include="CleanupManager.cs" />
<Compile Include="Controls\BeforeUploadControl.cs">
<SubType>UserControl</SubType>
</Compile>