示例#1
0
 public IBackup CreateBackup()
 {
     CreateBackup cb = new CreateBackup("Create new JarBackup", "Name:","Description:","File:","","",Data.minecraftbin,false);
     if (cb.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         if (File.Exists(cb.path))
         {
             if (cb.name != "")
             {
                 Backup_Jar backup = new Backup_Jar(cb.name, cb.description, cb.path);
                 return backup;
             }
             else
             {
                 ErrorReporter.Error("You have to enter a name for the backup!");
                 return null;
             }
         }
         else
         {
             ErrorReporter.Error("Invalid file!");
             return null;
         }
     }
     return null;
 }
示例#2
0
 public IBackup CreateBackup()
 {
     CreateBackup cb = new CreateBackup("Create new JarBackup", "Name:", "Description:", "File:", "", "", Data.minecraftbin + "minecraft.jar", false);
     if (cb.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         if (File.Exists(cb.path))
         {
             if (cb.name != "")
             {
                 Backup_Jar backup = new Backup_Jar(cb.name, cb.description, Data.backupdir + cb.name + ".backup");
                 BinaryWriter bw = new BinaryWriter(new FileStream(backup.GetFilePath(), FileMode.OpenOrCreate));
                 bw.Write(signature);
                 bw.Write(backup.GetName());
                 bw.Write(backup.GetDescription());
                 byte[] jardata = File.ReadAllBytes(Data.minecraftbin + "minecraft.jar");
                 bw.Write(jardata.Length);
                 bw.Write(jardata);
                 bw.Close();
                 return backup;
             }
             else
             {
                 ErrorReporter.Error("You have to enter a name for the backup!");
                 return null;
             }
         }
         else
         {
             ErrorReporter.Error("Invalid file!");
             return null;
         }
     }
     return null;
 }