private void btnMigrate_Click(object sender, EventArgs e)
{
setEnabled(false);
ModDictionary mods;
Configuration.loadMods(out mods);
txtMigrate.Clear();
if (!Directory.Exists(txtBrowseMigrate.Text + @"\AA2_PLAY\"))
{
updateLog("ERROR: " + txtBrowseMigrate.Text + @"\AA2_PLAY\ not found!");
setEnabled(true);
return;
}
updateLog("Starting migration..");
List<string> smods = new List<string>(Directory.GetFiles(txtBrowseMigrate.Text + @"\AA2_PLAY\mods\"));
List<string> backups = new List<string>(Directory.GetFiles(txtBrowseMigrate.Text + @"\AA2_PLAY\backups\"));
int i = 0;
foreach (string m in smods)
{
i++;
string r = m.Remove(0, m.LastIndexOf('\\') + 1);
updateLog("(" + i.ToString() + "/" + smods.Count.ToString() + ") Processing " + r);
File.Copy(m, Paths.MODS + "\\" + r, true);
bool ins = File.Exists(txtBrowseMigrate.Text + @"\AA2_PLAY\backups\" + r);
updateLog("Installed status: " + ins.ToString());
if (ins)
File.Copy(txtBrowseMigrate.Text + @"\AA2_PLAY\backups\" + r, Paths.BACKUP + "\\" + r.Replace(".zip", ".7z"), true);
Mod mm = _7z.Index(Paths.MODS + "\\" + r);
mods[Paths.MODS + "\\" + r] = mm;
}
Configuration.saveMods(mods);
//setEnabled(true);
updateLog("Done!");
refreshModList();
}
#endregion