private void Convertclttosevfolder_Click(object sender, EventArgs e) { JMessageBox.Show(this, "Select save path."); using (var savePfb = new FolderBrowserDialog()) { DialogResult resultx = savePfb.ShowDialog(); if (resultx == DialogResult.OK && !string.IsNullOrWhiteSpace(savePfb.SelectedPath)) { string SavePath = savePfb.SelectedPath; JMessageBox.Show(this, "Select perfect world server map path."); using (var fbd = new FolderBrowserDialog()) { DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { var myFiles = Directory.GetFiles(fbd.SelectedPath, "precinct.clt", SearchOption.AllDirectories); foreach (string path in myFiles) { PretinctFile Region = new PretinctFile(); if (Region.ReadFile(path)) { string fileName = Path.GetFileName(path); string dirName = new DirectoryInfo(Path.GetDirectoryName(path)).Name; string savePath = Path.Combine(SavePath, dirName + "\\" + fileName); Region.SaveFile(savePath, false); } } } } } } JMessageBox.Show(this, "All saved."); }
private void LoadPrecinct() { Read = new PretinctFile(); PretinctDataGrid.RowCount = 0; if (Read.ReadFile(autoOpenPath)) { Loaded = true; jTextBox1.Text = Read.dwVersion.ToString(); jTextBox2.Text = Read.dwTimeStamp.ToString(); PretinctDataGrid.RowCount = Read.zones.Count; } else { Loaded = false; } }
private void jPictureBox1_Click(object sender, EventArgs e) { OpenFileDialog load = new OpenFileDialog(); load.Filter = "Precinct (precinct.clt)|*.clt|All Files (*.*)|*.*"; if (load.ShowDialog() == System.Windows.Forms.DialogResult.OK && File.Exists(load.FileName)) { Loaded = false; autoOpenPath = load.FileName; isAutoOpen = true; Read = null; PretinctDataGrid.RowCount = 0; ZonesDataGrid.RowCount = 0; Music.RowCount = 0; Nigbour.RowCount = 0; LoadPrecinct(); } }