diff --git a/Source/AboutEditorForm.resx b/Source/AboutEditorForm.resx index 247ee6c..89477ba 100644 --- a/Source/AboutEditorForm.resx +++ b/Source/AboutEditorForm.resx @@ -136,7 +136,7 @@ 1 - Version 10.1 by ArtUrlWWW + Version 10.2 by ArtUrlWWW MiddleCenter diff --git a/Source/AddString.cs b/Source/AddString.cs index 23e384d..6ebfaf3 100644 --- a/Source/AddString.cs +++ b/Source/AddString.cs @@ -139,7 +139,7 @@ private void copyStrFldsValues_Click(object sender, EventArgs e) sh.textIDFld = textIDFld.Text; sh.displayTextFld = displayTextFld.Text; - MainUI.strHolders.Add(sh); + MainUI.copiedValuesStrHolders.Add(sh); } private void pasteStrFldsValues_Click(object sender, EventArgs e) diff --git a/Source/Editor.cs b/Source/Editor.cs index 0ea0750..fb3c26c 100644 --- a/Source/Editor.cs +++ b/Source/Editor.cs @@ -167,15 +167,15 @@ private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventA sh.textIDFld = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); sh.displayTextFld = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); - MainUI.strHolders.Add(sh); + MainUI.copiedValuesStrHolders.Add(sh); } } private void Paste_ALL_copied_values_Click(object sender, EventArgs e) { - for (int x = 0; x < MainUI.strHolders.Count; x++) + for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++) { - StringHolder sh = MainUI.strHolders[x]; + StringHolder sh = MainUI.copiedValuesStrHolders[x]; DataTable dt = (DataTable)dataGridView1.DataSource; DataRow dr; @@ -311,7 +311,7 @@ private void CopySelectedRows() sh.textIDFld = dataGridView1.SelectedRows[x].Cells[0].Value.ToString(); sh.displayTextFld = dataGridView1.SelectedRows[x].Cells[1].Value.ToString(); - MainUI.strHolders.Add(sh); + MainUI.copiedValuesStrHolders.Add(sh); } MessageBox.Show(dataGridView1.SelectedRows.Count + " rows copied!"); @@ -354,7 +354,7 @@ private void copyThisRowToolStripMenuItem_Click(object sender, EventArgs e) sh.textIDFld = row.Cells[0].Value.ToString(); sh.displayTextFld = row.Cells[1].Value.ToString(); - MainUI.strHolders.Add(sh); + MainUI.copiedValuesStrHolders.Add(sh); } diff --git a/Source/MainUI.cs b/Source/MainUI.cs index c9f3d14..c624305 100644 --- a/Source/MainUI.cs +++ b/Source/MainUI.cs @@ -21,7 +21,7 @@ public partial class MainUI : Form private DataGridViewSettings settings0 = new DataGridViewSettings(); private DataGridViewSettings settings1 = new DataGridViewSettings(); - public static List strHolders = new List(); + public static List copiedValuesStrHolders = new List(); public MainUI() { @@ -375,6 +375,8 @@ private void closeAndSavePackage(bool save = true) SaveSTBLFile(true); } + fileNameLbl.Text = ""; + LanguageLbl.Text = ""; dataGridView1.DataSource = null; dataGridView1.Columns.Add("Column1", ""); @@ -421,7 +423,7 @@ private void showLangCodesToolStripMenuItem_Click(object sender, EventArgs e) private void multyInsertIntoFilesToolStripMenuItem_Click(object sender, EventArgs e) { - if (MainUI.strHolders.Count > 0) + if (MainUI.copiedValuesStrHolders.Count > 0) { isTextChanged = false; @@ -462,17 +464,31 @@ private void multyInsertIntoFilesToolStripMenuItem_Click(object sender, EventArg isTextChanged = true; - for (int x = 0; x < MainUI.strHolders.Count; x++) + for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++) { - StringHolder sh = MainUI.strHolders[x]; + StringHolder copiedStrElement = MainUI.copiedValuesStrHolders[x]; DataTable dt = (DataTable)dataGridView1.DataSource; - DataRow dr; - dr = dt.NewRow(); - dr[0] = sh.textIDFld; - dr[1] = sh.displayTextFld; - dt.Rows.Add(dr); - dataGridView1.Rows[dataGridView1.Rows.Count - 1].HeaderCell.Value = (dataGridView1.Rows.Count).ToString(); + + var drArr = (from rowEl in dt.AsEnumerable() + where rowEl.Field(0) == copiedStrElement.textIDFld + select rowEl); + + if (drArr.Count() == 0) + { + DataRow dr = dt.NewRow(); + dr[0] = copiedStrElement.textIDFld; + dr[1] = copiedStrElement.displayTextFld; + dt.Rows.Add(dr); + dataGridView1.Rows[dataGridView1.Rows.Count - 1].HeaderCell.Value = (dataGridView1.Rows.Count).ToString(); + + } + else + { + DataRow dr = drArr.First(); + dr[1] = copiedStrElement.displayTextFld; + } + } @@ -484,7 +500,8 @@ private void multyInsertIntoFilesToolStripMenuItem_Click(object sender, EventArg isTextChanged = false; } - } else + } + else { MessageBox.Show("You have not copied any string. \r\nCopy strings and use this option for mass insert of copied strings into STBL files!"); } diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index 3e06ee8..8cece65 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("10.1.0.0")] -[assembly: AssemblyFileVersion("10.1.0.0")] +[assembly: AssemblyVersion("10.2.0.0")] +[assembly: AssemblyFileVersion("10.2.0.0")] diff --git a/Source/StringPicker.cs b/Source/StringPicker.cs index e630a50..4ac82dc 100644 --- a/Source/StringPicker.cs +++ b/Source/StringPicker.cs @@ -29,9 +29,9 @@ private void reloadListView() { listView1.Items.Clear(); listView1.View = View.List; - for (int x = 0; x < MainUI.strHolders.Count; x++) + for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++) { - StringHolder sh = MainUI.strHolders[x]; + StringHolder sh = MainUI.copiedValuesStrHolders[x]; listView1.Items.Add(sh.textIDFld + " - " + sh.displayTextFld); } @@ -45,12 +45,12 @@ private void listView1_MouseClick(object sender, MouseEventArgs e) { if (addstr != null) { - addstr.setFldsValues(MainUI.strHolders[listView1.SelectedIndices[0]]); + addstr.setFldsValues(MainUI.copiedValuesStrHolders[listView1.SelectedIndices[0]]); } } else { - MainUI.strHolders.RemoveAt(listView1.SelectedIndices[0]); + MainUI.copiedValuesStrHolders.RemoveAt(listView1.SelectedIndices[0]); reloadListView(); } } @@ -60,7 +60,7 @@ private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { if (addstr != null) { - addstr.setFldsValues(MainUI.strHolders[listView1.SelectedIndices[0]]); + addstr.setFldsValues(MainUI.copiedValuesStrHolders[listView1.SelectedIndices[0]]); } this.Close();