Pārlūkot izejas kodu

Re-create the settings file if it got deleted

Daniel Chalmers 2 gadi atpakaļ
vecāks
revīzija
5a37822119
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      DesktopClock/MainWindow.xaml.cs

+ 5 - 0
DesktopClock/MainWindow.xaml.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Diagnostics;
+using System.IO;
 using System.Windows;
 using System.Windows.Input;
 using DesktopClock.Properties;
@@ -60,6 +61,10 @@ public partial class MainWindow : Window
     {
         Settings.Default.Save();
 
+        // Re-create the settings file if it got deleted.
+        if (!File.Exists(Settings.Path))
+            Settings.Default.Save();
+
         // Open settings file in notepad.
         Process.Start("notepad", Settings.Path);
     }