private void wZToolStripMenuItem_Click(object sender, EventArgs e) { if (InfoMessage("This will extract the WZ file? Are you sure?", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } var ofd = new OpenFileDialog(); ofd.FileName = @"C:\Program Files (x86)\MapleGlobalT_2 - kopie\Data.wz"; ofd.Filter = "WZ Files|*.wz"; ofd.Multiselect = true; if (ofd.ShowDialog() != DialogResult.OK) { return; } var folderBrowserDialog = new FolderSelect.FolderSelectDialog(); if (folderBrowserDialog.ShowDialog() == false) { return; } ExtractWZFile(folderBrowserDialog.FileName, ofd.FileNames); LoadContentsOfFolder(folderBrowserDialog.FileName); }
public Manager() { InitializeComponent(); var ofd = new FolderSelect.FolderSelectDialog(); //Wraps System.Windows.Forms.OpenFileDialog to make it present a vista-style dialog. //IDEA: Text box linked to hidden autocomplete textbox for multiword autocomplete textBox1.Focus(); //TagTexBox has multiword autocomplete textBox1.Text = ""; if (ofd.ShowDialog()) //Check that user chose a directory { Tags.Load(ofd.FileName); textBox1.Values = Tags.Get("<Tags>"); //load autofill values for TagTextBox //this.listBox1.Items.AddRange((ListBox.ObjectCollection)Tags.Get("<Tags>")); listBox1.DataSource = Tags.Get("<Tags>"); //load tags into sidelist CreateHeadersAndFillListView(listView1); //setup listview PaintListView(ofd.FileName, listView1); //populate listview with folder-item-info and tags } else { MessageBox.Show("You need to choose a Directory"); System.Windows.Forms.Application.Exit(); System.Environment.Exit(1); } }
/// <summary> /// Export player menu item click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void exportPlayerMenuItem_Click(object sender, EventArgs e) { // Get players ID and Nick int Pid = Int32.Parse(DataTable.SelectedRows[0].Cells[1].Value.ToString()); string Name = DataTable.SelectedRows[0].Cells[2].Value.ToString(); // Create export directory if it doesnt exist yet string sPath = Path.Combine(Paths.DocumentsFolder, "Player Backups"); if (!Directory.Exists(sPath)) { Directory.CreateDirectory(sPath); } // Have user select folder FolderSelect.FolderSelectDialog Dialog = new FolderSelect.FolderSelectDialog(); Dialog.InitialDirectory = sPath; Dialog.Title = "Select folder to export player to"; if (Dialog.ShowDialog()) { try { StatsManager.ExportPlayerXml(sPath, Pid, Name); Notify.Show("Player Exported Successfully", String.Format("{0} ({1})", Name, Pid), AlertType.Success); } catch (Exception E) { using (ExceptionForm EForm = new ExceptionForm(E, false)) { EForm.Message = "Unable to export player because an exception was thrown!"; EForm.ShowDialog(); } } } }
private void metroTextButtonBroseFolder_Click(object sender, EventArgs e) { var dialog = new FolderSelect.FolderSelectDialog(); dialog.InitialDirectory = Core.Config.UserDefinedFolderPath; if (dialog.ShowDialog(IntPtr.Zero)) { metroTextBoxFolderPath.Text = dialog.FileName; //FileNameという名称だが、実体はフォルダPath } }
private void btnAltFolderBrowse_Click(object sender, EventArgs e) { var fsd = new FolderSelect.FolderSelectDialog(); fsd.Title = "Please select the path for split data to be stored at"; if (fsd.ShowDialog(IntPtr.Zero)) { txtProjFolder.Text = fsd.FileName; } }
private void ScanButton_Click(object sender, EventArgs e) { var dialog = new FolderSelect.FolderSelectDialog(); dialog.Title = Utils.i18N.Translate("Select a folder"); if (dialog.ShowDialog(Win32Native.GetForegroundWindow())) { ScanDirectory(dialog.FileName); MessageBox.Show(Utils.i18N.Translate("Scan completed"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private string GetClientDirFromOpenDialog() { var dlg = new FolderSelect.FolderSelectDialog(); if (!dlg.ShowDialog()) { return(null); } return(dlg.FileName); }
private void browseButton_Click(object sender, EventArgs e) { var fsd = new FolderSelect.FolderSelectDialog(); fsd.Title = "Select folder to save document"; fsd.InitialDirectory = @"c:\"; if (fsd.ShowDialog(IntPtr.Zero)) { testTXT.Text = fsd.FileName; } }
/// <summary> /// フォルダ選択ボタン /// ※フォルダ選択時、Core.Config.CurrentFolderも書き換える /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonSelectFolder_Click(object sender, RibbonControlEventArgs e) { var dialog = new FolderSelect.FolderSelectDialog(); dialog.InitialDirectory = Core.Config.CurrentFolderPath; if (dialog.ShowDialog(IntPtr.Zero)) { SetDropDownList(dialog.FileName); //FileNameという名称だが、実体はフォルダPath SetCurrentFolder(dialog.FileName); } }
private void Button_Click_3(object sender, RoutedEventArgs e) { FolderSelect.FolderSelectDialog fdlg = new FolderSelect.FolderSelectDialog(); fdlg.Title = "Change Folder"; fdlg.InitialDirectory = this.folder; if (!fdlg.ShowDialog(IntPtr.Zero)) { return; } openFolder(fdlg.FileName); }
private void tsmiLoadDirectory_Click(object sender, EventArgs e) { var folderBrowserDialog = new FolderSelect.FolderSelectDialog(); folderBrowserDialog.InitialDirectory = @"C:\Users\Erwin\Desktop\WzFiles\Data.wz"; if (folderBrowserDialog.ShowDialog() == false) { return; } ResetTree(); LoadContentsOfFolder(folderBrowserDialog.FileName); }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { SaveLast(); FolderSelect.FolderSelectDialog fsd = new FolderSelect.FolderSelectDialog(); fsd.Title = "Select Export BS-X File Folder..."; if (fsd.ShowDialog()) { //No \ at the end Program.ExportBSX(fsd.FileName); } }
private void btnBrowse_Click(object sender, EventArgs e) { var fsd = new FolderSelect.FolderSelectDialog(); fsd.Title = "Please select an old project folder."; if (fsd.ShowDialog(IntPtr.Zero)) { txtProjFolder.Text = fsd.FileName; projPath = txtProjFolder.Text; setGame(); } }
private string FolderDialog(string description) { FolderSelect.FolderSelectDialog dlg = new FolderSelect.FolderSelectDialog() { Title = description, InitialDirectory = System.IO.Directory.GetCurrentDirectory(), }; if (dlg.ShowDialog()) { return(dlg.FileName); } return(null); }
private void buttonBrowse_Click(object sender, EventArgs e) { FolderSelect.FolderSelectDialog selectDialog = new FolderSelect.FolderSelectDialog(); selectDialog.Title = "Select a folder containing UVHD files"; if (!String.IsNullOrEmpty(textBoxFilePathUVHD.Text)) { selectDialog.InitialDirectory = textBoxFilePathUVHD.Text + "\\"; } bool result = selectDialog.ShowDialog(this.Handle); if (result) { string filePathUVHD = selectDialog.FileName; textBoxFilePathUVHD.Text = filePathUVHD; } }
private void extractWZToolStripMenuItem_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); ofd.Filter = "WZ Files|*.wz"; ofd.Multiselect = true; if (ofd.ShowDialog() != DialogResult.OK) { return; } var folderBrowserDialog = new FolderSelect.FolderSelectDialog(); if (folderBrowserDialog.ShowDialog() == false) { return; } ExtractWZFile(folderBrowserDialog.FileName, ofd.FileNames); }
/// <summary> /// Export Player Button Click Event /// </summary> private void ExportPlayerBtn_Click(object sender, EventArgs e) { // Create export directory if it doesnt exist yet string sPath = Path.Combine(Paths.DocumentsFolder, "Player Backups"); if (!Directory.Exists(sPath)) { Directory.CreateDirectory(sPath); } // Have user select folder FolderSelect.FolderSelectDialog Dialog = new FolderSelect.FolderSelectDialog(); Dialog.InitialDirectory = sPath; Dialog.Title = "Select folder to export player to"; if (Dialog.ShowDialog()) { try { StatsManager.ExportPlayerXml(sPath, Pid, Player["name"].ToString()); Notify.Show("Player Exported Successfully", String.Format("{0} ({1})", Player["name"].ToString(), Pid), AlertType.Success); } catch (DbConnectException Ex) { HttpServer.Stop(); ExceptionForm.ShowDbConnectError(Ex); this.Close(); } catch (Exception E) { using (ExceptionForm EForm = new ExceptionForm(E, false)) { EForm.Message = "Unable to export player because an exception was thrown!"; EForm.ShowDialog(); } } } }
private void flatsportToolStripMenuItem_Click(object sender, EventArgs e) { var sn = tvData.SelectedNode; if (sn?.Tag == null) { return; } var folderBrowserDialog = new FolderSelect.FolderSelectDialog(); if (folderBrowserDialog.ShowDialog() == false) { return; } if (!(sn is WZTreeNode wtn)) { return; } var tag = wtn.WzObject; ExportNodes(folderBrowserDialog.FileName, sn.Name, tag); }
/// <summary> /// Opens a Project Template file to begin the game data split. Asks and saves game directory to template if one does not exist. /// </summary> /// <returns>SplitTemplate file</returns> public static Templates.SplitTemplate openTemplateFile(string templateFilePath) { Templates.SplitTemplate templateFile; var templateFileSerializer = new XmlSerializer(typeof(Templates.SplitTemplate)); var templateFileStream = File.OpenRead(templateFilePath); templateFile = (Templates.SplitTemplate)templateFileSerializer.Deserialize(templateFileStream); templateFileStream.Close(); if (templateFile.GameInfo.GameSystemFolder.Length <= 0) { DialogResult gamePathWarning = MessageBox.Show(("A game path has not been supplied for this template.\n\nPlease select a valid game path containing this file: " + templateFile.GameInfo.CheckFile + ".\n\nPress OK to select a valid path for " + templateFile.GameInfo.GameName + "."), "Game Path Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (gamePathWarning == DialogResult.OK) { FolderSelectionNew: var fsd = new FolderSelect.FolderSelectDialog(); fsd.Title = "Please select path for " + templateFile.GameInfo.GameName; fsd.ShowDialog(); if (Directory.Exists(fsd.FileName)) { string checkFile = Path.Combine(fsd.FileName, templateFile.GameInfo.CheckFile); if (File.Exists(checkFile)) { string checkFileHash = HelperFunctions.FileHash(checkFile); if (checkFileHashes(templateFile.GameInfo.GameName, checkFileHash) == true) { TextWriter splitsWriter = File.CreateText(templateFilePath); templateFile.GameInfo.GameSystemFolder = fsd.FileName; templateFileSerializer.Serialize(splitsWriter, templateFile); return(templateFile); } else { DialogResult pathWarning = MessageBox.Show(("Check file " + templateFile.GameInfo.CheckFile + " is not correct for the template select.\n\n"), "Incorrect Game Version", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning); if (pathWarning == DialogResult.Retry) { goto FolderSelectionNew; } else { return(null); } } } else { DialogResult pathWarning = MessageBox.Show(("Check file " + templateFile.GameInfo.CheckFile + " was not located in the supplied Directory."), "Check File Not Found", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning); if (pathWarning == DialogResult.Retry) { goto FolderSelectionNew; } else { return(null); } } } else { DialogResult pathWarning = MessageBox.Show(("No path was supplied."), "No Path Supplied", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning); if (pathWarning == DialogResult.Retry) { goto FolderSelectionNew; } else { return(null); } } } else { return(null); } } else if (!Directory.Exists(templateFile.GameInfo.GameSystemFolder)) { DialogResult gamePathWarning = MessageBox.Show(("The folder for " + templateFile.GameInfo.GameName + " does not exist.\n\nPlease press OK and select the correct path for " + templateFile.GameInfo.GameName + "."), "Game Path Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (gamePathWarning == DialogResult.OK) { FolderSelectionMissing: var fsd = new FolderSelect.FolderSelectDialog(); fsd.Title = "Please select path for " + templateFile.GameInfo.GameName; fsd.ShowDialog(); if (Directory.Exists(fsd.FileName)) { string checkFile = Path.Combine(fsd.FileName, templateFile.GameInfo.CheckFile); if (File.Exists(checkFile)) { string checkFileHash = HelperFunctions.FileHash(checkFile); if (checkFileHashes(templateFile.GameInfo.GameName, checkFileHash) == true) { TextWriter splitsWriter = File.CreateText(templateFilePath); templateFile.GameInfo.GameSystemFolder = fsd.FileName; templateFileSerializer.Serialize(splitsWriter, templateFile); return(templateFile); } else { DialogResult pathWarning = MessageBox.Show(("Check file " + templateFile.GameInfo.CheckFile + " is not correct for the template select.\n\n"), "Incorrect Game Version", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning); if (pathWarning == DialogResult.Retry) { goto FolderSelectionMissing; } else { return(null); } } } else { DialogResult pathWarning = MessageBox.Show(("Check file " + templateFile.GameInfo.CheckFile + " was not located in the supplied Directory."), "Check File Not Found", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning); if (pathWarning == DialogResult.Retry) { goto FolderSelectionMissing; } else { return(null); } } } else { DialogResult pathWarning = MessageBox.Show(("No path was supplied."), "No Path Supplied", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning); if (pathWarning == DialogResult.Retry) { goto FolderSelectionMissing; } else { return(null); } } } else { return(null); } } else { return(templateFile); } }
/// <summary> /// Export player menu item click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void exportPlayerMenuItem_Click(object sender, EventArgs e) { // Get players ID and Nick int Pid = Int32.Parse(DataTable.SelectedRows[0].Cells[1].Value.ToString()); string Name = DataTable.SelectedRows[0].Cells[2].Value.ToString(); // Create export directory if it doesnt exist yet string sPath = Path.Combine(Paths.DocumentsFolder, "Player Exports"); if (!Directory.Exists(sPath)) Directory.CreateDirectory(sPath); // Have user select folder FolderSelect.FolderSelectDialog Dialog = new FolderSelect.FolderSelectDialog(); Dialog.InitialDirectory = sPath; Dialog.Title = "Select folder to export player to"; if (Dialog.ShowDialog()) { try { ASPServer.Database.ExportPlayerXml(sPath, Pid, Name); Notify.Show("Player Exported Successfully", String.Format("{0} ({1})", Name, Pid), AlertType.Success); } catch (Exception E) { ExceptionForm EForm = new ExceptionForm(E, false); EForm.Message = "Unable to export player because an exception was thrown!"; EForm.ShowDialog(); } } }
/// <summary> /// Export Player Button Click Event /// </summary> private void ExportPlayerBtn_Click(object sender, EventArgs e) { // Create export directory if it doesnt exist yet string sPath = Path.Combine(Paths.DocumentsFolder, "Player Backups"); if (!Directory.Exists(sPath)) Directory.CreateDirectory(sPath); // Have user select folder FolderSelect.FolderSelectDialog Dialog = new FolderSelect.FolderSelectDialog(); Dialog.InitialDirectory = sPath; Dialog.Title = "Select folder to export player to"; if (Dialog.ShowDialog()) { try { StatsManager.ExportPlayerXml(sPath, Pid, Player["name"].ToString()); Notify.Show("Player Exported Successfully", String.Format("{0} ({1})", Player["name"].ToString(), Pid), AlertType.Success); } catch (DbConnectException Ex) { HttpServer.Stop(); ExceptionForm.ShowDbConnectError(Ex); this.Close(); } catch (Exception E) { using (ExceptionForm EForm = new ExceptionForm(E, false)) { EForm.Message = "Unable to export player because an exception was thrown!"; EForm.ShowDialog(); } } } }
private void button2_Click(object sender, EventArgs e) { button1.Enabled = false; button2.Enabled = false; button3.Enabled = false; richTextBox1.Clear(); FolderSelect.FolderSelectDialog fsd = new FolderSelect.FolderSelectDialog(); fsd.Title = "Please select a folder to repack."; if (fsd.ShowDialog(IntPtr.Zero)) { byte[] eafHead = new byte[0x60]; eafHead[0x00] = 0x23; eafHead[0x01] = 0x45; eafHead[0x02] = 0x41; eafHead[0x03] = 0x46; eafHead[0x06] = 0x01; eafHead[0x14] = 0x01; File.WriteAllBytes(Path.GetDirectoryName(fsd.FileName) + "/" + "eafHead.bin", eafHead); File.WriteAllText(Path.GetDirectoryName(fsd.FileName) + "/" + "eafTable.bin", String.Empty); File.WriteAllText(Path.GetDirectoryName(fsd.FileName) + "/" + "eafBigFile.bin", String.Empty); richTextBox1.Text += "> Writing table...\r\n"; richTextBox1.Update(); int fileCount = 0; ProcessTable(fsd.FileName, Path.GetDirectoryName(fsd.FileName) + "/" + "eafTable.bin", fsd.FileName.Length + 1, ref fileCount); richTextBox1.Text += "> Finished writing table...\r\n"; richTextBox1.Text += "> Packing file(s)...\r\n"; richTextBox1.Update(); FileStream fs = new FileStream(Path.GetDirectoryName(fsd.FileName) + "/" + "eafTable.bin", FileMode.Open); BinaryWriter bw = new BinaryWriter(fs); BinaryReader br = new BinaryReader(fs); bw.BaseStream.Position = 0; ProcessBigPack(fsd.FileName, Path.GetDirectoryName(fsd.FileName) + "/" + "eafBigFile.bin", ref bw); richTextBox1.Text += "> File(s) packed...\r\n"; richTextBox1.Update(); bw.BaseStream.Position = 0; byte[] file0 = br.ReadBytes(0x10); bw.BaseStream.Position = 0; byte[] file0_Infos = new byte[0x10]; bw.Write(file0_Infos, 0, 0x10); br.Close(); bw.Close(); fs.Close(); backgroundWorker1.ReportProgress(0); label1.Text = "Building EAF..."; label1.Update(); using (FileStream stream = new FileStream(Path.GetDirectoryName(fsd.FileName) + "/" + "eafTable.bin", FileMode.Append)) { stream.Write(file0, 0, file0.Length); } File.WriteAllText(Path.GetDirectoryName(fsd.FileName) + "/" + Path.GetFileName(fsd.FileName) + "_new.eaf", String.Empty); byte[] head = File.ReadAllBytes(Path.GetDirectoryName(fsd.FileName) + "/" + "eafHead.bin"); byte[] table = File.ReadAllBytes(Path.GetDirectoryName(fsd.FileName) + "/" + "eafTable.bin"); byte[] bfile = File.ReadAllBytes(Path.GetDirectoryName(fsd.FileName) + "/" + "eafBigFile.bin"); long eafSize = 0; using (FileStream stream = new FileStream(Path.GetDirectoryName(fsd.FileName) + "/" + Path.GetFileName(fsd.FileName) + "_new.eaf", FileMode.Append)) { stream.Write(head, 0, head.Length); stream.Write(table, 0, table.Length); stream.Write(bfile, 0, bfile.Length); eafSize = stream.Length; } FileStream fs2 = new FileStream(Path.GetDirectoryName(fsd.FileName) + "/" + Path.GetFileName(fsd.FileName) + "_new.eaf", FileMode.Open); BinaryWriter bw2 = new BinaryWriter(fs2); bw2.BaseStream.Position = 0x8; bw2.Write(BitConverter.GetBytes(eafSize), 0, 8); bw2.Write(BitConverter.GetBytes(fileCount), 0, 4); backgroundWorker1.ReportProgress(100); label1.Text = "EAF Built..."; label1.Update(); bw2.Close(); fs2.Close(); if (File.Exists(Path.GetDirectoryName(fsd.FileName) + "/" + "eafHead.bin")) { File.Delete(Path.GetDirectoryName(fsd.FileName) + "/" + "eafHead.bin"); } if (File.Exists(Path.GetDirectoryName(fsd.FileName) + "/" + "eafTable.bin")) { File.Delete(Path.GetDirectoryName(fsd.FileName) + "/" + "eafTable.bin"); } if (File.Exists(Path.GetDirectoryName(fsd.FileName) + "/" + "eafBigFile.bin")) { File.Delete(Path.GetDirectoryName(fsd.FileName) + "/" + "eafBigFile.bin"); } richTextBox1.Text += "> Done!\r\n"; backgroundWorker1.ReportProgress(0); label1.Text = "Nothing to process..."; } button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; }
// Repeat // Save private void btnSaveFolder_Click(object sender, EventArgs e) { FolderSelect.FolderSelectDialog dlgSaveFolder = new FolderSelect.FolderSelectDialog(); dlgSaveFolder.ShowDialog(); // Model + UI Update cgr.saveFolder = dlgSaveFolder.FileName; txtSaveFolder.Text = dlgSaveFolder.FileName; startCheck(); }