private void openDatFileToolStripMenuItem_Click(object sender, EventArgs e) { // Show OpenDialog box if (openFileDialog_Dat.ShowDialog() == DialogResult.OK) { this.UseWaitCursor = true; Application.UseWaitCursor = true; Application.DoEvents(); // hack to force the cursor update. Cleaner than DoEvents if (textBoxStatus.Lines.Length > 0) { AddStatus("----------------"); } ClearMapImage(); string datFile = openFileDialog_Dat.FileName; if (DatManager.Initialize(datFile)) { AddStatus($"Loaded {datFile}");; DatManager.ReadDatFile(); string statusMessage = "Successfully read dat file. "; switch (DatManager.DatVersion) { case DatVersionType.ACDM: statusMessage += ("Format is \"AC-DM\" era."); break; case DatVersionType.ACTOD: statusMessage += ("Format is \"AC-TOD\" era."); break; } AddStatus(statusMessage); switch (DatManager.CellDat.Blocksize) { case 0x100: DrawMap(); break; default: AddStatus("Dat file is a PORTAL type file."); PortalHelper ph = new PortalHelper(); var contactSheet = ph.BuildIconContactSheet(); pictureBox1.Image = contactSheet; break; } AddStatus("-Files " + DatManager.CellDat.AllFiles.Count.ToString("N0")); string iteration = DatManager.Iteration; AddStatus("-Iteration " + iteration); var v = new VersionChecker(); string version = v.GetVersionInfo(Path.GetFileName(datFile), iteration); if (version != "") { AddStatus($"-File appears to be from {version}."); if (!v.IsComplete(Path.GetFileName(datFile), iteration)) { AddStatus("This file is not complete in the Asheron's Call Archive. Please consider uploading it at https://mega.nz/megadrop/0WvIiXRRYmg"); } } else { AddStatus("This file does not appear in the Asheron's Call Archive. Please consider uploading it at https://mega.nz/megadrop/0WvIiXRRYmg"); } } else { ClearMapImage(); AddStatus($"ERROR loading {datFile}. Probalby not a valid Asheron's Call dat file."); } } this.UseWaitCursor = false; Application.UseWaitCursor = false; }
private void loadPortalColorsToolStripMenuItem_Click(object sender, EventArgs e) { // Show OpenDialog box if (openFileDialog_Dat.ShowDialog() == DialogResult.OK) { if (textBoxStatus.Lines.Length > 0) { AddStatus("----------------"); } this.UseWaitCursor = true; Application.UseWaitCursor = true; Application.DoEvents(); // hack to force the cursor update. Cleaner than DoEvents string datFile = openFileDialog_Dat.FileName; if (DatManager.Initialize(datFile)) { AddStatus($"Loaded {datFile}");; DatManager.ReadDatFile(); string statusMessage = "Successfully read dat file. "; switch (DatManager.DatVersion) { case DatVersionType.ACDM: statusMessage += ("Format is \"AC-DM\" era."); break; case DatVersionType.ACTOD: statusMessage += ("Format is \"AC-TOD\" era."); break; } AddStatus(statusMessage); switch (DatManager.CellDat.Blocksize) { case 0x100: AddStatus("File is not a portal. No colors have been loaded."); break; default: PortalHelper ph = new PortalHelper(); uint regionId; if (DatManager.DatVersion == DatVersionType.ACDM) { regionId = RegionDesc.HW_FILE_ID; } else { regionId = RegionDesc.FILE_ID; } MapColors = ph.GetColors(regionId); ClearMapImage(); break; } AddStatus("-Files " + DatManager.CellDat.AllFiles.Count.ToString("N0")); string iteration = DatManager.Iteration; AddStatus("-Iteration " + iteration); var v = new VersionChecker(); string version = v.GetVersionInfo(Path.GetFileName(datFile), iteration); if (version != "") { AddStatus($"-File appears to be from {version}."); } else { AddStatus("This file does not appear in the Asheron's Call Archive. Please consider uploading it at https://mega.nz/megadrop/7x-Qh19h5Ek"); } } } this.UseWaitCursor = false; Application.UseWaitCursor = false; }