private void createTraToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openExeDialog = new OpenFileDialog(); openExeDialog.Title = "Game EXE for Translation"; openExeDialog.Filter = "AGS EXE File (*.exe)|*.exe"; OpenFileDialog openDialog = new OpenFileDialog(); openDialog.Filter = "TRS Translation File (*.trs)|*.trs"; openDialog.Title = "Open TRS Translation you want to use."; SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.DefaultExt = "tra"; saveDialog.Filter = "TRA Translation File (*.tra)|*.tra"; saveDialog.Title = "Save TRA Translation as..."; if (openExeDialog.ShowDialog() == DialogResult.OK) { AgsTranslation.Gameinfo info = AgsTranslation.GetGameInfo(openExeDialog.FileName); if (openDialog.ShowDialog() == DialogResult.OK) { if (saveDialog.ShowDialog() == DialogResult.OK) { AgsTranslation.CreateTraFile(info, saveDialog.FileName, AgsTranslation.ParseTrsTranslation(openDialog.FileName)); } } } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Filter = "AGS Translation File(*.TRA,*.TRS)|*.tra;*.trs"; if (fileDialog.ShowDialog() == DialogResult.OK) { //Enable Buttons SaveStripButton.Enabled = true; StatsStripButton.Enabled = true; saveToolStripMenuItem.Enabled = true; saveAsToolStripMenuItem.Enabled = true; addToolStripMenuItem.Enabled = true; removeToolStripMenuItem.Enabled = true; searchTextToolStripMenuItem.Enabled = true; goToRowToolStripMenuItem.Enabled = true; //Clear the DataGrid translationGrid.Rows.Clear(); translationGrid.Refresh(); numEntries = 0; Dictionary <string, string> entryList = null; currentFileName = fileDialog.FileName; if (fileDialog.FileName.Contains(".tra")) { entryList = AgsTranslation.ParseTraTranslation(fileDialog.FileName); } else if (fileDialog.FileName.Contains(".trs")) { entryList = AgsTranslation.ParseTrsTranslation(fileDialog.FileName); } if (entryList != null) { foreach (KeyValuePair <string, string> pair in entryList) { //Populate DataGridView string[] newRow = { pair.Key, pair.Value }; translationGrid.Rows.Add(newRow); numEntries++; } } lblFileStatus.Text = "File loaded"; lblEntriesCount.Text = "Entries: " + numEntries; //Set Form text to filename this.Text = currentFileName + " - AGS Translation Editor"; documentChanged = false; } }
private void getGameInfoToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openDialog = new OpenFileDialog(); openDialog.Filter = "Game EXE File (*.exe)|*.exe"; if (openDialog.ShowDialog() == DialogResult.OK) { AgsTranslation.Gameinfo gameinfo = new AgsTranslation.Gameinfo(); gameinfo = AgsTranslation.GetGameInfo(openDialog.FileName); MessageBox.Show( "AGS Version: " + gameinfo.Version + "\nGame Title: " + gameinfo.GameTitle + "\nGameUID: " + gameinfo.GameUID, "Game Information"); } }