protected override bool DoTask(DoWorkArgs args) { string file = Installer.GetPath(); if (!File.Exists(file)) { MessageBox.Show("The file " + file + " does not exist.", "Restore Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } string backupFile = "Resources" + Path.DirectorySeparatorChar + "Backups"; if (!File.Exists(backupFile)) { MessageBox.Show("Either tModLoader has not been installed or the backups resource file is missing.", "Restore Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } ZipFile backups = ZipFile.Read(backupFile); string fetchFile = vanilla ? "Vanilla" : "tModLoader"; if (!backups.HasFile(fetchFile)) { MessageBox.Show("Missing " + file + " from Backups resources", "Installation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } File.WriteAllBytes(file, backups[fetchFile]); MessageBox.Show("Success!", "Restore", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); }
private bool HasAllFiles(Platform platform, ZipFile zip) { string[] files; if (platform == Platform.WINDOWS) { files = new string[] { "Windows.exe", "Content/MysteryItem.png" }; } else if (platform == Platform.MAC) { files = new string[] { "Mac.exe", "MP3Sharp.dll", "Content/MysteryItem.png" }; } else if (platform == Platform.LINUX) { files = new string[] { "Linux.exe", "MP3Sharp.dll", "Content/MysteryItem.png" }; } else { return(false); } foreach (string file in files) { if (!zip.HasFile(file)) { MessageBox.Show("Missing " + file + " from Install resources", "Installation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } return(true); }
private bool HasAllFiles(Platform platform, ZipFile zip) { string[] files; if (platform == Platform.WINDOWS) { files = new string[] { "Mac.exe", "FNA.dll" }; } else { files = new string[] { "Windows.exe", "Microsoft.Xna.Framework.dll", "Microsoft.Xna.Framework.Game.dll", "Microsoft.Xna.Framework.Graphics.dll", "Microsoft.Xna.Framework.Xact.dll" }; } foreach (string file in files) { if (!zip.HasFile(file)) { MessageBox.Show("Missing " + file + " from Install resources", "Installation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } return(true); }
private bool HasAllFiles(Platform platform, ZipFile zip) { string[] files; if (platform == Platform.WINDOWS) { files = new string[] { "Windows.exe", "Content/MysteryItem.png" }; } else if (platform == Platform.MAC) { files = new string[] { "Mac.exe", "MP3Sharp.dll", "Content/MysteryItem.png" }; } else if (platform == Platform.LINUX) { files = new string[] { "Linux.exe", "MP3Sharp.dll", "Content/MysteryItem.png" }; } else { return false; } foreach (string file in files) { if (!zip.HasFile(file)) { MessageBox.Show("Missing " + file + " from Install resources", "Installation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } return true; }
private bool HasAllFiles(Platform platform, ZipFile zip) { string[] files; if (platform == Platform.WINDOWS) { files = new string[] { "Mac.exe", "FNA.dll" }; } else { files = new string[] { "Windows.exe", "Microsoft.Xna.Framework.dll", "Microsoft.Xna.Framework.Game.dll", "Microsoft.Xna.Framework.Graphics.dll", "Microsoft.Xna.Framework.Xact.dll" }; } foreach (string file in files) { if (!zip.HasFile(file)) { MessageBox.Show("Missing " + file + " from Install resources", "Installation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } return true; }