private void btnChange_Click(object sender, EventArgs e) { var fails = new List <string> { "SONG ID MISSING", "NOT PRESENT IN DTA", "N/A", "N/A - PACK" }; var popup = new PasswordUnlocker(fails.Contains(lblSongID.Text) ? "" : lblSongID.Text); popup.IDChanger(); popup.ShowDialog(); var newID = popup.EnteredText; popup.Dispose(); if (string.IsNullOrWhiteSpace(newID) || newID.Trim() == lblSongID.Text) { return; } var dta = Path.GetTempPath() + "dta"; Tools.DeleteFile(dta); if (!activeDTA.ExtractToFile(dta)) { Log("Error extracting DTA file...failed to change song ID!"); return; } Tools.ReplaceSongID(dta, newID); if (!activeDTA.Replace(dta)) { Tools.DeleteFile(dta); Log("Error replacing DTA file...failed to change song ID!"); return; } Tools.DeleteFile(dta); lblSongID.Text = newID; Log("Changed song ID to '" + newID + "' successfully"); ShowChanges(true); }
private void ExtractFile(FileEntry xent, FileEntry xent2 = null) { var ext_folder = Application.StartupPath + "\\temp\\"; if (!Directory.Exists(ext_folder)) { Directory.CreateDirectory(ext_folder); } Enabled = false; Log("Extracting " + xent.Name); var ext_file = new StringCollection { ext_folder + xent.Name }; Tools.DeleteFile(ext_file[0]); if (!xent.ExtractToFile(ext_file[0])) { Log("Error extracting " + xent.Name); Enabled = true; return; } if (xent2 != null) { Log("Extracting " + xent2.Name); ext_file.Add(ext_folder + xent2.Name); Tools.DeleteFile(ext_file[1]); if (!xent2.ExtractToFile(ext_file[1])) { Log("Error extracting " + xent2.Name); ext_file.RemoveAt(1); } } if (Path.GetExtension(ext_file[0]) == ".mogg") { Tools.WriteOutData(Tools.ObfM(File.ReadAllBytes(ext_file[0])), ext_file[0]); } Enabled = true; if (File.Exists(ext_file[0])) { var moveEffect = new byte[] { 2, 0, 0, 0 }; var dropEffect = new MemoryStream(); dropEffect.Write(moveEffect, 0, moveEffect.Length); var data = new DataObject(); data.SetFileDropList(ext_file); data.SetData("Preferred DropEffect", dropEffect); Clipboard.Clear(); Clipboard.SetDataObject(data, true); Log("File " + Path.GetFileName(ext_file[0]) + " extracted successfully"); if (ext_file.Count > 1) { Log("File " + Path.GetFileName(ext_file[1]) + " extracted successfully"); } Log(ext_file.Count > 1 ? "Files are in your clipboard, paste them anywhere" : "File is in your clipboard, paste it anywhere"); } else { Log("Could not extract file " + Path.GetFileName(ext_file[0])); } }