private void currentDialogToolStripMenuItem_Click(object sender, EventArgs e) { if (dlgName == "") { MessageBox.Show("Диалог не выбран. Нужно вывести список диалогов и выбрать нужный"); return; } if (!mapName.Contains(".fodlg")) { MessageBox.Show("Выбраный элемент не является диалогом"); return; } DialogFiles dialog = new DialogFiles(dlgName, NewItemPidPath.Text); dialog.setNewPid(); dialog.writeFile(); }
private void allDialogsToolStripMenuItem_Click(object sender, EventArgs e) { string[] arrayItemNames; string[] arrayNewPidNumbers; string[] arrayOldPidNumbers; ReadFileInArray new_itempid; new_itempid = new ReadFileInArray(NewItemPidPath.Text); ReadFileInArray oldItemsName; oldItemsName = new ReadFileInArray("old_itempid.fos"); List <string> NewListOfStrings = getListOfStrings(new_itempid.arrayListOfStrings); List <string> OldListOfStrings = getListOfStrings(oldItemsName.arrayListOfStrings); arrayItemNames = new string[NewListOfStrings.Count]; arrayNewPidNumbers = new string[NewListOfStrings.Count]; arrayOldPidNumbers = new string[NewListOfStrings.Count]; int i = 0; foreach (string str in NewListOfStrings) { string buf = str.Replace("#define", "").Replace(" ", "").Replace("\t", ""); int startNum = 0; int finNum = 0; for (int j = 0, jMax = buf.Length; j < jMax; j++) { if (buf[j] == ')') { finNum = j; break; } if (buf[j] == '(') { startNum = j; } } arrayItemNames[i] += buf.Substring(0, startNum); arrayNewPidNumbers[i] += buf.Substring(startNum + 1, ((finNum - startNum) - 1) > 0 ? ((finNum - startNum) - 1) : 1); arrayOldPidNumbers[i] = "-1"; foreach (string oldStr in OldListOfStrings) { buf = oldStr.Replace("#define", "").Replace(" ", "").Replace("\t", ""); if (!buf.Contains(arrayItemNames[i])) { continue; } string subbuf = ""; foreach (char ch in buf) { if (ch == '(') { break; } subbuf += ch; } if (subbuf != arrayItemNames[i]) { continue; } startNum = 0; finNum = 0; for (int j = 0, jMax = buf.Length; j < jMax; j++) { if (buf[j] == ')') { finNum = j; break; } if (buf[j] == '(') { startNum = j; } } arrayOldPidNumbers[i] = buf.Substring(startNum + 1, ((finNum - startNum) - 1) > 0 ? ((finNum - startNum) - 1) : 1); } i++; } string[] fileNames = Directory.GetFiles(path + "dialogs"); for (int k = 0; k < fileNames.Length; k++) { fileNames[k] = fileNames[k].Replace(path + "dialogs\\", ""); if (!fileNames[k].Contains(".fodlg")) { continue; } DialogFiles dialog = new DialogFiles(fileNames[k], arrayNewPidNumbers, arrayOldPidNumbers, arrayItemNames); dialog.setNewPid(); dialog.writeFile(); } }