Exemplo n.º 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);
        }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
0
 public IBackup Load(string file)
 {
     BinaryReader br = new BinaryReader(new FileStream(file, FileMode.Open));
     br.ReadByte();
     string name = br.ReadString();
     string desc = br.ReadString();
     Backup_Jar backup = new Backup_Jar(name, desc, file);
     return backup;
 }
Exemplo n.º 5
0
        public IBackup Load(string file)
        {
            BinaryReader br = new BinaryReader(new FileStream(file, FileMode.Open));

            br.ReadByte();
            string     name   = br.ReadString();
            string     desc   = br.ReadString();
            Backup_Jar backup = new Backup_Jar(name, desc, file);

            return(backup);
        }