Save settings outside ResetSettings

This commit is contained in:
Jaex 2017-03-28 22:59:17 +03:00
parent d577112377
commit 7cea6afbd2
5 changed files with 20 additions and 21 deletions

View file

@ -64,7 +64,7 @@ public ApplicationInstanceManager(bool isSingleInstance, string[] args, EventHan
catch (AbandonedMutexException)
{
// Log the mutex was abandoned in another process, it will still get acquired
DebugHelper.WriteLine("Single instance mutex found abandoned from another process");
DebugHelper.WriteLine("Single instance mutex found abandoned from another process.");
IsFirstInstance = true;
}

View file

@ -87,7 +87,7 @@ private void btnContinue_Click(object sender, EventArgs e)
private void btnClose_Click(object sender, EventArgs e)
{
DebugHelper.WriteLine("ShareX closing. Reason: Unhandled exception");
DebugHelper.WriteLine("ShareX closing. Reason: Unhandled exception.");
Application.Exit();
}

View file

@ -572,6 +572,7 @@ private void btnResetSettings_Click(object sender, EventArgs e)
if (MessageBox.Show("Would you like to reset ShareX settings?", "ShareX", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
SettingManager.ResetSettings();
SettingManager.SaveAllSettings();
UpdateControls();

View file

@ -298,7 +298,7 @@ private void InitHotkeys()
Program.HotkeyManager.UpdateHotkeys(Program.HotkeysConfig.Hotkeys, !Program.IgnoreHotkeyWarning);
DebugHelper.WriteLine("HotkeyManager started");
DebugHelper.WriteLine("HotkeyManager started.");
if (Program.WatchFolderManager == null)
{
@ -307,7 +307,7 @@ private void InitHotkeys()
Program.WatchFolderManager.UpdateWatchFolders();
DebugHelper.WriteLine("WatchFolderManager started");
DebugHelper.WriteLine("WatchFolderManager started.");
UpdateWorkflowsMenu();
});

View file

@ -258,8 +258,6 @@ public static void ResetSettings()
{
File.Delete(GreenshotImageEditorConfigFilePath);
}
SaveAllSettings();
}
public static bool Export(string exportPath)
@ -311,21 +309,6 @@ public static bool Export(string exportPath)
return false;
}
private static void AddFileToDictionary(Dictionary<string, string> files, string filePath, string subFolder = null)
{
if (File.Exists(filePath))
{
string destinationPath = Path.GetFileName(filePath);
if (!string.IsNullOrEmpty(subFolder))
{
destinationPath = Path.Combine(subFolder, destinationPath);
}
files.Add(destinationPath, filePath);
}
}
public static bool Import(string importPath)
{
try
@ -359,5 +342,20 @@ private static void Set7ZipLibraryPath()
SevenZipBase.SetLibraryPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "7z.dll"));
}
}
private static void AddFileToDictionary(Dictionary<string, string> files, string filePath, string subFolder = null)
{
if (File.Exists(filePath))
{
string destinationPath = Path.GetFileName(filePath);
if (!string.IsNullOrEmpty(subFolder))
{
destinationPath = Path.Combine(subFolder, destinationPath);
}
files.Add(destinationPath, filePath);
}
}
}
}