public bool ConvertTag() { pgb.Minimum = 0; pgb.Maximum = listText.Count; pgb.Value = 0; char[] splitChar = { '[', ']' }; foreach (CTextData data in listText) { string[] words = data.Text.Split(splitChar); for (int i = 1; i < words.Length; i = i + 2) { if (words[i] == "user" || words[i] == "class" || words[i] == "race") { continue; } // Text All Data에서 ID를 검색한다. string strConvertText = TextAllDataTable.ConvertTag(words[i]); if (strConvertText != null) { data.Text = data.Text.Replace("[" + words[i] + "]", "[" + strConvertText + "]"); } } pgb.Value = Math.Min(pgb.Maximum, pgb.Value + 1); } return(true); }
private void btTagXLS_Click(object sender, EventArgs e) { if (listXLS.CheckedItems.Count == 0) { MessageBox.Show("Check 1 more files!"); return; } if (textDataFile.Text == "") { MessageBox.Show("Browse Text All Data Table File!!"); return; } LocalSource selectLocal = new LocalSource(); selectLocal.SetLabelText("Select Convert XLS Work to Do"); selectLocal.cmbSourceLocal.Items.Clear(); selectLocal.cmbSourceLocal.Items.Add("Korean Tag to Index"); selectLocal.cmbSourceLocal.Items.Add("Korean Tag to Japanese"); selectLocal.cmbSourceLocal.SelectedIndex = 0; selectLocal.ShowDialog(); if (TextAllDataTable.OpenTextAllData(textDataFile.Text, MH4Global.localSource)) { ConvertTagXLS(); } else { convertState = ConvertState.CONVERT_TAG_XLS; bReadyWork = true; } }
// TextAllData를 읽어서 맵에 저장한다. public void InsertTextAllData() { string row; for (int i = rowStart; i < rowCnt; i += rowInc) { row = i.ToString(); TextAllDataTable.InsertMap("N", row, "npc"); TextAllDataTable.InsertMap("L", row, "mob"); TextAllDataTable.InsertMap("X", row, "object"); TextAllDataTable.InsertMap("V", row, "place"); TextAllDataTable.InsertMap("H", row, "item"); TextAllDataTable.InsertMap("Z", row, "questItem"); TextAllDataTable.InsertMap("P", row, "skill"); TextAllDataTable.InsertMap("AB", row, "etc"); MH4Global.pgbXLS.Value = Math.Min(MH4Global.pgbXLS.Maximum, MH4Global.pgbXLS.Value + 1); if (MH4Global.pgbXLS.Value == MH4Global.pgbXLS.Maximum) { MH4Global.lbXLS.Text = "Load Text All Table Complete!"; MH4Global.lbXLS.Update(); MH4Global.mainForm.OnLoadedTextAllData(); } Thread.Sleep(0); } }
void ReplaceTag(Excel.Range rng, LocalizeSource localize) { char[] splitChar = { '[', ']' }; StringBuilder sbText = new StringBuilder(); StringBuilder sbOrg = new StringBuilder(); StringBuilder sbNew = new StringBuilder(); string text = null; // 스페이스만 있는 경우도 있다. 이 경우도 @처리 text = rng.Value2.ToString(); text = text.TrimStart(' '); if (text != "") { sbText.Length = 0; sbText.Append(text); string[] words = text.Split(splitChar); string strConvertText = null; for (int k = 1; k < words.Length; k = k + 2) { if (words[k] == "user" || words[k] == "class" || words[k] == "race" || words[k] == "br") { continue; } // Text All Data에서 ID를 검색한다. if (localize == LocalizeSource.LOCAL_KOREAN) { strConvertText = TextAllDataTable.ConvertTag(words[k]); } else if (localize == LocalizeSource.LOCAL_JAPANESE) { strConvertText = TextAllDataTable.ConvertJapanText(words[k]); } if (strConvertText != null) { sbOrg.Length = 0; sbNew.Length = 0; sbOrg.Append("["); sbOrg.Append(words[k]); sbOrg.Append("]"); sbNew.Append("["); sbNew.Append(strConvertText); sbNew.Append("]"); sbText.Replace(sbOrg.ToString(), sbNew.ToString()); } } rng.Value2 = sbText.ToString(); } }
private void btConvertTagXML_Click(object sender, EventArgs e) { if (listXLS.CheckedItems.Count == 0) { MessageBox.Show("Check 1 more files!"); return; } if (textDataFile.Text == "") { MessageBox.Show("Browse Text All Data Table File!!"); return; } LocalSource selectLocal = new LocalSource(); selectLocal.SetLabelText("Select Source Localize of XLS Files"); selectLocal.cmbSourceLocal.Items.Clear(); selectLocal.cmbSourceLocal.Items.Add("Korean"); selectLocal.cmbSourceLocal.Items.Add("Japanese"); selectLocal.cmbSourceLocal.SelectedIndex = 0; selectLocal.ShowDialog(); if (MH4Global.localSource != LocalizeSource.LOCAL_KOREAN && MH4Global.localSource != LocalizeSource.LOCAL_JAPANESE) { return; } if (TextAllDataTable.OpenTextAllData(textDataFile.Text, MH4Global.localSource)) { ConvertTagXML(); } else { convertState = ConvertState.CONVERT_XML; bReadyWork = true; } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { // 현재 리스트의 내용을 레지스트리에 저장한다. RegistryKey kr = Registry.CurrentUser.CreateSubKey("MiHaeng4"); // XLS 리스트 kr.SetValue("XLS_COUNT", listXLS.Items.Count); for (int i = 0; i < listXLS.Items.Count; ++i) { kr.SetValue("XLS_" + i.ToString(), listXLS.Items[i].Text); } // XML 리스트 kr.SetValue("XML_COUNT", listXML.Items.Count); for (int i = 0; i < listXML.Items.Count; ++i) { kr.SetValue("XML_" + i.ToString(), listXML.Items[i].Text); } kr.Close(); TextAllDataTable.Close(); }