Crash fix when the watermark file is deleted.

This commit is contained in:
MaikyM 2019-07-16 15:12:39 -06:00
parent c103b461e8
commit d7a7c117e4
5 changed files with 36 additions and 1 deletions

View File

@ -24,7 +24,7 @@ namespace FModel.Forms
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://github.com/iAmAsval/FModel#how-to-use");
System.Diagnostics.Process.Start("https://github.com/iAmAsval/FModel/blob/master/README.md#how-to-use");
}
}
}

View File

@ -14,6 +14,9 @@ namespace FModel.Forms
public Settings()
{
// Check if watermark exists
Utilities.CheckWatermark();
InitializeComponent();
textBox2.Text = Properties.Settings.Default.PAKsPath;
@ -36,6 +39,9 @@ namespace FModel.Forms
checkBoxSaveAsMergeImages.Checked = Properties.Settings.Default.mergerImagesSaveAs;
imgsPerRow.Value = Properties.Settings.Default.mergerImagesRow;
// Check if watermark exists
Utilities.CheckWatermark();
//WATERMARK
button1.Enabled = Properties.Settings.Default.isWatermark;
checkBox7.Checked = Properties.Settings.Default.isWatermark;

View File

@ -10,6 +10,9 @@ namespace FModel.Forms
{
public UpdateModeSettings()
{
// Check if watermark exists
Utilities.CheckWatermark();
InitializeComponent();
//ICON CREATION

View File

@ -36,6 +36,9 @@ namespace FModel
public MainWindow()
{
// Check if watermark exists
Utilities.CheckWatermark();
InitializeComponent();
App.MainFormToUse = this;
@ -551,6 +554,9 @@ namespace FModel
}
private void UpdateModeExtractSave()
{
// Check if watermark exists
Utilities.CheckWatermark();
CreatePakList(null, false, true, true);
Invoke(new Action(() =>
@ -1331,6 +1337,9 @@ namespace FModel
private void ExtractProcess()
{
// Check if watermark exists
Utilities.CheckWatermark();
scintilla1.Text = "";
pictureBox1.Image = null;
ExtractButton.Enabled = false;

View File

@ -186,5 +186,22 @@ namespace FModel
}
}
}
public static void CheckWatermark()
{
if (!string.IsNullOrEmpty(Properties.Settings.Default.wFilename) &&
!File.Exists(Properties.Settings.Default.wFilename))
{
Properties.Settings.Default.wFilename = string.Empty;
Properties.Settings.Default.isWatermark = false;
}
if (!string.IsNullOrEmpty(Properties.Settings.Default.UMFilename) &&
!File.Exists(Properties.Settings.Default.UMFilename))
{
Properties.Settings.Default.UMFilename = string.Empty;
Properties.Settings.Default.UMWatermark = false;
}
}
}
}