private void export(string filename) { GameData gameDatum = new GameData(); this.Cursor = Cursors.WaitCursor; navigation.ModFileMode fileMode = this.nav.FileMode; this.nav.FileMode = navigation.ModFileMode.SINGLE; gameDatum.load(this.fileA.Text, GameData.ModMode.ACTIVE, false); gameDatum.load(this.fileB.Text, GameData.ModMode.ACTIVE, false); foreach (object item in this.listView.Items) { TranslationFix.LineData tag = ((ListViewItem)item).Tag as TranslationFix.LineData; if (tag.@value == null) { continue; } GameData.Item item1 = gameDatum.getItem(tag.item.stringID); if (tag.key != null) { item1[tag.key] = tag.@value; } else { item1.Name = tag.@value; } } gameDatum.save(filename); this.nav.FileMode = fileMode; this.Cursor = Cursors.Default; }
private void textB_TextChanged(object sender, EventArgs e) { if (this.freezeTextEvents) { return; } if (this.listView.SelectedItems.Count == 0) { return; } ListViewItem item = this.listView.SelectedItems[0]; TranslationFix.LineData tag = item.Tag as TranslationFix.LineData; tag.state = TranslationFix.State.CUSTOMB; tag.@value = this.textB.Text; item.SubItems[0].ForeColor = Color.DarkOrange; this.textA.BackColor = SystemColors.Window; this.textB.BackColor = Color.FromArgb(255, 240, 230); }
private void listView_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (this.listView.SelectedItems.Count == 0) { return; } ListViewItem item = this.listView.SelectedItems[0]; TranslationFix.LineData tag = item.Tag as TranslationFix.LineData; if (e.KeyCode == Keys.Left) { if (tag.state == TranslationFix.State.UNKNOWN) { this.doneCount++; } item.SubItems[0].ForeColor = Color.Green; tag.@value = item.SubItems[1].Text; tag.state = TranslationFix.State.ORIGINAL; this.advance(); } else if (e.KeyCode == Keys.Right) { if (tag.state == TranslationFix.State.UNKNOWN) { this.doneCount++; } item.SubItems[0].ForeColor = Color.Blue; tag.@value = item.SubItems[2].Text; tag.state = TranslationFix.State.CHANGED; this.advance(); } this.listView_SelectedIndexChanged(null, null); Label label = this.stats; string str = this.doneCount.ToString(); int count = this.listView.Items.Count; label.Text = string.Concat(str, " / ", count.ToString()); }
private void listView_SelectedIndexChanged(object sender, EventArgs e) { ListViewItem item; if (this.listView.SelectedItems.Count > 0) { item = this.listView.SelectedItems[0]; } else { item = null; } ListViewItem listViewItem = item; if (listViewItem == null) { this.itemID.Text = ""; this.itmType.Text = ""; this.itemName.Text = ""; this.itemKey.Text = ""; TextBox textBox = this.textA; string str = ""; string str1 = str; this.textB.Text = str; textBox.Text = str1; this.textA.BackColor = SystemColors.Window; this.textB.BackColor = SystemColors.Window; return; } TranslationFix.LineData tag = listViewItem.Tag as TranslationFix.LineData; this.itemID.Text = tag.item.stringID; this.itmType.Text = tag.item.type.ToString(); this.itemName.Text = tag.item.OriginalName; this.itemKey.Text = tag.key ?? ""; this.freezeTextEvents = true; this.textA.Text = listViewItem.SubItems[1].Text; this.textB.Text = listViewItem.SubItems[2].Text; this.textA.BackColor = SystemColors.Window; this.textB.BackColor = SystemColors.Window; switch (tag.state) { case TranslationFix.State.ORIGINAL: { this.textA.BackColor = Color.FromArgb(240, 255, 240); break; } case TranslationFix.State.CHANGED: { this.textB.BackColor = Color.FromArgb(240, 255, 240); break; } case TranslationFix.State.CUSTOMA: { this.textA.BackColor = Color.FromArgb(255, 240, 230); this.textA.Text = tag.@value; break; } case TranslationFix.State.CUSTOMB: { this.textB.BackColor = Color.FromArgb(255, 240, 230); this.textB.Text = tag.@value; break; } } this.freezeTextEvents = false; }