Ejemplo n.º 1
0
        public static void Backup(int errorFlag)
        {
            var flag = true;

            try {
                var sourceDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
                                      "//DarkSoulsIII";
                const string targetDirectory = @"Backup";
                Replacer.Copy(sourceDirectory, targetDirectory);
                if (errorFlag.Equals(0))
                {
                    SystemSounds.Asterisk.Play();
                }
            }
            catch {
                flag = false;
                if (errorFlag.Equals(1))
                {
                    var error = new Error(false);
                    if (Directory.Exists("Backup"))
                    {
                        Directory.Delete("Backup");
                    }
                    SystemSounds.Hand.Play();
                    error.ShowDialog();
                }
            }

            try {
                var wins    = File.ReadAllText("wins.txt");
                var winsInt = int.Parse(wins);
                winsInt++;
                wins = winsInt.ToString();
                if (flag.Equals(true))
                {
                    System.IO.File.WriteAllText("wins.txt", wins);
                }
            }
            catch {
                System.IO.File.WriteAllText("wins.txt", "0");
            }
        }
Ejemplo n.º 2
0
 private static void restore_KeyDown(object sender, KeyEventArgs e)
 {
     Replacer.Restore(0);
     e.Handled = true;
 }
Ejemplo n.º 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     Replacer.Restore(1);
     button3.Focus();
 }
Ejemplo n.º 4
0
 private void backup_KeyDown(object sender, KeyEventArgs e)
 {
     Replacer.Backup(0);
     winsLabel.Text = File.ReadAllText("wins.txt");
     e.Handled      = true;
 }
Ejemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     Replacer.Backup(1);
     winsLabel.Text = File.ReadAllText("wins.txt");
     button3.Focus();
 }