private void toNational(object sender, EventArgs e) { //statusLabel2.Text=e.ToString(); int i = 0; foreach (DataGridViewRow dgrow in dataGridView.Rows) { foreach (var k in readKeyFile()) { dgrow.Cells["translatedValues"].Value = dgrow.Cells["translatedValues"].Value.ToString().Replace(k.Key, k.Value); } statusLabel2.Text = ++i + "\\" + dataGridView.Rows.Count; statusStrip.Update(); } }
private void Next_Click(object sender, EventArgs e) { this.TypeName.Text = ""; this.TypeName.Enabled = true; this.DocName.Text = ""; this.DocName.Enabled = true; StatusStrip.Items["StatusText"].Text = ""; StatusStrip.Update(); }
private void btnStatusBar_Click(object sender, EventArgs e) { for (int i = 0; i < 10; i++) { StatusStrip.Items[0].Text = i.ToString(); StatusStrip.Update(); for (int x = 0; x < 3; x++) { Thread.Sleep(25); Application.DoEvents(); } } StatusStrip.Items[0].Text = ""; }
private void StartButton_Click(object sender, EventArgs e) { var sFile = new string[1]; System.IO.StreamReader inFile = null; string sTemp; int iTemp; int iTempFiles; int iLineFlag = 0; string[] aSymbols1; // = {"[]", "{}", "<>"} string[] aSymbols2; // = {""""} ', "'" , "`" string sTemp1; string sTemp2; int iFlag1; int iFlag2; if (UseMetod1CheckBox.Checked == false & UseMetod1CheckBox.Checked == false) { MessageBox.Show("No one Mode selected. Select and try again", "No works.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Preparing symbols if (Metod1TextBox.Text.Length < 2) { MessageBox.Show("Metod1 symbols definition wrong", "Wrong symbols", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } aSymbols1 = Metod1TextBox.Text.Split(Conversions.ToChar(",")); var loopTo = aSymbols1.Length - 1; for (iTemp = 0; iTemp <= loopTo; iTemp++) { if (aSymbols1[iTemp].Length != 2) { MessageBox.Show("Metod1 symbols '" + aSymbols1[iTemp] + "' wrong.", "Wrong symbols", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (Metod2TextBox.Text.Length < 1) { MessageBox.Show("Metod2 symbols definition wrong", "Wrong symbols", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } aSymbols2 = Metod2TextBox.Text.Split(Conversions.ToChar(",")); var loopTo1 = aSymbols2.Length - 1; for (iTemp = 0; iTemp <= loopTo1; iTemp++) { if (aSymbols2[iTemp].Length != 1) { MessageBox.Show("Metod2 symbols '" + aSymbols2[iTemp] + "' wrong.", "Wrong symbols", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // -------- // Folder reading if (ReadingFolderCheckBox.Checked == false) { if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sFile[0] = OpenFileDialog.FileName; } else { FolderBrowserDialog.SelectedPath = Application.StartupPath; if (FolderBrowserDialog.ShowDialog() == DialogResult.Cancel) { return; } sFile = System.IO.Directory.GetFiles(FolderBrowserDialog.SelectedPath, "*.*", System.IO.SearchOption.TopDirectoryOnly); if (sFile.Length == 0) { MessageBox.Show("Selected directory empty. Try select another directory", "Empty directory", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } var outFile = new System.IO.StreamWriter("l2scriptmaker.log", true, System.Text.Encoding.Unicode, 1); outFile.WriteLine("L2ScriptMaker. Script Syntax Checker"); outFile.WriteLine(Conversions.ToString(DateAndTime.Now) + " Start" + Constants.vbNewLine); outFile.WriteLine(); if (ReadingFolderCheckBox.Checked == false) { outFile.WriteLine("Analyzing: " + sFile[0]); } else { outFile.WriteLine("Analyzing: " + FolderBrowserDialog.SelectedPath); } if (ReadingFolderCheckBox.Checked == true) { ToolStripProgressBar.Maximum = Conversions.ToInteger(sFile.Length - 1); } this.Update(); var loopTo2 = sFile.Length - 1; // MAIN Block for (iTempFiles = 0; iTempFiles <= loopTo2; iTempFiles++) { inFile = new System.IO.StreamReader(sFile[iTempFiles], System.Text.Encoding.Default, true, 1); ToolStripStatusLabel.Text = sFile[iTempFiles]; if (ReadingFolderCheckBox.Checked == false) { ToolStripProgressBar.Value = 0; ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); } else { ToolStripProgressBar.Value = Conversions.ToInteger(iTempFiles); } while (inFile.EndOfStream == false) { if (ReadLikeLineCheckBox.Checked == false) { sTemp = inFile.ReadLine(); } else { sTemp = inFile.ReadToEnd(); } iLineFlag += 1; if (ReadingFolderCheckBox.Checked == false) { ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); } StatusStrip.Update(); // Analyze type: 1 if (UseMetod1CheckBox.Checked == true) { var loopTo3 = aSymbols1.Length - 1; for (iTemp = 0; iTemp <= loopTo3; iTemp++) { sTemp1 = Conversions.ToString(aSymbols1[iTemp][0]); sTemp2 = Conversions.ToString(aSymbols1[iTemp][1]); iFlag1 = sTemp.Length - sTemp.Replace(sTemp1, "").Length; iFlag2 = sTemp.Length - sTemp.Replace(sTemp2, "").Length; if (iFlag1 != iFlag2) { // Found symbol for checking if (ReadingFolderCheckBox.Checked == true) { outFile.Write("File: " + System.IO.Path.GetFileName(sFile[iTempFiles]) + Constants.vbTab); } else { outFile.Write("Line: " + iLineFlag.ToString().PadRight(15) + Constants.vbTab); } outFile.Write("required symbol: "); if (iFlag1 < iFlag2) { outFile.WriteLine(sTemp1); } else { outFile.WriteLine(sTemp1); } } } } // Analyze type: 2 if (UseMetod2CheckBox.Checked == true) { var loopTo4 = aSymbols2.Length - 1; for (iTemp = 0; iTemp <= loopTo4; iTemp++) { sTemp1 = aSymbols2[iTemp]; iFlag1 = sTemp.Length - sTemp.Replace(sTemp1, "").Length; if (iFlag1 / (double)2 != Conversions.Fix(iFlag1 / (double)2)) { // Found symbol for checking if (ReadingFolderCheckBox.Checked == true) { outFile.Write("File: " + System.IO.Path.GetFileName(sFile[iTempFiles]) + Constants.vbTab); } else { outFile.Write("Line: " + iLineFlag.ToString().PadRight(15) + Constants.vbTab); } outFile.WriteLine("alone symbol: " + sTemp1); } } } } inFile.Close(); iLineFlag = 0; } ToolStripProgressBar.Value = 0; outFile.WriteLine(); outFile.WriteLine(Conversions.ToString(DateAndTime.Now) + " End"); outFile.WriteLine(); outFile.Close(); MessageBox.Show("Complete"); }
private void ButtonStart_Click(object sender, EventArgs e) { string sNpcNameE = "npcname-e.txt"; string sNpcdataPch = "npc_pch.txt"; string sNpcdata = "npcdata.txt"; string sHuntingzoneE = "huntingzone-e.txt"; string sNpcpos = "npcpos.txt"; if (System.IO.File.Exists(sNpcNameE) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage II client text file (npcname-e.txt)|npcname-e.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sNpcNameE = OpenFileDialog.FileName; } if (System.IO.File.Exists(sNpcdataPch) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage II server npc config (npc_pch.txt)|npc_pch.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sNpcdataPch = OpenFileDialog.FileName; } if (System.IO.File.Exists(sHuntingzoneE) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage II client text file (huntingzone-e.txt)|huntingzone-e.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sHuntingzoneE = OpenFileDialog.FileName; } if (System.IO.File.Exists(sNpcpos) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage II server npc config (npcpos.txt)|npcpos*.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sNpcpos = OpenFileDialog.FileName; } if (System.IO.File.Exists(sNpcdata) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage II server npc config (npcdata.txt)|npcdata*.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sNpcdata = OpenFileDialog.FileName; } string sTemp; string[] aTemp = null; int iTemp; // Dim aNpcId(40000) As Integer var aNpcName = new string[40001]; var aNpcHerb = new bool[40001]; var aQuestNpc = new string[1]; System.IO.StreamReader inFile; // Dim inHuntingzoneE As New System.IO.StreamReader(sHuntingzoneE, System.Text.Encoding.Default, True, 1) // Dim inNpcpos As New System.IO.StreamReader(sNpcpos, System.Text.Encoding.Default, True, 1) // Dim inNpcData As New System.IO.StreamReader(sNpcdata, System.Text.Encoding.Default, True, 1) // [pet_wolf_a] = 1012077 inFile = new System.IO.StreamReader(sNpcdataPch, System.Text.Encoding.Default, true, 1); ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); ToolStripStatusLabel.Text = "Loading npc_pch.txt..."; StatusStrip.Update(); while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine().Trim(); ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); if (!string.IsNullOrEmpty(sTemp) & sTemp.StartsWith("//") == false) { sTemp = sTemp.Replace(" ", "").Replace(Conversions.ToString((char)9), ""); // Replace("[", "").Replace("]", ""). aTemp = sTemp.Split(Conversions.ToChar("=")); aNpcName[Conversions.ToInteger(aTemp[1]) - 1000000] = aTemp[0]; } } inFile.Close(); ToolStripProgressBar.Value = 0; inFile = new System.IO.StreamReader(sHuntingzoneE, System.Text.Encoding.Default, true, 1); ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); ToolStripStatusLabel.Text = "Loading huntingzone-e.txt..."; StatusStrip.Update(); while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); if (!string.IsNullOrEmpty(sTemp) & sTemp.StartsWith("//") == false) { iTemp = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "level")); // huntingzone_begin id=2 hunting_type=1 level=25 unk_1=0 loc_x=50568.000000 loc_y=152408.000000 loc_z=-2656.000000 unk_2=0 affiliated_area_id=1 name=[Execution Grounds] huntingzone_end // If Libraries.GetNeedParamFromStr(sTemp, "name") = "[Valley of Saints]" Then // Dim dskjk As Boolean = True // End If if (iTemp > 0 & (Libraries.GetNeedParamFromStr(sTemp, "hunting_type") ?? "") == "1") { iTemp = aTerra.Length; Array.Resize(ref aTerra, iTemp + 1); aTerra[iTemp - 1].x = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "loc_x")); aTerra[iTemp - 1].y = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "loc_y")); aTerra[iTemp - 1].z = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "loc_z")); aTerra[iTemp - 1].level = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "level")); } } } inFile.Close(); ToolStripProgressBar.Value = 0; bool bScanMob = false; inFile = new System.IO.StreamReader(sNpcpos, true); ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); ToolStripStatusLabel.Text = "Loading Npcpos.txt..."; StatusStrip.Update(); while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); if (!string.IsNullOrEmpty(sTemp) & sTemp.StartsWith("//") == false) { if (sTemp.StartsWith("territory_begin") == true) { //if (Strings.InStr(sTemp, "[rune08_2215_23]") > 0) // bool skjak = true; sTemp = sTemp.Substring(Strings.InStr(sTemp, "{{") + 1, Strings.InStr(sTemp, "};{") - Strings.InStr(sTemp, "{{") - 2); bScanMob = InMyTerritory(sTemp); } if (bScanMob == true) { if (sTemp.StartsWith("npc_begin") == true | sTemp.StartsWith("npc_ex_begin") == true) { // sTemp = sTemp.Substring(InStr(sTemp, "[") - 1, InStr(sTemp, "]") - InStr(sTemp, "[") + 1) // [brilliant_legacy], [highprist_partyleader01] //if ((sTemp.Substring(Strings.InStr(sTemp, "[") - 1, Strings.InStr(sTemp, "]") - Strings.InStr(sTemp, "[") + 1) ?? "") == "[brilliant_legacy]") // bool skjak = true; if (Strings.InStr(sTemp, "Privates=[") == 0 & Strings.InStr(sTemp, "[SSQLoserTeleport]") == 0) { iTemp = Array.IndexOf(aNpcName, sTemp.Substring(Strings.InStr(sTemp, "[") - 1, Strings.InStr(sTemp, "]") - Strings.InStr(sTemp, "[") + 1)); if (iTemp != -1) { aNpcHerb[iTemp] = true; } } } } } } inFile.Close(); ToolStripProgressBar.Value = 0; System.IO.File.Copy(sNpcdata, sNpcdata + ".bak", true); inFile = new System.IO.StreamReader(sNpcdata + ".bak", System.Text.Encoding.Default, true, 1); var outFile = new System.IO.StreamWriter(sNpcdata, false, System.Text.Encoding.Unicode, 1); var outLog = new System.IO.StreamWriter(sNpcdata + ".log", false, System.Text.Encoding.Unicode, 1); outLog.WriteLine("Lineage II ScriptMaker: Herb mob generator. Start of " + Conversions.ToString(DateAndTime.Now) + Constants.vbNewLine); outLog.WriteLine("This mob now is " + HerbMobTypeTextBox.Text); ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); ToolStripStatusLabel.Text = "Rebuilding Npcdata.txt..."; StatusStrip.Update(); while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); if (!string.IsNullOrEmpty(sTemp) & sTemp.StartsWith("//") == false) { // npc_begin(0) pet(1) 12077(2) [pet_wolf_a](3) level=15(4) aTemp = sTemp.Split((char)9); // If aTemp(2) = "21530" Then // Dim skjak As Boolean = True // End If // If aTemp(3) = "[brilliant_legacy]" Then // Dim skjak As Boolean = True // End If // ------ Recovery type for npc before setting if (CheckBoxLa2Herb.Checked == true) { // fix for npcdata from dVampire sTemp = sTemp.Replace("herb_warrior", "warrior"); if (string.IsNullOrEmpty(Libraries.GetNeedParamFromStr(sTemp, "drop_herb"))) { sTemp = sTemp.Replace("npc_end", "drop_herb=0" + Constants.vbTab + "npc_end"); } sTemp = Libraries.SetNeedParamToStr(sTemp, "drop_herb", "0"); } else if ((aTemp[1] ?? "") == (HerbMobTypeTextBox.Text ?? "")) { aTemp[1] = "warrior"; sTemp = Strings.Join(aTemp, Conversions.ToString((char)9)); } // MAIN Fix if ((aTemp[1] ?? "") == "warrior") { // CHECKING for Known type no herb mobs if ((Libraries.GetNeedParamFromStr(sTemp, "unsowing") ?? "") == "1") { // npc already unsowing goto NoFix; } if (Strings.InStr(sTemp, "[Privates]") != 0) { // Checking Privates settings into Npcdata.txt goto NoFix; } if (Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "level").Replace("level=", "")) <= Conversions.ToInteger(HerbMobMinLvlTextBox.Text)) { goto NoFix; } if (aNpcHerb[Conversions.ToInteger(aTemp[2])] == false) { goto NoFix; } // {[HelpHeroSilhouette]=@betrayer_orc_hero}; if (Strings.InStr(sTemp, "[HelpHeroSilhouette]") != 0) { goto NoFix; } // {[silhouette]=@guardian_angel_r} if (Strings.InStr(sTemp, "[silhouette]") != 0) { goto NoFix; } // {[FeedID1_warrior_silhouette1]=@alpine_kukaburo_2_war_a1} ?? // ' HP1x checking // 'skill_list={@s_race_magic_creatures;@s_hp_increase10;@ // If InStr(sTemp, "@s_hp_increase") <> 0 Then // If InStr(sTemp, "@s_hp_increase1;") = 0 And InStr(sTemp, "@s_hp_increase1}") = 0 Then // GoTo NoFix // End If // End If // clan={@c_dungeon_clan} // ai_parameters={[SSQLoserTeleport]=@SEAL_REVELATION;[SSQTelPosX]=[137453];[SSQTelPosY]=[79665];[SSQTelPosZ]=[-3696]} if (Strings.InStr(sTemp, "@c_dungeon_clan") != 0) { goto NoFix; } // Mob checked - this Herb mob. Fixing if (CheckBoxLa2Herb.Checked == true) { sTemp = Libraries.SetNeedParamToStr(sTemp, "drop_herb", "1"); } else { aTemp[1] = HerbMobTypeTextBox.Text; sTemp = Strings.Join(aTemp, Conversions.ToString((char)9)); } outLog.WriteLine(aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + aTemp[4]); NoFix: ; } } outFile.WriteLine(sTemp); } outLog.WriteLine(); outLog.WriteLine("End of " + Conversions.ToString(DateAndTime.Now)); inFile.Close(); outFile.Close(); outLog.Close(); ToolStripProgressBar.Value = 0; // inHuntingzoneE.Close() // inNpcpos.Close() // inNpcData.Close() MessageBox.Show("Complete"); }
private void HandlerVariableCheckButton_Click(object sender, EventArgs e) { string AiFile; OpenFileDialog.Filter = "Lineage II AI file|*.obj|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } AiFile = OpenFileDialog.FileName; var inAi = new System.IO.StreamReader(AiFile, System.Text.Encoding.Default, true, 1); var outAiLog = new System.IO.StreamWriter(AiFile + "_scriptCheck.log", true, System.Text.Encoding.Unicode, 1); outAiLog.WriteLine("L2ScriptMaker: AI.obj Handler Variable Checker. Start time: " + DateAndTime.Now.ToString() + Constants.vbNewLine); outAiLog.Flush(); var aVar = new string[1]; string sTemp; int iTemp; // check controls string ClassNameMarker = ""; string HandlerNameMarker = ""; string LastPushConstMarker = ""; ToolStripProgressBar.Maximum = Conversions.ToInteger(inAi.BaseStream.Length); while (inAi.EndOfStream != true) { sTemp = inAi.ReadLine().Trim(); // TempStr = TempStr.Trim ToolStripProgressBar.Value = Conversions.ToInteger(inAi.BaseStream.Position); StatusStrip.Update(); this.Update(); if (sTemp.StartsWith("class ") == true) { ClassNameMarker = sTemp; } if (sTemp.StartsWith("handler ") == true) { HandlerNameMarker = sTemp.Remove(0, Strings.InStr(sTemp, "//") + 2).Trim(); } if (sTemp.StartsWith("variable_begin") == true) { Array.Clear(aVar, 0, aVar.Length); Array.Resize(ref aVar, 0); sTemp = inAi.ReadLine().Trim(); while ((sTemp ?? "") != "variable_end") { // "_from_choice" if (!string.IsNullOrEmpty(sTemp.Trim())) { sTemp = sTemp.Replace("\"", ""); Array.Resize(ref aVar, aVar.Length + 1); aVar[aVar.Length - 1] = sTemp; } sTemp = inAi.ReadLine().Trim(); } } if (sTemp.StartsWith("push_event") == true & Strings.InStr(sTemp, "//") > 1) { // sTemp = sTemp.Replace(Chr(9), "").Replace(Chr(32), "") sTemp = sTemp.Remove(0, Strings.InStr(sTemp, "//") + 2).Trim(); if ((sTemp ?? "") != "gg") { iTemp = Array.IndexOf(aVar, sTemp); if (iTemp == -1) { outAiLog.WriteLine(Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine(">>>>>> Not found variable:" + sTemp + Constants.vbNewLine); } } } } ToolStripProgressBar.Value = 0; outAiLog.WriteLine("L2ScriptMaker: AI.obj Handler Variable Checker. End time: " + DateAndTime.Now.ToString() + Constants.vbNewLine); outAiLog.WriteLine(); outAiLog.Close(); inAi.Close(); MessageBox.Show("Complete."); }
private void StartButton_Click(object sender, EventArgs e) { string AiFile; string NpcFile; string NpcFileE; string newNpcEFile; var aClassName = new string[1]; var aClassStyle = new string[1]; var aNpcId = new string[1]; var aNpcAi = new string[1]; var aNpcLvl = new string[1]; OpenFileDialog.FileName = "ai.obj"; OpenFileDialog.Filter = "Lineage II server npc intelligence file (ai.obj)|ai*.obj|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } AiFile = OpenFileDialog.FileName; OpenFileDialog.FileName = "npcdata.txt"; OpenFileDialog.Filter = "Lineage II server npc file (npcdata.txt)|npcdata*.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } NpcFile = OpenFileDialog.FileName; OpenFileDialog.FileName = "npcname-e.txt"; OpenFileDialog.Filter = "Lineage II client npc file (npcname-e.txt)|npcname-e.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } NpcFileE = OpenFileDialog.FileName; SaveFileDialog.FileName = "npcname-e_new.txt"; SaveFileDialog.Filter = "Lineage II server npc file (npcname-e.txt)|npcname-e*.txt|All files|*.*"; if (SaveFileDialog.ShowDialog() == DialogResult.Cancel) { return; } newNpcEFile = SaveFileDialog.FileName; System.IO.StreamReader inFile; string[] aTemp; string sTemp; inFile = new System.IO.StreamReader(AiFile, System.Text.Encoding.Default, true, 1); ToolStripStatusLabel.Text = "Loading Ai.obj..."; ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); StatusStrip.Update(); while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); if (sTemp.StartsWith("class ") == true) { aTemp = sTemp.Split((char)32); // class(0) 1(1) default_npc(2) :(3) (null)(4) Array.Resize(ref aClassName, aClassName.Length + 1); aClassName[aClassName.Length - 1] = aTemp[2]; Array.Resize(ref aClassStyle, aClassStyle.Length + 1); aClassStyle[aClassStyle.Length - 1] = aTemp[4]; } } inFile.Close(); ToolStripProgressBar.Value = 0; string sTemp2; inFile = new System.IO.StreamReader(NpcFile, System.Text.Encoding.Default, true, 1); ToolStripStatusLabel.Text = "Loading npcdata.txt..."; ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); StatusStrip.Update(); while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); if (!string.IsNullOrEmpty(sTemp.Trim()) & sTemp.StartsWith("//") == false) { // npc_begin pet 12077 [pet_wolf_a] level=15 // npc_ai={[black_leopard];{[MoveAroundSocial]=90}; aTemp = sTemp.Replace((char)32, (char)9).Split((char)9); if ((aTemp[1] ?? "") == "warrior") { Array.Resize(ref aNpcId, aNpcId.Length + 1); aNpcId[aNpcId.Length - 1] = aTemp[2]; // ID Array.Resize(ref aNpcLvl, aNpcLvl.Length + 1); aNpcLvl[aNpcLvl.Length - 1] = Libraries.GetNeedParamFromStr(sTemp, "level"); // Level sTemp2 = Libraries.GetNeedParamFromStr(sTemp, "npc_ai"); if ((sTemp2 ?? "") != "{}") { sTemp2 = sTemp2.Substring(2, Strings.InStr(sTemp2, "]") - 3); Array.Resize(ref aNpcAi, aNpcAi.Length + 1); aNpcAi[aNpcAi.Length - 1] = sTemp2; // Ai } } } } inFile.Close(); // npcname_begin id=20001 name=[Gremlin] description=[] inFile = new System.IO.StreamReader(NpcFileE, System.Text.Encoding.Default, true, 1); var outFile = new System.IO.StreamWriter(newNpcEFile, false, System.Text.Encoding.Unicode, 1); ToolStripStatusLabel.Text = "Analysing npcname-e.txt..."; ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); StatusStrip.Update(); int iTempId; int iTemp; string Tag1 = Tag1TextBox.Text; string Tag2 = Tag2TextBox.Text; while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); iTempId = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, Tag1)); iTemp = Array.IndexOf(aNpcId, iTempId.ToString()); if (iTemp != -1) { if ((Libraries.GetNeedParamFromStr(sTemp, Tag2TextBox.Text) ?? "") == "[]") { sTemp2 = MaskPassTextBox.Text.Replace("$lvl", aNpcLvl[iTemp]); iTemp = Array.IndexOf(aClassName, aNpcAi[iTemp]); if (iTemp != -1) { if (Strings.InStr(aClassStyle[iTemp], "_ag_") != 0 | Strings.InStr(aClassStyle[iTemp], "aggressive") != 0) { sTemp2 = sTemp2 + MaskAggrTextBox.Text; } sTemp = sTemp.Replace(" = ", "="); sTemp = sTemp.Replace(Tag2 + "=" + Libraries.GetNeedParamFromStr(sTemp, Tag2), Tag2 + "=[" + sTemp2 + "]"); } } } outFile.WriteLine(sTemp); } inFile.Close(); ToolStripProgressBar.Value = 0; outFile.Close(); ToolStripStatusLabel.Text = "Complete"; ToolStripProgressBar.Value = 0; MessageBox.Show("Complete."); }
private void StartButton_Click(object sender, EventArgs e) { // Dim EnchantChance() As Integer = {99, 98, 97, 96, 95, 94, 92, 90, 86, 80, 74, 60, 50, 40, 30, 20, 10, 5, 5, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0} // Dim EnchantChance() As Integer = {99, 98, 98, 98, 96, 96, 95, 88, 88, 86!!!, 84, 80, 76, 72, 68, 52, 46, 42, 38, 34, 30, 28, 24, 22, 20, 18, 16, 14, 12, 10, 8} // CT1 last stable // Dim EnchantChance() As Integer = {99, 99, 99, 98, 98, 98, 97, 95, 92, 88, 83, 78, 72, 66, 60, 54, 48, 42, 36, 30, 25, 21, 17, 13, 10, 8, 6, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0} var EnchantChance = new[] { 97, 95, 93, 91, 89, 87, 84, 81, 78, 74, 70, 66, 62, 58, 54, 50, 46, 42, 38, 34, 30, 26, 22, 18, 14, 10, 6, 4, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; var EnchantChance1 = new[] { 98, 88, 78, 68, 58, 48, 38, 28, 18, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; string sSkillGrpFile = "skillgrp.txt"; // Name/path of skillgrp.txt file string sSkillnameEFile = "skillname-e.txt"; // Name/path of skillname-e.txt file string sSkillDataFile = "skilldata.txt"; // Name/path of skilldata.txt file string sSkillEncFile = "skillenchantdata.txt"; // Name/path of skilldata.txt file string sSkillPchFile = "skill_pch.txt"; string sTemp; // ExistPchCheckBox // skillgrp_begin skill_id=1398 skill_level=101 oper_type=0 mp_consume=103 cast_range=900 cast_style=1 hit_time=4.000000 is_magic=1 ani_char=[f] desc=[skill.su.1069] icon_name=[icon.skill1398] extra_eff=0 is_ench=1 ench_skill_id=10 hp_consume=0 UNK_0=9 UNK_1=11 skillgrp_end int iTemp; if (System.IO.File.Exists(sSkillGrpFile) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage II client text file (skillgrp.txt)|skillgrp.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sSkillGrpFile = OpenFileDialog.FileName; } if (System.IO.File.Exists(sSkillnameEFile) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage II client text file (skillname-e.txt)|skillname-e.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sSkillnameEFile = OpenFileDialog.FileName; } if (ExistPchCheckBox.Checked == true) { if (System.IO.File.Exists(sSkillPchFile) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage II client text file (skill_pch.txt)|skill_pch.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sSkillPchFile = OpenFileDialog.FileName; } if (SkillPchLoad(sSkillPchFile) == false) { return; } } SaveFileDialog.FileName = sSkillDataFile; SaveFileDialog.Filter = "Lineage II server enchant skill script (skilldata.txt)|skilldata*.txt|All files|*.*"; if (SaveFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sSkillDataFile = SaveFileDialog.FileName; SaveFileDialog.FileName = sSkillEncFile; SaveFileDialog.Filter = "Lineage II server skill script (skillenchantdata.txt)|skillenchantdata*.txt|All files|*.*"; if (SaveFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sSkillEncFile = SaveFileDialog.FileName; System.IO.StreamReader inFile; int iId; int iLevel; // ---- Loading 'Skillname-e.txt' ---- inFile = new System.IO.StreamReader(sSkillnameEFile, true); ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); ToolStripStatusLabel.Text = "Loading skilldata-e.txt..."; while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); if (!string.IsNullOrEmpty(sTemp) & sTemp.StartsWith("//") == false) { // skillname_begin id=3 level=1 name=[Power Strike] description=[Gathers power for a fierce strike. Used when equipped with a sword or blunt weapon. Over-hit is possible. Power 25.] desc_add1=[none] desc_add2=[none] skillname_end iId = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "id")); iLevel = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "level")); aSkill[iId, iLevel].desc = Libraries.GetNeedParamFromStr(sTemp, "name"); } ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); StatusStrip.Update(); } ToolStripProgressBar.Value = 0; inFile.Close(); this.Refresh(); // ---- Loading 'Skillgrp.txt' ---- inFile = new System.IO.StreamReader(sSkillGrpFile, true); ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); ToolStripStatusLabel.Text = "Loading Skillgrp.txt"; long sTempVar; while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); if (!string.IsNullOrEmpty(sTemp) & sTemp.StartsWith("//") == false) { iId = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "skill_id")); iLevel = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "skill_level")); if (iId >= 27000 | iLevel >= 800) { MessageBox.Show("Array out:" + Constants.vbNewLine + sTemp); ToolStripProgressBar.Value = 0; inFile.Close(); return; } aSkill[iId, iLevel].type = Conversions.ToShort(Libraries.GetNeedParamFromStr(sTemp, "oper_type")); aSkill[iId, iLevel].is_magic = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "is_magic")); aSkill[iId, iLevel].mp_consume2 = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "mp_consume")); aSkill[iId, iLevel].hp_consume = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "hp_consume")); sTempVar = Conversions.ToLong(Libraries.GetNeedParamFromStr(sTemp, "cast_range")); if (sTempVar > 1000000) { sTempVar = -1; } aSkill[iId, iLevel].cast_range = Conversions.ToInteger(sTempVar); aSkill[iId, iLevel].hit_time = Conversions.ToDouble(Libraries.GetNeedParamFromStr(sTemp, "hit_time")); aSkill[iId, iLevel].debuff = Conversions.ToShort(Libraries.GetNeedParamFromStr(sTemp, "debuff")); if (aSkill[iId, iLevel].debuff == 4) { aSkill[iId, iLevel].is_magic = 2; } if (aSkill[iId, iLevel].debuff == 3) { aSkill[iId, iLevel].debuff = Conversions.ToShort(1); } else { aSkill[iId, iLevel].debuff = Conversions.ToShort(0); } // aSkill(iId, iLevel).is_ench = CShort(Libraries.GetNeedParamFromStr(sTemp, "is_ench")) aSkill[iId, iLevel].ench_skill_id = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "ench_skill_id")); } ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); StatusStrip.Update(); } ToolStripProgressBar.Value = 0; inFile.Close(); this.Refresh(); string sTemp2; if (System.IO.File.Exists(sSkillDataFile) == true) { System.IO.File.Copy(sSkillDataFile, sSkillDataFile + ".bak", true); } var outFile = new System.IO.StreamWriter(sSkillDataFile, false, System.Text.Encoding.Unicode, 1); var outEncFile = new System.IO.StreamWriter(sSkillEncFile, false, System.Text.Encoding.Unicode, 1); // skill_begin skill_name=[s_long_range_shot1] /* [롱 샷] */ skill_id=113 level=1 operate_type=P magic_level=20 effect={{p_attack_range;{bow};200;diff}} skill_end // skillgrp_begin skill_id=3 skill_level=1 oper_type=0 mp_consume=10 cast_range=40 hit_time=1.080000 is_magic=0 desc=[] hp_consume=0 skillgrp_end // skillenchantdata.txt // enchant_skill_begin original_skill = [s_hate192] route_id = 1 enchant_id = 1 skill_level = 101 exp = 3060000 sp = 306000 item_needed = {{[codex_of_giant];1}} prob_76 = 82 prob_77 = 92 prob_78 = 97 enchant_skill_end ToolStripProgressBar.Maximum = 10000; ToolStripStatusLabel.Text = "Saving new skilldata.txt..."; int iRouteId = 0; int iEnchId = 0; string sEnchName = ""; for (iId = 0; iId <= 10000; iId++) { for (iLevel = 0; iLevel <= 700; iLevel++) { if (aSkill[iId, iLevel].desc != null) { sTemp = ""; if (Shema1RadioButton.Checked == true) { // shema1 // NPC Spinning Slasher sTemp2 = aSkill[iId, iLevel].desc.Trim().ToLower().Replace(" - ", "_").Replace("'", "").Replace(":", "").Replace(".", "").Replace(",", ""); sTemp2 = sTemp2.Replace("%", "").Replace("!", "").Replace("&", "").Replace("-", "_"); sTemp2 = sTemp2.Replace(" ", "_").Replace(" ", "_").Replace("[", "").Replace("]", "").Replace("_of_", "_").Replace("_the_", "_"); sTemp2 = sTemp2.Replace("(", "").Replace(")", "_").Replace("/", "_"); sTemp2 = "s_" + sTemp2; // & iLevel // Fix for first level of skill with more them 1 level if (iLevel == 1) { // s_npc_selfdamage_shield // s_npc_self_damage_shield if (string.IsNullOrEmpty(aSkill[iId, iLevel + 1].desc) | aSkill[iId, iLevel + 1].desc == null) { // this skill first and alone in this skill_id if (Array.IndexOf(aSkillName, sTemp2) == -1) { sTemp2 = sTemp2; } else { sTemp2 = sTemp2 + "_" + Conversions.ToString(iId); // s_dragon3 } Array.Resize(ref aSkillName, aSkillName.Length + 1); aSkillName[aSkillName.Length - 1] = sTemp2; } else { if (Array.IndexOf(aSkillName, sTemp2 + Conversions.ToString(iLevel)) == -1) { sTemp2 = sTemp2 + Conversions.ToString(iLevel); } else { sTemp2 = sTemp2 + "_" + Conversions.ToString(iId) + "_" + Conversions.ToString(iLevel); // s_triple_slash3433_1 } Array.Resize(ref aSkillName, aSkillName.Length + 1); aSkillName[aSkillName.Length - 1] = sTemp2; } } else { // Dublicate fix if (Array.IndexOf(aSkillName, sTemp2 + Conversions.ToString(iLevel)) == -1) { sTemp2 = sTemp2 + Conversions.ToString(iLevel); } else { // sTemp2 = "s_none_" & iId & "_" & iLevel ' s_none_3433_1 sTemp2 = sTemp2 + "_" + Conversions.ToString(iId) + "_" + Conversions.ToString(iLevel); // s_triple_slash3433_1 } Array.Resize(ref aSkillName, aSkillName.Length + 1); aSkillName[aSkillName.Length - 1] = sTemp2; } } else { sTemp2 = "s_" + Conversions.ToString(iId) + "_" + Conversions.ToString(iLevel); } // --- Exist skill_pch base --- if (ExistPchCheckBox.Checked == true) { if (aSkill[iId, iLevel].name == null) { aSkill[iId, iLevel].name = "[" + sTemp2 + "]"; } //else // int ajshj = 0; } else { aSkill[iId, iLevel].name = "[" + sTemp2 + "]"; } if (AllPassiveCheckBox.Checked == true) { // Generate all like (P)assive skill aSkill[iId, iLevel].type = Conversions.ToShort(2); } // --- Common Header for all types sTemp = sTemp + "skill_begin" + Constants.vbTab; sTemp = sTemp + "skill_name=" + aSkill[iId, iLevel].name + Constants.vbTab; if (DontDescCheckBox.Checked == false) { sTemp = sTemp + "/* " + aSkill[iId, iLevel].desc + " */" + Constants.vbTab; } sTemp = sTemp + "skill_id=" + Conversions.ToString(iId) + Constants.vbTab; sTemp = sTemp + "level=" + Conversions.ToString(iLevel) + Constants.vbTab; switch (aSkill[iId, iLevel].type) { case var @case when @case == Conversions.ToShort(0 ): { sTemp = sTemp + "operate_type=A1" + Constants.vbTab; break; } case var case1 when case1 == Conversions.ToShort(1 ): { sTemp = sTemp + "operate_type=A2" + Constants.vbTab; break; } case var case2 when case2 == Conversions.ToShort(2 ): { sTemp = sTemp + "operate_type=P" + Constants.vbTab; break; } case var case3 when case3 == Conversions.ToShort(3 ): { sTemp = sTemp + "operate_type=T" + Constants.vbTab; break; } default: { MessageBox.Show("Unknown operate_type=: " + Conversions.ToString(aSkill[iId, iLevel].type)); sTemp = sTemp + "operate_type=P" + Constants.vbTab; break; } } sTemp = sTemp + "magic_level=1" + Constants.vbTab; sTemp = sTemp + "effect={}" + Constants.vbTab; // --- End of Common Header of skill // sTemp = sTemp & "=" & aSkill(iId, iLevel).desc & vbTab switch (aSkill[iId, iLevel].type) { case var case4 when case4 == Conversions.ToShort(0 // A1 ): { // is_magic = 1 sTemp = sTemp + "is_magic=" + Conversions.ToString(aSkill[iId, iLevel].is_magic) + Constants.vbTab; if (aSkill[iId, iLevel].is_magic == 0) { // hp_consume = 7 // mp_consume1 = 7 iTemp = 0; } else { iTemp = Conversions.ToInteger(aSkill[iId, iLevel].mp_consume2 / (double)5); sTemp = sTemp + "mp_consume1=" + Conversions.ToString(iTemp) + Constants.vbTab; } // mp_consume2 = 28 sTemp = sTemp + "mp_consume2=" + Conversions.ToString(aSkill[iId, iLevel].mp_consume2 - iTemp) + Constants.vbTab; if (aSkill[iId, iLevel].hp_consume != default(int)) { // hp_consume = 7 sTemp = sTemp + "hp_consume=" + Conversions.ToString(aSkill[iId, iLevel].hp_consume) + Constants.vbTab; } // cast_range = -1 sTemp = sTemp + "cast_range=" + Conversions.ToString(aSkill[iId, iLevel].cast_range) + Constants.vbTab; // effective_range = -1 if (aSkill[iId, iLevel].cast_range == -1) { sTemp = sTemp + "effective_range=-1" + Constants.vbTab; } else { sTemp = sTemp + "effective_range=" + Conversions.ToString(Conversions.ToInteger(aSkill[iId, iLevel].cast_range * 1.5)) + Constants.vbTab; } // skill_hit_time = 4 sTemp = sTemp + "skill_hit_time=" + Conversions.ToString(aSkill[iId, iLevel].hit_time) + Constants.vbTab; // skill_cool_time = 0 sTemp = sTemp + "skill_cool_time=0" + Constants.vbTab; // skill_hit_cancel_time = 0.5 sTemp = sTemp + "skill_hit_cancel_time=0" + Constants.vbTab; // reuse_delay = 6 sTemp = sTemp + "reuse_delay=" + Conversions.ToString(aSkill[iId, iLevel].hit_time) + Constants.vbTab; // attribute = attr_none sTemp = sTemp + "attribute=attr_none" + Constants.vbTab; // effect_point = 379 sTemp = sTemp + "effect_point=0" + Constants.vbTab; if (aSkill[iId, iLevel].cast_range == -1) { // target_type = self sTemp = sTemp + "target_type=self" + Constants.vbTab; } else { // target_type = self sTemp = sTemp + "target_type=target" + Constants.vbTab; } // affect_scope = single sTemp = sTemp + "affect_scope=single" + Constants.vbTab; // affect_limit = {0;0} sTemp = sTemp + "affect_limit={0;0}" + Constants.vbTab; // next_action = none sTemp = sTemp + "next_action=none" + Constants.vbTab; // ride_state = {@ride_none;@ride_wind;@ride_star;@ride_twilight} if (aSkill[iId, iLevel].is_magic == 0) { sTemp = sTemp + "ride_state={@ride_none}" + Constants.vbTab; } else { sTemp = sTemp + "ride_state={@ride_none;@ride_wind;@ride_star;@ride_twilight}" + Constants.vbTab; } break; } case var case5 when case5 == Conversions.ToShort(1 // A2,A3 ): { // is_magic = 1 sTemp = sTemp + "is_magic=" + Conversions.ToString(aSkill[iId, iLevel].is_magic) + Constants.vbTab; // mp_consume2 = 28 sTemp = sTemp + "mp_consume2=" + Conversions.ToString(aSkill[iId, iLevel].mp_consume2) + Constants.vbTab; // cast_range = -1 sTemp = sTemp + "cast_range=" + Conversions.ToString(aSkill[iId, iLevel].cast_range) + Constants.vbTab; // effective_range = -1 if (aSkill[iId, iLevel].cast_range == -1) { sTemp = sTemp + "effective_range=-1" + Constants.vbTab; } else { sTemp = sTemp + "effective_range=" + Conversions.ToString(Conversions.ToInteger(aSkill[iId, iLevel].cast_range * 1.5)) + Constants.vbTab; } // skill_hit_time = 4 sTemp = sTemp + "skill_hit_time=" + Conversions.ToString(aSkill[iId, iLevel].hit_time) + Constants.vbTab; // skill_cool_time = 0 sTemp = sTemp + "skill_cool_time=0" + Constants.vbTab; // skill_hit_cancel_time = 0.5 sTemp = sTemp + "skill_hit_cancel_time=0" + Constants.vbTab; // reuse_delay = 80 sTemp = sTemp + "reuse_delay=80" + Constants.vbTab; // activate_rate = -1 sTemp = sTemp + "activate_rate=80" + Constants.vbTab; // lv_bonus_rate = 0 sTemp = sTemp + "lv_bonus_rate=0" + Constants.vbTab; // basic_property = none sTemp = sTemp + "basic_property=none" + Constants.vbTab; // abnormal_time = 15 sTemp = sTemp + "abnormal_time=15" + Constants.vbTab; // abnormal_lv = 1 sTemp = sTemp + "abnormal_lv=0" + Constants.vbTab; // abnormal_type = speed_up_special sTemp = sTemp + "abnormal_type=none" + Constants.vbTab; // attribute = attr_none sTemp = sTemp + "attribute=attr_none" + Constants.vbTab; // effect_point = 204 sTemp = sTemp + "effect_point=0" + Constants.vbTab; if (aSkill[iId, iLevel].cast_range == -1) { // target_type = self sTemp = sTemp + "target_type=self" + Constants.vbTab; } else { // target_type = self sTemp = sTemp + "target_type=target" + Constants.vbTab; } // affect_scope = single sTemp = sTemp + "affect_scope=single" + Constants.vbTab; // affect_limit = {0;0} sTemp = sTemp + "affect_limit={0;0}" + Constants.vbTab; // next_action = none sTemp = sTemp + "next_action=none" + Constants.vbTab; // debuff = 0 sTemp = sTemp + "debuff=" + Conversions.ToString(aSkill[iId, iLevel].debuff) + Constants.vbTab; // extra_eff=1 // sTemp = sTemp & "debuff=0" & vbTab 'extra_eff=1 // ride_state = {@ride_none;@ride_wind;@ride_star;@ride_twilight} if (aSkill[iId, iLevel].is_magic == 0) { sTemp = sTemp + "ride_state={@ride_none}" + Constants.vbTab; } else { sTemp = sTemp + "ride_state={@ride_none;@ride_wind;@ride_star;@ride_twilight}" + Constants.vbTab; } break; } case var case6 when case6 == Conversions.ToShort(2 // P ): { break; } case var case7 when case7 == Conversions.ToShort(3 // T ): { // mp_consume1 = 2 sTemp = sTemp + "mp_consume1=" + Conversions.ToString(aSkill[iId, iLevel].mp_consume2) + Constants.vbTab; // reuse_delay = 0 sTemp = sTemp + "reuse_delay=0" + Constants.vbTab; // target_type = none sTemp = sTemp + "target_type=none" + Constants.vbTab; // next_action = none sTemp = sTemp + "next_action=none" + Constants.vbTab; // ride_state = {@ride_none} sTemp = sTemp + "ride_state={@ride_none}" + Constants.vbTab; break; } default: { break; } } sTemp = sTemp + "skill_end"; outFile.WriteLine(sTemp); sTemp = ""; // ------------ SkillEnchant Module -------------- if (aSkill[iId, iLevel].ench_skill_id > 0) { // enchant_skill_begin sTemp = "enchant_skill_begin" + Constants.vbTab; // original_skill = [s_hate192] // FIIXXXX check sTemp = sTemp + "original_skill=" + aSkill[iId, aSkill[iId, iLevel].ench_skill_id].name + Constants.vbTab; // route_id = 1 if (Conversions.Str(iLevel).EndsWith("01") == true) { // If aSkill(iId, iLevel - 1).ench_skill_id = 0 Then // this first level for enchant // If iRouteId = 1 Then iRouteId = 3 Else iRouteId = 1 iEnchId = 0; if ((sEnchName ?? "") != (aSkill[iId, aSkill[iId, iLevel].ench_skill_id].name ?? "")) { iRouteId = 1; sEnchName = aSkill[iId, aSkill[iId, iLevel].ench_skill_id].name; } } iRouteId = Conversions.ToInteger(iLevel / (double)100); sTemp = sTemp + "route_id=" + Conversions.ToString(iRouteId) + Constants.vbTab; // enchant_id = 1 iEnchId += 1; sTemp = sTemp + "enchant_id=" + Conversions.ToString(iEnchId) + Constants.vbTab; // skill_level = 101 sTemp = sTemp + "skill_level=" + Conversions.ToString(iLevel) + Constants.vbTab; if (aSkill[iId, iLevel].ench_skill_id == 1 & aSkill[iId, Conversions.ToInteger(iLevel / (double)100) * 100 + 30].ench_skill_id == 0) { // exp = 3060000 sTemp = sTemp + "exp=37800000" + Constants.vbTab; // sp = 306000 sTemp = sTemp + "sp=3780000" + Constants.vbTab; } else { // exp = 3060000 sTemp = sTemp + "exp=5280000" + Constants.vbTab; // sp = 306000 sTemp = sTemp + "sp=528000" + Constants.vbTab; } // item_needed = {{[codex_of_giant];1}} if (iEnchId == 1) { // If aSkill(iId, iLevel - 1).ench_skill_id = 0 Then // If Str(iLevel).EndsWith("01") = True Then ' level=201 =route2 = start route with book // this first level for enchant sTemp = sTemp + "item_needed={{[codex_of_giant];1}}" + Constants.vbTab; } else { sTemp = sTemp + "item_needed={}" + Constants.vbTab; } if (aSkill[iId, iLevel].ench_skill_id == 1 & aSkill[iId, Conversions.ToInteger(iLevel / (double)100) * 100 + 30].ench_skill_id == 0) { // prob_79=97 prob_80=98 prob_81=99 prob_82=99 prob_83=99 prob_84=99 prob_85=99 // prob_76 = 82 sTemp = sTemp + "prob_76=" + Conversions.ToString(EnchantChance1[iEnchId + 8]) + Constants.vbTab; // prob_77 = 92 sTemp = sTemp + "prob_77=" + Conversions.ToString(EnchantChance1[iEnchId + 7]) + Constants.vbTab; // prob_78 = 97 sTemp = sTemp + "prob_78=" + Conversions.ToString(EnchantChance1[iEnchId + 6]) + Constants.vbTab; // prob_79 = 97 sTemp = sTemp + "prob_79=" + Conversions.ToString(EnchantChance1[iEnchId + 5]) + Constants.vbTab; // prob_80 = 98 sTemp = sTemp + "prob_80=" + Conversions.ToString(EnchantChance1[iEnchId + 4]) + Constants.vbTab; // prob_81 = 99 sTemp = sTemp + "prob_81=" + Conversions.ToString(EnchantChance1[iEnchId + 3]) + Constants.vbTab; // prob_82 = 99 sTemp = sTemp + "prob_82=" + Conversions.ToString(EnchantChance1[iEnchId + 2]) + Constants.vbTab; // prob_83 = 99 sTemp = sTemp + "prob_83=" + Conversions.ToString(EnchantChance1[iEnchId + 1]) + Constants.vbTab; // prob_84 = 99 sTemp = sTemp + "prob_84=" + Conversions.ToString(EnchantChance1[iEnchId]) + Constants.vbTab; // prob_85 = 99 sTemp = sTemp + "prob_85=" + Conversions.ToString(EnchantChance1[iEnchId - 1]) + Constants.vbTab; } else { // prob_79=97 prob_80=98 prob_81=99 prob_82=99 prob_83=99 prob_84=99 prob_85=99 // prob_76 = 82 sTemp = sTemp + "prob_76=" + Conversions.ToString(EnchantChance[iEnchId + 8]) + Constants.vbTab; // prob_77 = 92 sTemp = sTemp + "prob_77=" + Conversions.ToString(EnchantChance[iEnchId + 7]) + Constants.vbTab; // prob_78 = 97 sTemp = sTemp + "prob_78=" + Conversions.ToString(EnchantChance[iEnchId + 6]) + Constants.vbTab; // prob_79 = 97 sTemp = sTemp + "prob_79=" + Conversions.ToString(EnchantChance[iEnchId + 5]) + Constants.vbTab; // prob_80 = 98 sTemp = sTemp + "prob_80=" + Conversions.ToString(EnchantChance[iEnchId + 4]) + Constants.vbTab; // prob_81 = 99 sTemp = sTemp + "prob_81=" + Conversions.ToString(EnchantChance[iEnchId + 3]) + Constants.vbTab; // prob_82 = 99 sTemp = sTemp + "prob_82=" + Conversions.ToString(EnchantChance[iEnchId + 2]) + Constants.vbTab; // prob_83 = 99 sTemp = sTemp + "prob_83=" + Conversions.ToString(EnchantChance[iEnchId + 1]) + Constants.vbTab; // prob_84 = 99 sTemp = sTemp + "prob_84=" + Conversions.ToString(EnchantChance[iEnchId]) + Constants.vbTab; // prob_85 = 99 sTemp = sTemp + "prob_85=" + Conversions.ToString(EnchantChance[iEnchId - 1]) + Constants.vbTab; } // enchant_skill_end sTemp = sTemp + "enchant_skill_end"; // Checking for error in skillgrp. Example, enchskill_level=9 but last skilllevel=4 if (string.IsNullOrEmpty(aSkill[iId, aSkill[iId, iLevel].ench_skill_id].name) | aSkill[iId, aSkill[iId, iLevel].ench_skill_id].name == null) { sTemp = "//ERR: enchant skill_id:" + Conversions.ToString(iId) + " level:" + Conversions.ToString(iLevel) + Constants.vbTab + sTemp; } outEncFile.WriteLine(sTemp); sTemp = ""; } } } ToolStripProgressBar.Value = iId; StatusStrip.Update(); } outFile.Close(); outEncFile.Close(); ToolStripProgressBar.Value = 0; ToolStripStatusLabel.Text = "Complete"; MessageBox.Show("Complete"); }
private void StartButton_Click(object sender, EventArgs e) { // Attention Dialogs if (CheckedListBox.CheckedItems.Count == 0) { MessageBox.Show("Nothing analysing. Select and try again.", "Nothing Analysing", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (CheckedListBox.CheckedItems.IndexOf("undying, can_be_attacked") != -1) { if ((int)MessageBox.Show("Attention! You are selected fix on Undying. Some Quest mobs must be Invulerable. Check logs after finishing fixing." + Constants.vbNewLine + "Continue fixing?", "undying Attention", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == (int)DialogResult.Cancel) { return; } } // If UnsowingCheckBox.Checked = True Then // If MessageBox.Show("Attention! You are selected fix on Unsowing. Some mobs unavailable for sowing. Check logs after finishing fixing." & vbNewLine & "Continue fixing?", "unsowing Attention", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.Cancel Then Exit Sub // End If if (CheckedListBox.CheckedItems.IndexOf("slot_rhand, base_attack_type") != -1) { if (LoadItemData() == false) { MessageBox.Show("Error loading itemdata information. Fix problem and try again", "Error loading itemdata", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // Dim inFile As New System.IO.StreamReader(OpenFileDialog.FileName & ".bak", System.Text.Encoding.Default, True, 1) System.IO.StreamReader inFile; string sTemp; string sTemp2; string[] aTemp; string[] aTemp2; int iTemp; double dTemp; var aQuestNpc = new string[1]; var aRace = new[] { "animal", "dragon", "fairy", "etc", "angel", "construct", "creature", "human", "humanoid", "beast", "undead", "elemental", "demonic", "siege_weapon", "divine", "bug", "plant", "giant", "kamael", "elf", "dwarf", "darkelf", "orc", "castle_guard", "mercenary" }; var aRaceSkill = new[] { "s_race_animals", "s_race_dragons", "s_race_fairies", "s_race_others", "s_race_angels", "s_race_magic_creatures", "s_race_unknown_creature", "s_race_humans", "s_race_humanoids", "s_race_beasts", "s_race_undead", "s_race_spirits", "s_race_demons", "s_race_siege_weapons", "s_race_divine", "s_race_bugs", "s_race_plants", "s_race_giants", "s_race_kamaels", "s_race_elves", "s_race_dwarves", "s_race_dark_elves", "s_race_orcs", "s_race_defending_army", "s_race_mercenaries" }; if (CheckedListBox.CheckedItems.IndexOf("unsowing") != -1) { // Quest Mobs loader string sNpcNameE = "npcname-e.txt"; if (System.IO.File.Exists(sNpcNameE) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage II client text file (npcname-e.txt)|npcname-e.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sNpcNameE = OpenFileDialog.FileName; } // NpcName-e. Finding ' description=[Quest Monster] ' inFile = new System.IO.StreamReader(sNpcNameE, System.Text.Encoding.Default, true, 1); ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); ToolStripStatusLabel1.Text = "Loading npcname-e.txt..."; StatusStrip.Update(); while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine(); ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); if (!string.IsNullOrEmpty(sTemp) & sTemp.StartsWith("//") == false) { if (Strings.InStr(sTemp, "Quest Monster") != 0) { // npc_begin(0) pet(1) 12077(2) [pet_wolf_a](3) level=15(4) aTemp = sTemp.Split((char)9); iTemp = aQuestNpc.Length; Array.Resize(ref aQuestNpc, iTemp + 1); aQuestNpc[iTemp - 1] = aTemp[1].Remove(0, Strings.InStr(aTemp[1], "=")).Trim(); } } } inFile.Close(); ToolStripProgressBar.Value = 0; } // End of reading quest mobs OpenFileDialog.FileName = "npcdata.txt"; // If System.IO.File.Exists("npcdata.txt") = False Then OpenFileDialog.Filter = "Lineage II server npc config|npcdata*.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } // End If System.IO.File.Copy(OpenFileDialog.FileName, OpenFileDialog.FileName + ".bak", true); inFile = new System.IO.StreamReader(OpenFileDialog.FileName + ".bak", System.Text.Encoding.Default, true, 1); var outFile = new System.IO.StreamWriter(OpenFileDialog.FileName, false, System.Text.Encoding.Unicode, 1); var outLog = new System.IO.StreamWriter(OpenFileDialog.FileName + "_scriptCheck.log", true, System.Text.Encoding.Unicode, 1); outLog.WriteLine("L2ScriptMaker: NpcData Analyser and Fixer."); outLog.WriteLine(Conversions.ToString(DateAndTime.Now) + " Start" + Constants.vbNewLine); var AttackNpc = new[] { "warrior", "herb_warrior", "boss", "zzoldagu", "summon", "pet", "treasure", "siege_unit", "commander", "castle_gate", "temptrainer", "siege_weapon", "mercenary" }; var AgroRangeNpc = new[] { "object", "summon", "pet", "treasure", "citizen", "merchant", "warehouse_keeper", "guild_master", "guild_coach", "blacksmith", "package_keeper" }; // Hellbound Boss's - Derek, Hellinark, Keltas, Typhoon, Archangel [29021] (Baium), 12532-12534 (Dietrich, Mikhail, Gustav), 12539-12543 (Beast Farm Boss's), "Scarlet of Halisha" (form1) var iSpecialBoss = new[] { 18465, 22326, 22341, 25539, 29021, 12532, 12533, 12534, 12539, 12540, 12541, 12542, 12543, 29045, 29046 }; // Skill Loaging END // Dim aSkillSymbol() As String = {";", "]"} '{[DDMagic]=@s_blood_sucking6} 'npc_ai={} var aSkills = new string[1]; int iTempPos1; int iTempPos2; string sTempSkillName; if (CheckedListBox.CheckedItems.IndexOf("npc active skill") != -1) { OpenFileDialog.FileName = "skill_pch.txt"; if (System.IO.File.Exists("skill_pch.txt") == false) { // OpenFileDialog.FileName = "skilldata.txt" OpenFileDialog.Filter = "Lineage II server skill config (skill_pch.txt)|skill_pch.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } } // ---- Loading 'Skilldata.txt' ---- var inSkillFile = new System.IO.StreamReader(OpenFileDialog.FileName, System.Text.Encoding.Default, true, 1); ToolStripProgressBar.Maximum = Conversions.ToInteger(inSkillFile.BaseStream.Length); // ProgressBar.Text = "Loading skilldata.txt..." while (inSkillFile.EndOfStream != true) { sTemp = inSkillFile.ReadLine().Trim(); if (!string.IsNullOrEmpty(sTemp) & sTemp.StartsWith("//") == false) { // skill_begin skill_name = [s_quiver_of_arrows_a] /* [?? ?? ???? - A????] */ skill_id = 323 level = 1 operate_type = A1 magic_level = 66 effect = {{i_restoration_random;{{{{[mithril_arrow];700}};30};{{{[mithril_arrow];1400}};50};{{{[mithril_arrow];2800}};20}}}} is_magic = 1 mp_consume1 = 366 mp_consume2 = 0 item_consume = {[crystal_a];1} cast_range = -1 effective_range = -1 skill_hit_time = 3 skill_cool_time = 0 skill_hit_cancel_time = 0.5 reuse_delay = 1800 attribute = attr_none effect_point = 0 target_type = self affect_scope = single affect_limit = {0;0} next_action = none ride_state = {@ride_none;@ride_wind;@ride_star;@ride_twilight} skill_end // skill_begin skill_name = [s_summon_cp_potion] /* [?? CP ??] */ skill_id = 1324 level = 1 operate_type = A1 magic_level = -1 effect = {{i_restoration;[adv_cp_potion];20}} is_magic = 1 mp_consume1 = 412 mp_consume2 = 0 item_consume = {[soul_ore];50} cast_range = -1 effective_range = -1 skill_hit_time = 20 skill_cool_time = 0 skill_hit_cancel_time = 0.5 reuse_delay = 1800 attribute = attr_none effect_point = 0 target_type = self affect_scope = single affect_limit = {0;0} next_action = none ride_state = {@ride_none;@ride_wind;@ride_star;@ride_twilight} skill_end iTemp = aSkills.Length; Array.Resize(ref aSkills, iTemp + 1); // aSkills(iTemp - 1) = Libraries.GetNeedParamFromStr(sTemp, "skill_name").Replace("[", "").Replace("]", "") sTemp2 = sTemp.Substring(0, Strings.InStr(sTemp, "=") - 1).Trim().Replace("[", "").Replace("]", ""); aSkills[iTemp - 1] = sTemp2; } ToolStripProgressBar.Value = Conversions.ToInteger(inSkillFile.BaseStream.Position); } ToolStripProgressBar.Value = 0; inSkillFile.Close(); this.Refresh(); StatusStrip.Update(); } // Skill Loaging END ToolStripProgressBar.Value = 0; ToolStripProgressBar.Maximum = Conversions.ToInteger(inFile.BaseStream.Length); ToolStripStatusLabel1.Text = "Fixing..."; this.Update(); while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine().Trim(); ToolStripProgressBar.Value = Conversions.ToInteger(inFile.BaseStream.Position); if (!string.IsNullOrEmpty(sTemp) & sTemp.StartsWith("//") == false) { // npc_begin zzoldagu 12545 [pirates_zombie_b] level=57 // slot_rhand=[mithril_dagger] // base_attack_type=dagger aTemp = sTemp.Split((char)9); // Checking: acquire_exp_rate, acquire_sp if (CheckedListBox.CheckedItems.IndexOf("acquire_exp_rate, acquire_sp") != -1) { dTemp = Conversions.ToDouble(Libraries.GetNeedParamFromStr(sTemp, "acquire_exp_rate")); sTemp2 = aTemp[1]; if ((aTemp[1] ?? "") == "boss") { if (dTemp < 100) { sTemp = Libraries.SetNeedParamToStr(sTemp, "acquire_exp_rate", Conversions.ToString(dTemp * 100)); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: acquire_exp_rate->" + Conversions.ToString(dTemp * 100)); } } if ((aTemp[1] ?? "") != "warrior" & (aTemp[1] ?? "") != "herb_warrior" & (aTemp[1] ?? "") != "boss") { if (dTemp > 0) { sTemp = Libraries.SetNeedParamToStr(sTemp, "acquire_exp_rate", "0"); sTemp = Libraries.SetNeedParamToStr(sTemp, "acquire_sp", "0"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: acquire_exp_rate->0, acquire_sp->0"); } } } // Checking: acquire_exp_rate END // Checking: Unsowing (unsowing=0) // race=castle_guard if (CheckedListBox.CheckedItems.IndexOf("unsowing") != -1) { sTemp2 = Libraries.GetNeedParamFromStr(sTemp, "race"); if ((Libraries.GetNeedParamFromStr(sTemp, "unsowing") ?? "") == "0") { if ((aTemp[1] ?? "") == "warrior" | (aTemp[1] ?? "") == "herb_warrior") { // Exception for Castle Guard // npc_begin(0) pet(1) 12077(2) [pet_wolf_a](3) level=15(4) aTemp = sTemp.Split((char)9); if ((sTemp2 ?? "") == "castle_guard" | (sTemp2 ?? "") == "mercenary" | Array.IndexOf(aQuestNpc, aTemp[2]) != -1) { sTemp = Libraries.SetNeedParamToStr(sTemp, "unsowing", "1"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: unsowing->1"); } else // Attention! if (NoWarriorCheckBox.Checked == false) { // If UnsowingCheckBox.Checked = True Then if ((Libraries.GetNeedParamFromStr(sTemp, "unsowing") ?? "") == "1") { sTemp = Libraries.SetNeedParamToStr(sTemp, "unsowing", "0"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: unsowing->0"); } } } else if ((Libraries.GetNeedParamFromStr(sTemp, "unsowing") ?? "") == "0") { sTemp = Libraries.SetNeedParamToStr(sTemp, "unsowing", "1"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: unsowing->1"); } } else { } } // Checking: Unsowing END // Checking: Weapon Type (slot_rhand, base_attack_type) if (CheckedListBox.CheckedItems.IndexOf("slot_rhand, base_attack_type") != -1) { sTemp2 = Libraries.GetNeedParamFromStr(sTemp, "slot_rhand"); if ((sTemp2 ?? "") == "[]") { if ((Libraries.GetNeedParamFromStr(sTemp, "base_attack_type") ?? "") != "fist") { // sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "fist") // base_attack_type=fist base_attack_range=40 base_damage_range={0;0;80;120} base_rand_dam=7 sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "fist"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_damage_range", "{0;0;80;120}"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_rand_dam", "7"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_critical", "4"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: " + sTemp2 + " base_attack_type -> fist"); } } else { iTemp = Array.IndexOf(aItemPchName, sTemp2); if (iTemp == -1) { outLog.WriteLine("Unknown weapon:" + aTemp[1] + Constants.vbTab + Constants.vbTab + sTemp2 + Constants.vbTab + "Npc: " + aTemp[2] + Constants.vbTab + aTemp[3]); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "fist"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_damage_range", "{0;0;80;120}"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_rand_dam", "7"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_critical", "4"); } else if ((Libraries.GetNeedParamFromStr(sTemp, "base_attack_type") ?? "") != (aItemType[iTemp] ?? "")) { switch (aItemType[iTemp]) { case "dual": { // base_attack_type=dual base_attack_range=40 base_damage_range={0;0;80;120} base_rand_dam=30 sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "dual"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_damage_range", "{0;0;80;120}"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_rand_dam", "30"); break; } case "pole": { // base_attack_type=pole base_attack_range=80 base_damage_range={0;0;300;120} base_rand_dam=30 sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "pole"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "80"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_damage_range", "{0;0;300;120}"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_rand_dam", "30"); break; } case "bow": { // base_attack_type=bow base_attack_range=500 base_damage_range={0;0;10;0} base_rand_dam=5 sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "bow"); if ((Libraries.GetNeedParamFromStr(sTemp, "race") ?? "") == "castle_guard") { sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "1100"); } else { sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "500"); } sTemp = Libraries.SetNeedParamToStr(sTemp, "base_damage_range", "{0;0;10;0}"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_rand_dam", "5"); break; } case "dagger": { // base_attack_type=dagger base_attack_range=40 base_damage_range={0;0;80;120} base_rand_dam=10 sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "dagger"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_damage_range", "{0;0;80;120}"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_rand_dam", "10"); break; } case "sword": { // base_attack_type=sword base_attack_range=40 base_damage_range={0;0;80;120} base_rand_dam=30 sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "dagger"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_damage_range", "{0;0;80;120}"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_rand_dam", "30"); break; } case "blunt": { // base_attack_type=blunt base_attack_range=40 base_damage_range={0;0;80;120} base_rand_dam=50 sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "dagger"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_damage_range", "{0;0;80;120}"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_rand_dam", "50"); break; } default: { // base_attack_type=fist base_attack_range=40 base_damage_range={0;0;80;120} base_rand_dam=7 sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", "fist"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_damage_range", "{0;0;80;120}"); sTemp = Libraries.SetNeedParamToStr(sTemp, "base_rand_dam", "7"); break; } } // check for fishingrod // sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_type", aItemType(iTemp)) outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: " + sTemp2 + " base_attack_type -> " + aItemType[iTemp]); } } } // Checking: Weapon Type END // Checking: no_sleep_mode (no_sleep_mode) if (CheckedListBox.CheckedItems.IndexOf("no_sleep_mode") != -1) { switch (Libraries.GetNeedParamFromStr(sTemp, "no_sleep_mode")) { case "0": { if ((aTemp[1] ?? "") == "boss" | (aTemp[1] ?? "") == "zzoldagu") { sTemp = Libraries.SetNeedParamToStr(sTemp, "no_sleep_mode", "1"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: no_sleep_mode->1"); } break; } case "1": { if ((aTemp[1] ?? "") != "boss" & (aTemp[1] ?? "") != "zzoldagu") { sTemp = Libraries.SetNeedParamToStr(sTemp, "undying", "0"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: no_sleep_mode->0"); } break; } } } // Checking: no_sleep_mode END // Checking: agro_range (agro_range) if (CheckedListBox.CheckedItems.IndexOf("agro_range") != -1) { switch (Libraries.GetNeedParamFromStr(sTemp, "agro_range")) { case "0": { if (Array.IndexOf(AgroRangeNpc, aTemp[1]) == -1) { sTemp = Libraries.SetNeedParamToStr(sTemp, "agro_range", "1000"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: agro_range->1000"); } break; } default: { if (Array.IndexOf(AgroRangeNpc, aTemp[1]) != -1) { sTemp = Libraries.SetNeedParamToStr(sTemp, "agro_range", "0"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: agro_range->0"); } break; } } } // Checking: agro_range END // Checking: Undying (undying, can_be_attacked) if (CheckedListBox.CheckedItems.IndexOf("undying, can_be_attacked") != -1) { if (Array.IndexOf(AttackNpc, aTemp[1]) != -1) { // This a No Peace NPC. if ((aTemp[1] ?? "") == "warrior" | (aTemp[1] ?? "") == "herb_warrior") { if (NoWarriorUndCheckBox.Checked == false) { if ((Libraries.GetNeedParamFromStr(sTemp, "undying") ?? "") == "1") { sTemp = Libraries.SetNeedParamToStr(sTemp, "undying", "0"); sTemp = Libraries.SetNeedParamToStr(sTemp, "can_be_attacked", "1"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: undying->0, can_be_attacked->1"); } } } else if ((Libraries.GetNeedParamFromStr(sTemp, "undying") ?? "") == "1") { sTemp = Libraries.SetNeedParamToStr(sTemp, "undying", "0"); sTemp = Libraries.SetNeedParamToStr(sTemp, "can_be_attacked", "1"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: undying->0, can_be_attacked->1"); } } else // This a Peace NPC. if ((aTemp[1] ?? "") == "guard") { if ((Libraries.GetNeedParamFromStr(sTemp, "undying") ?? "") != "0" & (Libraries.GetNeedParamFromStr(sTemp, "can_be_attacked") ?? "") != "0") { sTemp = Libraries.SetNeedParamToStr(sTemp, "undying", "0"); sTemp = Libraries.SetNeedParamToStr(sTemp, "can_be_attacked", "0"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: undying->0, can_be_attacked->0"); } } else if ((Libraries.GetNeedParamFromStr(sTemp, "undying") ?? "") == "0") { sTemp = Libraries.SetNeedParamToStr(sTemp, "undying", "1"); sTemp = Libraries.SetNeedParamToStr(sTemp, "can_be_attacked", "0"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: undying->1, can_be_attacked->0"); } } // Checking: Undying END // Checking: npc active skill if (CheckedListBox.CheckedItems.IndexOf("npc active skill") != -1) { // Dim aSkillSymbol() As String = {";", "]"} '{[DDMagic]=@s_blood_sucking6} 'npc_ai={} // Dim iTempPos1 As Integer, iTempPos2 As Integer // Dim sTempSkillName As String sTemp2 = Libraries.GetNeedParamFromStr(sTemp, "npc_ai").Replace(Conversions.ToString((char)9), "").Replace(" ", ""); iTempPos1 = Strings.InStr(sTemp2, "]=@s_"); while (iTempPos1 > 0) { iTempPos1 += 2; iTempPos2 = Strings.InStr(iTempPos1, sTemp2, "}") - 1; sTempSkillName = sTemp2.Substring(iTempPos1, iTempPos2 - iTempPos1); if (Array.IndexOf(aSkills, sTempSkillName) == -1) { // npc_begin zzoldagu 12545 [pirates_zombie_b] level=57 outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Found undefined active skill: " + sTempSkillName); } iTempPos1 = Strings.InStr(iTempPos2, sTemp2, "]=@s_"); } if (iTempPos1 > 0) { } } // Checking: npc active skill // Checking: castle bowguard range if (CheckedListBox.CheckedItems.IndexOf("castle bowguard range") != -1) { if ((Libraries.GetNeedParamFromStr(sTemp, "race") ?? "") == "castle_guard") { if ((Libraries.GetNeedParamFromStr(sTemp, "base_attack_type") ?? "") == "bow") { if ((Libraries.GetNeedParamFromStr(sTemp, "base_attack_range") ?? "") != "1100") { sTemp = Libraries.SetNeedParamToStr(sTemp, "base_attack_range", "1100"); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: castle bowguard range is 1100"); } } } } // Checking: castle bowguard range // Checking: npc race (Use passive skills for define race) if (CheckedListBox.CheckedItems.IndexOf("npc race") != -1) { // none - (forms, алтари, агашены) // animal s_race_animals // dragon s_race_dragons // fairy s_race_fairies // etc s_race_others // angel s_race_angels // construct s_race_magic_creatures // creature s_race_unknown_creature // human s_race_humans // humanoid s_race_humanoids // beast s_race_beasts // undead s_race_undead // elemental s_race_spirits // demonic s_race_demonic // siege_weapon s_race_siege_weapons // divine s_race_divine // bug s_race_bugs // plant s_race_plants // giant s_race_giants // kamael s_race_kamaels // elf s_race_elves // dwarf s_race_dwarves // darkelf s_race_dark_elves // orc s_race_orcs // castle_guard s_race_defending_army // mercenary s_race_mercenaries // skill_list={@s_race_fairies;@s_summon_magic_defence} aTemp2 = Libraries.GetNeedParamFromStr(sTemp, "skill_list").Replace("{", null).Replace("}", null).Replace("@", null).Split(Conversions.ToChar(";")); if ((Libraries.GetNeedParamFromStr(sTemp, "skill_list") ?? "") != "{}") { var loopTo = aTemp2.Length - 1; for (iTemp = 0; iTemp <= loopTo; iTemp++) { if (Array.IndexOf(aRaceSkill, aTemp2[iTemp]) != -1) { iTemp = Array.IndexOf(aRaceSkill, aTemp2[iTemp]); if ((aRace[iTemp] ?? "") != (Libraries.GetNeedParamFromStr(sTemp, "race") ?? "")) { // Fix race sTempSkillName = Libraries.GetNeedParamFromStr(sTemp, "race"); sTemp = Libraries.SetNeedParamToStr(sTemp, "race", aRace[iTemp]); outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: race=" + sTempSkillName + " -> " + aRace[iTemp] + Constants.vbTab + "where skill_list=" + Libraries.GetNeedParamFromStr(sTemp, "skill_list")); } iTemp = aTemp2.Length; break; } } // checking: found race or not if (iTemp == aTemp2.Length) { sTemp2 = "none"; } } else if ((Libraries.GetNeedParamFromStr(sTemp, "race") ?? "") != "none") { // Fix race sTempSkillName = Libraries.GetNeedParamFromStr(sTemp, "race"); if ((aTemp[2] ?? "") == "warrior" | (aTemp[2] ?? "") == "boss" | (aTemp[2] ?? "") == "zzoldagu") { sTemp = Libraries.SetNeedParamToStr(sTemp, "race", "etc"); } else { sTemp = Libraries.SetNeedParamToStr(sTemp, "race", "none"); } outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "Now: race=" + sTempSkillName + " -> none"); } } // Checking: npc race end // Checking: stats (str,int,dex,wit,con,men) end if (CheckedListBox.CheckedItems.IndexOf("stats (str,int,dex,wit,con,men)") != -1) { // BOSS/Mobs Stats bug fix! // doppelganger, pc_trap if (CheckBoxZzoldagu74.Checked == true) { if ((aTemp[1] ?? "") == "zzoldagu" & Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "level")) >= 74) { aTemp[1] = "boss"; } } // Dim iSpecialBoss() As Integer = {18465, 22326, 22341, 25539} ' Hellbound Boss's - Derek, Hellinark, Keltas, Typhoon if (Array.IndexOf(iSpecialBoss, Conversions.ToInteger(aTemp[2])) != -1) { aTemp[1] = "boss"; } sTemp2 = sTemp; switch (aTemp[1]) { case "boss": { // str=60 int=76 dex=73 wit=70 con=57 men=80 boss sTemp = Libraries.SetNeedParamToStr(sTemp, "str", "60"); sTemp = Libraries.SetNeedParamToStr(sTemp, "int", "76"); sTemp = Libraries.SetNeedParamToStr(sTemp, "dex", "73"); sTemp = Libraries.SetNeedParamToStr(sTemp, "wit", "70"); sTemp = Libraries.SetNeedParamToStr(sTemp, "con", "57"); sTemp = Libraries.SetNeedParamToStr(sTemp, "men", "80"); break; } case "zzoldagu": { // str=40 int=41 dex=30 wit=20 con=43 men=10 zzoldagu sTemp = Libraries.SetNeedParamToStr(sTemp, "str", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "int", "41"); sTemp = Libraries.SetNeedParamToStr(sTemp, "dex", "30"); sTemp = Libraries.SetNeedParamToStr(sTemp, "wit", "20"); sTemp = Libraries.SetNeedParamToStr(sTemp, "con", "43"); sTemp = Libraries.SetNeedParamToStr(sTemp, "men", "10"); break; } case "warrior": { // str=40 int=41 dex=30 wit=20 con=43 men=10 warrior sTemp = Libraries.SetNeedParamToStr(sTemp, "str", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "int", "21"); sTemp = Libraries.SetNeedParamToStr(sTemp, "dex", "30"); sTemp = Libraries.SetNeedParamToStr(sTemp, "wit", "20"); sTemp = Libraries.SetNeedParamToStr(sTemp, "con", "43"); sTemp = Libraries.SetNeedParamToStr(sTemp, "men", "10"); // 12762 [dawn_hero_sword_move], 12763 [dawn_hero_wizard_move] if ((aTemp[2] ?? "") == "12762" | (aTemp[2] ?? "") == "12763") { sTemp = Libraries.SetNeedParamToStr(sTemp, "str", "84"); sTemp = Libraries.SetNeedParamToStr(sTemp, "int", "76"); sTemp = Libraries.SetNeedParamToStr(sTemp, "dex", "73"); sTemp = Libraries.SetNeedParamToStr(sTemp, "wit", "70"); sTemp = Libraries.SetNeedParamToStr(sTemp, "con", "71"); sTemp = Libraries.SetNeedParamToStr(sTemp, "men", "80"); } break; } case "pet": { // str=40 int=21 dex=30 wit=20 con=43 men=25 pet,summon sTemp = Libraries.SetNeedParamToStr(sTemp, "str", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "int", "21"); sTemp = Libraries.SetNeedParamToStr(sTemp, "dex", "30"); sTemp = Libraries.SetNeedParamToStr(sTemp, "wit", "20"); sTemp = Libraries.SetNeedParamToStr(sTemp, "con", "43"); sTemp = Libraries.SetNeedParamToStr(sTemp, "men", "25"); // pet 12564 [sin_eater] if ((aTemp[2] ?? "") == "12564") { sTemp = Libraries.SetNeedParamToStr(sTemp, "con", "1"); } break; } case "summon": { // str=40 int=21 dex=30 wit=20 con=43 men=25 pet,summon sTemp = Libraries.SetNeedParamToStr(sTemp, "str", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "int", "21"); sTemp = Libraries.SetNeedParamToStr(sTemp, "dex", "30"); sTemp = Libraries.SetNeedParamToStr(sTemp, "wit", "20"); sTemp = Libraries.SetNeedParamToStr(sTemp, "con", "43"); sTemp = Libraries.SetNeedParamToStr(sTemp, "men", "25"); break; } default: { // str=40 int=21 dex=30 wit=20 con=43 men=10 citizen and etc sTemp = Libraries.SetNeedParamToStr(sTemp, "str", "40"); sTemp = Libraries.SetNeedParamToStr(sTemp, "int", "21"); sTemp = Libraries.SetNeedParamToStr(sTemp, "dex", "30"); sTemp = Libraries.SetNeedParamToStr(sTemp, "wit", "20"); sTemp = Libraries.SetNeedParamToStr(sTemp, "con", "43"); sTemp = Libraries.SetNeedParamToStr(sTemp, "men", "10"); break; } } if ((sTemp2 ?? "") != (sTemp ?? "")) { outLog.WriteLine("Fixed: " + aTemp[1] + Constants.vbTab + aTemp[2] + Constants.vbTab + aTemp[3] + Constants.vbTab + "New stats (str,int,dex,wit,con,men) now."); } } } outFile.WriteLine(sTemp); } ToolStripProgressBar.Value = 0; outLog.WriteLine(Conversions.ToString(DateAndTime.Now) + " End"); outLog.WriteLine(); outLog.Close(); inFile.Close(); outFile.Close(); MessageBox.Show("Complete", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void AddImprov_Click(object sender, EventArgs e) { RowData PartyRow = null; CardData UniversalDictionary = Session.CardManager.GetCardData(new Guid("{B2A438B7-8BB3-4B13-AF6E-F2F8996E148B}")); List <RowData> PartyItemRows = new List <RowData>(); RowDataCollection PartyRowsCollection; if (!Document.Sections.Any(r => r.Id == new Guid("{A8F93D97-496B-4675-B520-058B919146B7}"))) { PartyRowsCollection = Document.Sections[new Guid("{5B6B407E-3D72-49E7-97D9-8E1E028C7274}")].Rows.First(r => r.GetString("Name") == "Партия").ChildSections[new Guid("{E6F5105F-8BD8-4500-9780-60D7C1402DDB}")].Rows; foreach (RowData CurrentRow in PartyRowsCollection) { PartyItemRows.Add(UniversalDictionary.GetItemRow((Guid)CurrentRow.GetGuid("SelectedValue"))); } } else { PartyRowsCollection = Document.Sections[new Guid("{A8F93D97-496B-4675-B520-058B919146B7}")].Rows; foreach (RowData CurrentRow in PartyRowsCollection) { PartyItemRows.Add(UniversalDictionary.GetItemRow((Guid)CurrentRow.GetGuid("PartyId"))); } } //List<RowData> PartyItemRows = PartyRowsCollection.Select(r => UniversalDictionary.GetItemRow((Guid)r.GetGuid("Id"))).ToList(); if (PartyItemRows.Any(r => UniversalDictionary.GetItemPropertyValue(r.Id, "Наименование прибора").ToGuid() == DeviceType.Id)) { PartyRow = PartyItemRows.FirstOrDefault(r => UniversalDictionary.GetItemPropertyValue(r.Id, "Наименование прибора").ToGuid() == DeviceType.Id); } else { StatusStrip.Items["StatusText"].Text = "Ошибка! В Разрешении не указана партия для текущего прибора."; StatusStrip.Update(); switch (MessageBox.Show("Внести доработку во все приборы в эксплуатации?", "Ошибка", MessageBoxButtons.YesNo)) { case DialogResult.Yes: StatusStrip.Items["StatusText"].Text = "Продолжение работы..."; StatusStrip.Update(); break; case DialogResult.No: return; break; } } List <Guid> ImprovPartiesGuid = new List <Guid>(); if (!PartyRow.IsNull()) { RowData PartyDicType = UniversalDictionary.Sections[new Guid("{5E3ED23A-2B5E-47F2-887C-E154ACEAFB97}")].Rows.First(r => r.GetString("Name") == "Справочник партий"); IEnumerable <RowData> AllParties = PartyDicType.ChildSections[new Guid("{DD20BF9B-90F8-4D9A-9553-5B5F17AD724E}")].Rows.Where(r => (UniversalDictionary.GetItemPropertyValue(r.Id, "Наименование прибора").ToGuid() == DeviceType.Id) && (!UniversalDictionary.GetItemPropertyValue(r.Id, "Год начала выпуска").IsNull())); PartyComparer PC = new PartyComparer(); List <RowData> ImprovParties = AllParties.Where(r => PC.Compare(r.GetString("Name"), PartyRow.GetString("Name")) == 1).ToList(); foreach (RowData CurrentParty in ImprovParties) { ImprovPartiesGuid.Add(CurrentParty.Id); } } CardData baseUniversal = Session.CardManager.GetCardData(new Guid("{4538149D-1FC7-4D41-A104-890342C6B4F8}")); if (!baseUniversal.Sections[new Guid("{A1DCE6C1-DB96-4666-B418-5A075CDB02C9}")].GetAllRows().Any(r => r.Id == new Guid("{43A6DA44-899C-47D8-9567-2185E05D8524}"))) { StatusStrip.Items["StatusText"].Text = "Ошибка! Не найден справочник ремонтных работ и доработок..."; StatusStrip.Update(); return; } // Поиск записей справочника SearchQuery searchQuery = Session.CreateSearchQuery(); searchQuery.CombineResults = ConditionGroupOperation.And; CardTypeQuery typeQuery = searchQuery.AttributiveSearch.CardTypeQueries.AddNew(DocsVision.BackOffice.CardLib.CardDefs.CardBaseUniversalItem.ID); SectionQuery sectionQuery = typeQuery.SectionQueries.AddNew(DocsVision.BackOffice.CardLib.CardDefs.CardBaseUniversalItem.System.ID); sectionQuery.Operation = SectionQueryOperation.And; sectionQuery.ConditionGroup.Operation = ConditionGroupOperation.And; ConditionGroup ConditionGroup = sectionQuery.ConditionGroup.ConditionGroups.AddNew(); ConditionGroup.Operation = ConditionGroupOperation.And; ConditionGroup.Conditions.AddNew(DocsVision.BackOffice.CardLib.CardDefs.CardBaseUniversalItem.System.Kind, FieldType.RefId, ConditionOperation.Equals, new Guid("{F4650B71-B131-41D2-AAFA-8DA1101ACA52}")); SectionQuery sectionQuery2 = typeQuery.SectionQueries.AddNew(new Guid("{3F9F3C1D-1CF1-4E71-BBE4-31D6AAD94EF7}")); sectionQuery2.Operation = SectionQueryOperation.And; sectionQuery2.ConditionGroup.Operation = ConditionGroupOperation.And; ConditionGroup ConditionGroup2 = sectionQuery2.ConditionGroup.ConditionGroups.AddNew(); ConditionGroup2.Operation = ConditionGroupOperation.And; ConditionGroup2.Conditions.AddNew("BaseDocument", FieldType.RefId, ConditionOperation.Equals, Document.Id); ConditionGroup2.Conditions.AddNew("Status", FieldType.Int, ConditionOperation.Equals, 0); SectionQuery sectionQuery3 = typeQuery.SectionQueries.AddNew(new Guid("{E6DB53B7-7677-4978-8562-6B17917516A6}")); sectionQuery3.Operation = SectionQueryOperation.And; sectionQuery3.ConditionGroup.Operation = ConditionGroupOperation.And; ConditionGroup ConditionGroup3 = sectionQuery3.ConditionGroup.ConditionGroups.AddNew(); ConditionGroup3.Operation = ConditionGroupOperation.And; ConditionGroup3.Conditions.AddNew("DeviceID", FieldType.RefId, ConditionOperation.Equals, DeviceType.Id); searchQuery.Limit = 0; string query = searchQuery.GetXml(); CardDataCollection CardBaseUniversalItems = Session.CardManager.FindCards(query); CardData ItemCard = null; RowData ItemRow = null; if (CardBaseUniversalItems.Count() == 0) { StatusStrip.Items["StatusText"].Text = "Ошибка! Не найдена соответствующая карточка ремонтных работ и доработок..."; StatusStrip.Update(); return; } if (CardBaseUniversalItems.Count() > 1) { StatusStrip.Items["StatusText"].Text = "Ошибка! Найдено несколько подходящих карточек ремонтных работ и доработок..."; StatusStrip.Update(); return; } if (CardBaseUniversalItems.Count() == 1) { ItemCard = CardBaseUniversalItems.First(); RowData ItemType = baseUniversal.Sections[new Guid("{A1DCE6C1-DB96-4666-B418-5A075CDB02C9}")].GetAllRows().First(r => r.Id == new Guid("{43A6DA44-899C-47D8-9567-2185E05D8524}")); ItemRow = ItemType.ChildSections[new Guid("{1B1A44FB-1FB1-4876-83AA-95AD38907E24}")].Rows.First(r => (Guid)r.GetGuid("ItemCard") == ItemCard.Id); if (ItemRow.IsNull()) { StatusStrip.Items["StatusText"].Text = "Ошибка! Не найдена соответствующая запись справочника ремонтных работ и доработок..."; StatusStrip.Update(); return; } else { StatusStrip.Items["StatusText"].Text = "Запись найдена: " + ItemRow.GetString("Name") + "..."; StatusStrip.Update(); } } Guid DevicePassportTypeID = new Guid("{42826E25-AD0E-4D9C-8B18-CD88E6796972}"); CardData CardTypeDictionary = Session.CardManager.GetDictionaryData(RefTypes.ID); SectionData DocumentTypes = CardTypeDictionary.Sections[RefTypes.DocumentTypes.ID]; RowData DevicePassportType = DocumentTypes.GetRow(DevicePassportTypeID); RowDataCollection DevicePassportProperties = DevicePassportType.ChildSections[RefTypes.Properties.ID].Rows; SearchQuery searchQuery2 = Session.CreateSearchQuery(); searchQuery2.CombineResults = ConditionGroupOperation.And; CardTypeQuery typeQuery2 = searchQuery2.AttributiveSearch.CardTypeQueries.AddNew(CardOrd.ID); SectionQuery sectionQuery4 = typeQuery2.SectionQueries.AddNew(CardOrd.MainInfo.ID); sectionQuery4.Operation = SectionQueryOperation.And; sectionQuery4.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery4.ConditionGroup.Conditions.AddNew("Type", FieldType.RefId, ConditionOperation.Equals, DevicePassportTypeID); sectionQuery4 = typeQuery2.SectionQueries.AddNew(CardOrd.Properties.ID); sectionQuery4.Operation = SectionQueryOperation.And; sectionQuery4.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery4.ConditionGroup.Conditions.AddNew("Name", FieldType.String, ConditionOperation.Equals, "Прибор"); sectionQuery4.ConditionGroup.Conditions.AddNew("Value", FieldType.RefId, ConditionOperation.Equals, DeviceType.Id); if (ImprovPartiesGuid.Count != 0) { sectionQuery4 = typeQuery2.SectionQueries.AddNew(CardOrd.Properties.ID); sectionQuery4.Operation = SectionQueryOperation.And; sectionQuery4.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery4.ConditionGroup.Conditions.AddNew("Name", FieldType.String, ConditionOperation.Equals, "№ партии"); ConditionGroup PartyGroup = sectionQuery4.ConditionGroup.ConditionGroups.AddNew(); PartyGroup.Operation = ConditionGroupOperation.Or; for (int j = 0; j < ImprovPartiesGuid.Count; j++) { PartyGroup.Conditions.AddNew("Value", FieldType.RefId, ConditionOperation.OneOf, ImprovPartiesGuid.ToArray()[j]); } } else { sectionQuery4 = typeQuery2.SectionQueries.AddNew(CardOrd.Properties.ID); sectionQuery4.Operation = SectionQueryOperation.And; sectionQuery4.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery4.ConditionGroup.Conditions.AddNew("Name", FieldType.String, ConditionOperation.Equals, "Состояние прибора"); sectionQuery4.ConditionGroup.Conditions.AddNew("Value", FieldType.RefId, ConditionOperation.OneOf, new int[] { 5, 6 }); } // Получение текста запроса searchQuery2.Limit = 0; string query2 = searchQuery2.GetXml(); Console.WriteLine(query2); Console.ReadLine(); CardDataCollection coll = Session.CardManager.FindCards(query2); Clear(); StatusStrip.Items["StatusText"].Text = "Найдено паспортов: " + coll.Count.ToString() + "..."; StatusStrip.Update(); int i = 0; for (i = 0; i < coll.Count; i++) { CardData Card = coll[i]; Card.ForceUnlock(); StatusStrip.Items["StatusText"].Text = i.ToString() + " из " + coll.Count + ". " + Card.Description; StatusStrip.Update(); SectionData Properties = Card.Sections[CardOrd.Properties.ID]; RowDataCollection DocumentCol = Properties.FindRow("@Name = 'Документ'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Assembly = Properties.FindRow("@Name = 'Сборочный узел'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection RepareItem = Properties.FindRow("@Name = 'Запись справочника ремонтных работ и доработок'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Indication = Properties.FindRow("@Name = 'Указание'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Check = Properties.FindRow("@Name = 'Выполнено'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection CheckDate = Properties.FindRow("@Name = 'Дата выполнения'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Comments = Properties.FindRow("@Name = 'Комментарии'").ChildSections[CardOrd.SelectedValues.ID].Rows; if (DocumentCol.Count != Assembly.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (Assembly.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = Assembly.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != RepareItem.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (RepareItem.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = RepareItem.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != Indication.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (Indication.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = Indication.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != Check.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (Check.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = Check.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != CheckDate.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (CheckDate.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = CheckDate.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != Comments.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (Comments.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = Comments.AddNew(); NewRow.SetInt32("Order", Order); } } } if (!DocumentCol.Any(r => r.GetGuid("SelectedValue") == Document.Id)) { int CurrentOrder = DocumentCol.Count + 1; RowData NewRow2 = DocumentCol.AddNew(); NewRow2.SetInt32("Order", CurrentOrder); NewRow2.SetGuid("SelectedValue", Document.Id); NewRow2 = RepareItem.AddNew(); NewRow2.SetInt32("Order", CurrentOrder); NewRow2.SetGuid("SelectedValue", ItemRow.Id); NewRow2 = Assembly.AddNew(); NewRow2.SetInt32("Order", CurrentOrder); if (!ItemCard.Sections[new Guid("{3F9F3C1D-1CF1-4E71-BBE4-31D6AAD94EF7}")].FirstRow.GetGuid("AssemblyUnit").IsNull()) { NewRow2.SetGuid("SelectedValue", (Guid)ItemCard.Sections[new Guid("{3F9F3C1D-1CF1-4E71-BBE4-31D6AAD94EF7}")].FirstRow.GetGuid("AssemblyUnit")); } NewRow2 = Indication.AddNew(); NewRow2.SetInt32("Order", CurrentOrder); if (!ItemCard.Sections[new Guid("{3F9F3C1D-1CF1-4E71-BBE4-31D6AAD94EF7}")].FirstRow.GetGuid("Instructions").IsNull()) { NewRow2.SetGuid("SelectedValue", (Guid)ItemCard.Sections[new Guid("{3F9F3C1D-1CF1-4E71-BBE4-31D6AAD94EF7}")].FirstRow.GetGuid("Instructions")); } NewRow2 = Check.AddNew(); NewRow2.SetInt32("Order", CurrentOrder); NewRow2 = CheckDate.AddNew(); NewRow2.SetInt32("Order", CurrentOrder); NewRow2 = Comments.AddNew(); NewRow2.SetInt32("Order", CurrentOrder); } Clear(); } StatusStrip.Items["StatusText"].Text = i.ToString() + " карточек успешно обработано."; StatusStrip.Update(); }
/// <summary> /// Осуществляет обновление доработки в Паспорте прибора на основании данных Конструктора справочников /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BindImprov_Click(object sender, EventArgs e) { if (this.TypeName.Text == "") { MessageBox.Show("Укажите тип прибора!"); return; } if (this.DocName.Text == "") { MessageBox.Show("Укажите документ-основание!"); return; } StatusStrip.Items["StatusText"].Text = "Процесс начат..."; StatusStrip.Update(); // Получение записи справочника ремонтных работ и доработок //ObjectContext Context = Session.CreateContext(); // Получение справочника "Ремонтные работы и доработки" //IBaseUniversalService baseUniversalService = Context.GetService<IBaseUniversalService>(); //BaseUniversal baseUniversal = Context.GetObject<BaseUniversal>(RefBaseUniversal.ID); CardData baseUniversal = Session.CardManager.GetCardData(new Guid("{4538149D-1FC7-4D41-A104-890342C6B4F8}")); if (!baseUniversal.Sections[new Guid("{A1DCE6C1-DB96-4666-B418-5A075CDB02C9}")].GetAllRows().Any(r => r.Id == new Guid("{43A6DA44-899C-47D8-9567-2185E05D8524}"))) { StatusStrip.Items["StatusText"].Text = "Ошибка! Не найден справочник ремонтных работ и доработок..."; StatusStrip.Update(); return; } // Поиск записей справочника SearchQuery searchQuery = Session.CreateSearchQuery(); searchQuery.CombineResults = ConditionGroupOperation.And; CardTypeQuery typeQuery = searchQuery.AttributiveSearch.CardTypeQueries.AddNew(DocsVision.BackOffice.CardLib.CardDefs.CardBaseUniversalItem.ID); SectionQuery sectionQuery = typeQuery.SectionQueries.AddNew(DocsVision.BackOffice.CardLib.CardDefs.CardBaseUniversalItem.System.ID); sectionQuery.Operation = SectionQueryOperation.And; sectionQuery.ConditionGroup.Operation = ConditionGroupOperation.And; ConditionGroup ConditionGroup = sectionQuery.ConditionGroup.ConditionGroups.AddNew(); ConditionGroup.Operation = ConditionGroupOperation.And; ConditionGroup.Conditions.AddNew(DocsVision.BackOffice.CardLib.CardDefs.CardBaseUniversalItem.System.Kind, FieldType.RefId, ConditionOperation.Equals, new Guid("{F4650B71-B131-41D2-AAFA-8DA1101ACA52}")); SectionQuery sectionQuery2 = typeQuery.SectionQueries.AddNew(new Guid("{3F9F3C1D-1CF1-4E71-BBE4-31D6AAD94EF7}")); sectionQuery2.Operation = SectionQueryOperation.And; sectionQuery2.ConditionGroup.Operation = ConditionGroupOperation.And; ConditionGroup ConditionGroup2 = sectionQuery2.ConditionGroup.ConditionGroups.AddNew(); ConditionGroup2.Operation = ConditionGroupOperation.And; ConditionGroup2.Conditions.AddNew("BaseDocument", FieldType.RefId, ConditionOperation.Equals, Document.Id); ConditionGroup2.Conditions.AddNew("Status", FieldType.Int, ConditionOperation.Equals, 0); SectionQuery sectionQuery3 = typeQuery.SectionQueries.AddNew(new Guid("{E6DB53B7-7677-4978-8562-6B17917516A6}")); sectionQuery3.Operation = SectionQueryOperation.And; sectionQuery3.ConditionGroup.Operation = ConditionGroupOperation.And; ConditionGroup ConditionGroup3 = sectionQuery3.ConditionGroup.ConditionGroups.AddNew(); ConditionGroup3.Operation = ConditionGroupOperation.And; ConditionGroup3.Conditions.AddNew("DeviceID", FieldType.RefId, ConditionOperation.Equals, DeviceType.Id); searchQuery.Limit = 0; string query = searchQuery.GetXml(); CardDataCollection CardBaseUniversalItems = Session.CardManager.FindCards(query); CardData ItemCard = null; RowData ItemRow = null; if (CardBaseUniversalItems.Count() == 0) { StatusStrip.Items["StatusText"].Text = "Ошибка! Не найдена соответствующая карточка ремонтных работ и доработок..."; StatusStrip.Update(); return; } if (CardBaseUniversalItems.Count() > 1) { StatusStrip.Items["StatusText"].Text = "Ошибка! Найдено несколько подходящих карточек ремонтных работ и доработок..."; StatusStrip.Update(); return; } if (CardBaseUniversalItems.Count() == 1) { ItemCard = CardBaseUniversalItems.First(); RowData ItemType = baseUniversal.Sections[new Guid("{A1DCE6C1-DB96-4666-B418-5A075CDB02C9}")].GetAllRows().First(r => r.Id == new Guid("{43A6DA44-899C-47D8-9567-2185E05D8524}")); ItemRow = ItemType.ChildSections[new Guid("{1B1A44FB-1FB1-4876-83AA-95AD38907E24}")].Rows.First(r => (Guid)r.GetGuid("ItemCard") == ItemCard.Id); if (ItemRow.IsNull()) { StatusStrip.Items["StatusText"].Text = "Ошибка! Не найдена соответствующая запись справочника ремонтных работ и доработок..."; StatusStrip.Update(); return; } else { StatusStrip.Items["StatusText"].Text = "Запись найдена: " + ItemRow.GetString("Name") + "..."; StatusStrip.Update(); } } Guid DevicePassportTypeID = new Guid("{42826E25-AD0E-4D9C-8B18-CD88E6796972}"); CardData CardTypeDictionary = Session.CardManager.GetDictionaryData(RefTypes.ID); SectionData DocumentTypes = CardTypeDictionary.Sections[RefTypes.DocumentTypes.ID]; RowData DevicePassportType = DocumentTypes.GetRow(DevicePassportTypeID); RowDataCollection DevicePassportProperties = DevicePassportType.ChildSections[RefTypes.Properties.ID].Rows; SearchQuery searchQuery2 = Session.CreateSearchQuery(); searchQuery2.CombineResults = ConditionGroupOperation.And; CardTypeQuery typeQuery2 = searchQuery2.AttributiveSearch.CardTypeQueries.AddNew(CardOrd.ID); SectionQuery sectionQuery4 = typeQuery2.SectionQueries.AddNew(CardOrd.MainInfo.ID); sectionQuery4.Operation = SectionQueryOperation.And; sectionQuery4.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery4.ConditionGroup.Conditions.AddNew("Type", FieldType.RefId, ConditionOperation.Equals, DevicePassportTypeID); sectionQuery4 = typeQuery2.SectionQueries.AddNew(CardOrd.Properties.ID); sectionQuery4.Operation = SectionQueryOperation.And; sectionQuery4.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery4.ConditionGroup.Conditions.AddNew("Name", FieldType.String, ConditionOperation.Equals, "Прибор"); sectionQuery4.ConditionGroup.Conditions.AddNew("Value", FieldType.RefId, ConditionOperation.Equals, DeviceType.Id); sectionQuery4 = typeQuery2.SectionQueries.AddNew(CardOrd.SelectedValues.ID); sectionQuery4.Operation = SectionQueryOperation.And; sectionQuery4.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery4.ConditionGroup.Conditions.AddNew("SelectedValue", FieldType.RefCardId, ConditionOperation.Equals, Document.Id); // Получение текста запроса searchQuery2.Limit = 0; string query2 = searchQuery2.GetXml(); Console.WriteLine(query2); Console.ReadLine(); CardDataCollection coll = Session.CardManager.FindCards(query2); Clear(); StatusStrip.Items["StatusText"].Text = "Найдено паспортов: " + coll.Count.ToString() + "..."; StatusStrip.Update(); int i = 0; for (i = 0; i < coll.Count; i++) { CardData Card = coll[i]; Card.ForceUnlock(); StatusStrip.Items["StatusText"].Text = i.ToString() + " из " + coll.Count + ". " + Card.Description; StatusStrip.Update(); SectionData Properties = Card.Sections[CardOrd.Properties.ID]; RowDataCollection DocumentCol = Properties.FindRow("@Name = 'Документ'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowData DocumentRow = DocumentCol.First(r => new Guid(r.GetString("SelectedValue")).Equals(Document.Id)); if (DocumentRow != null) { RowDataCollection Assembly = Properties.FindRow("@Name = 'Сборочный узел'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection RepareItem = Properties.FindRow("@Name = 'Запись справочника ремонтных работ и доработок'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Indication = Properties.FindRow("@Name = 'Указание'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Check = Properties.FindRow("@Name = 'Выполнено'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection CheckDate = Properties.FindRow("@Name = 'Дата выполнения'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Comments = Properties.FindRow("@Name = 'Комментарии'").ChildSections[CardOrd.SelectedValues.ID].Rows; if (DocumentCol.Count != Assembly.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (Assembly.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = Assembly.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != RepareItem.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (RepareItem.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = RepareItem.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != Indication.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (Indication.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = Indication.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != Check.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (Check.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = Check.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != CheckDate.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (CheckDate.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = CheckDate.AddNew(); NewRow.SetInt32("Order", Order); } } } if (DocumentCol.Count != Comments.Count) { foreach (RowData Doc in DocumentCol) { int Order = (int)Doc.GetInt32("Order"); if (Comments.FirstOrDefault(r => r.GetInt32("Order") == Order).IsNull()) { RowData NewRow = Comments.AddNew(); NewRow.SetInt32("Order", Order); } } } int CurrentOrder = (int)DocumentRow.GetInt32("Order"); RepareItem.First(r => r.GetInt32("Order") == CurrentOrder).SetGuid("SelectedValue", ItemRow.Id); if (!ItemCard.Sections[new Guid("{3F9F3C1D-1CF1-4E71-BBE4-31D6AAD94EF7}")].FirstRow.GetGuid("AssemblyUnit").IsNull()) { Assembly.First(r => r.GetInt32("Order") == CurrentOrder).SetGuid("SelectedValue", (Guid)ItemCard.Sections[new Guid("{3F9F3C1D-1CF1-4E71-BBE4-31D6AAD94EF7}")].FirstRow.GetGuid("AssemblyUnit")); } if (!ItemRow.GetString("Description").IsNull()) { Indication.First(r => r.GetInt32("Order") == CurrentOrder).SetString("SelectedValue", ItemRow.GetString("Description")); } } Clear(); } StatusStrip.Items["StatusText"].Text = i.ToString() + " карточек успешно обработано."; StatusStrip.Update(); }
private void StartButton_Click(object sender, EventArgs e) { string NpcGrpFile = "npcgrp.txt"; // Name/path of npcgrp.txt file var aNpcPassiveSkill = new string[40001]; // Skilllist on each mob from npcgrp.txt file var aNpcActiveSkill = new string[40001]; // Skilllist on each mob from npcgrp.txt file // Dim SkillPchFile As String = "skill_pch.txt" ' Name/path of skillpch.txt file string SkillDataFile = "skilldata.txt"; // Name/path of skillpch.txt file // Dim aSkillPchId(30000) As String ' Skilllist on each mob from skill_pch.txt file // Dim aSkillPchName(30000) As String ' Skilllist on each mob from skill_pch.txt file var aSkillData = new SkillData[30001, 851]; // Skilllist on each mob from skill_pch.txt file string inNpcDataFile = "npcdata.txt"; // Name/path of npcgrp.txt file string outNpcDataFile = "npcdata_new.txt"; // Name/path of npcgrp.txt file int aRequiredSkillsCursor = -1; var aRequiredSkills = new string[101]; // founded skills string TempStr; string TempStr2; string[] TempData; int iTemp; int iTemp1; int iTemp2; if (System.IO.File.Exists(NpcGrpFile) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage client text file (npcgrp.txt)|npcgrp.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } NpcGrpFile = OpenFileDialog.FileName; } // If System.IO.File.Exists(SkillPchFile) = False Then // OpenFileDialog.FileName = "" // OpenFileDialog.Filter = "Lineage server script file (skill_pch.txt)|skill_pch.txt|All files|*.*" // If OpenFileDialog.ShowDialog = Windows.Forms.DialogResult.Cancel Then Exit Sub // SkillPchFile = OpenFileDialog.FileName // End If if (System.IO.File.Exists(SkillDataFile) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage server script file (skilldata.txt)|skilldata*.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } SkillDataFile = OpenFileDialog.FileName; } if (System.IO.File.Exists(inNpcDataFile) == false) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "Lineage server npc script file (npcdata.txt)|npcdata*.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } inNpcDataFile = OpenFileDialog.FileName; } SaveFileDialog.FileName = outNpcDataFile; SaveFileDialog.Filter = "Lineage II server New npc script (npcdata.txt)|npcdata*.txt|All files|*.*"; if (SaveFileDialog.ShowDialog() == DialogResult.Cancel) { return; } outNpcDataFile = SaveFileDialog.FileName; // ---- Loading Skills ---- ToolStripStatusLabel.Text = "Loading skilldata file..."; var iSkillPchFile = new System.IO.StreamReader(SkillDataFile, System.Text.Encoding.Default, true); ToolStripProgressBar.Maximum = Conversions.ToInteger(iSkillPchFile.BaseStream.Length); ToolStripProgressBar.Value = 0; // skill_begin skill_name=[s_triple_slash1] /* [Triple Slash] */ skill_id=1 level=1 while (iSkillPchFile.EndOfStream != true) { TempStr = Strings.Replace(iSkillPchFile.ReadLine(), Conversions.ToString((char)9), " "); if (TempStr != null == true) { if (TempStr.StartsWith("//") == false) { iTemp1 = Conversions.ToInteger(Libraries.GetNeedParamFromStr(TempStr, "skill_id")); iTemp2 = Conversions.ToInteger(Libraries.GetNeedParamFromStr(TempStr, "level")); aSkillData[iTemp1, iTemp2].skill_name = Libraries.GetNeedParamFromStr(TempStr, "skill_name").Replace("[", "").Replace("]", ""); aSkillData[iTemp1, iTemp2].skill_op = Libraries.GetNeedParamFromStr(TempStr, "operate_type"); } } ToolStripProgressBar.Value = Conversions.ToInteger(iSkillPchFile.BaseStream.Position); StatusStrip.Update(); } iSkillPchFile.Close(); ToolStripProgressBar.Value = 0; // End of Loading Skills // ---- Loading NpcSkills ---- System.IO.StreamReader iNpcDataFile; System.IO.StreamWriter oNpcDataFile; var outFile = new System.IO.StreamWriter(inNpcDataFile + "_scriptCheck.log", true, System.Text.Encoding.Unicode, 1); outFile.WriteLine(Constants.vbNewLine + "L2ScriptMaker. NpcdataC6 skill_list fixer."); outFile.WriteLine(Conversions.ToString(DateAndTime.Now) + " Start" + Constants.vbNewLine); string sTemp; // ResultsTextBox.Text // L2Disasm Format // cnt_dtab1=2 dtab1[0]=4416 dtab1[1]=13 dtab1[2]= dtab1[3]= string sTemp2; var aTemp = new string[4]; ToolStripStatusLabel.Text = "Loading npcgrp file..."; var iNpcGrpFile = new System.IO.StreamReader(NpcGrpFile, System.Text.Encoding.Default, true); ToolStripProgressBar.Maximum = Conversions.ToInteger(iNpcGrpFile.BaseStream.Length); ToolStripProgressBar.Value = 0; while (iNpcGrpFile.EndOfStream != true) { TempStr = iNpcGrpFile.ReadLine(); if (TempStr != null & TempStr.StartsWith("//") == false) { TempStr2 = Libraries.GetNeedParamFromStr(TempStr, "cnt_dtab1"); if ((TempStr2 ?? "") != "0" & (TempStr2 ?? "") != "1") { sTemp = "{"; sTemp2 = "npc_ai={"; var loopTo = Conversions.ToInteger(TempStr2) - 1; for (iTemp = 0; iTemp <= loopTo; iTemp += 2) { iTemp1 = Conversions.ToInteger(Libraries.GetNeedParamFromStr(TempStr, "dtab1[" + Conversions.ToString(iTemp) + "]")); iTemp2 = Conversions.ToInteger(Libraries.GetNeedParamFromStr(TempStr, "dtab1[" + Conversions.ToString(iTemp + 1) + "]")); if (string.IsNullOrEmpty(aSkillData[iTemp1, iTemp2].skill_name)) { // MessageBox.Show("Skill pch_id:" & iTemp2 & " not found in skilldata. Update file and try again", "Skill not defined", MessageBoxButtons.OK) // ResultsTextBox.AppendText("Npc_id: " & Libraries.GetNeedParamFromStr(TempStr, "tag") & " Skill pch_id:" & iTemp2 & " not found in skilldata. Update file and try again" & vbNewLine) outFile.WriteLine("Npc_id: " + Libraries.GetNeedParamFromStr(TempStr, "tag") + Constants.vbTab + "Skill id:" + Conversions.ToString(iTemp1) + Constants.vbTab + "Skill_level:" + Conversions.ToString(iTemp2)); } else { if (Array.IndexOf(aRequiredSkills, aSkillData[iTemp1, iTemp2].skill_name) == -1) { aRequiredSkillsCursor += 1; if (aRequiredSkillsCursor == aRequiredSkills.Length) { Array.Resize(ref aRequiredSkills, aRequiredSkillsCursor + 1); } aRequiredSkills[aRequiredSkillsCursor] = aSkillData[iTemp1, iTemp2].skill_name; // aSkillPch(iTemp2) } if ((aSkillData[iTemp1, iTemp2].skill_op ?? "") == "P") { sTemp = sTemp + "@" + aSkillData[iTemp1, iTemp2].skill_name; if (iTemp < Conversions.ToInteger(TempStr2) - 2) { sTemp = sTemp + ";"; } } else { sTemp2 = sTemp2 + "{[DDMagic]=@" + aSkillData[iTemp1, iTemp2].skill_name + "}"; if (iTemp < Conversions.ToInteger(TempStr2) - 2) { sTemp2 = sTemp2 + ";"; } } } } sTemp = sTemp + "}"; sTemp2 = sTemp2 + "}"; aNpcPassiveSkill[Conversions.ToInteger(Libraries.GetNeedParamFromStr(TempStr, "tag"))] = sTemp; if ((sTemp2 ?? "") != "npc_ai={}") { aNpcActiveSkill[Conversions.ToInteger(Libraries.GetNeedParamFromStr(TempStr, "tag"))] = sTemp2; } } } ToolStripProgressBar.Value = Conversions.ToInteger(iNpcGrpFile.BaseStream.Position); StatusStrip.Update(); } iNpcGrpFile.Close(); ToolStripProgressBar.Value = 0; // End of Loading NpcSkills outFile.WriteLine(); outFile.WriteLine("Start fixing passive skills..."); outFile.WriteLine(); outFile.Flush(); outFile.WriteLine("Required Skills for Mobs:"); var loopTo1 = aRequiredSkillsCursor; for (iTemp2 = 0; iTemp2 <= loopTo1; iTemp2++) { outFile.WriteLine(Conversions.ToString(iTemp2) + ": " + aRequiredSkills[iTemp2]); // & ": " & aSkillPch(aRequiredSkills(iTemp2))) } outFile.WriteLine(); if (CheckBoxSaveActive.Checked == true) { oNpcDataFile = new System.IO.StreamWriter(outNpcDataFile + "_skills.txt", false, System.Text.Encoding.Unicode, 1); var loopTo2 = aNpcActiveSkill.Length - 1; for (iTemp = 0; iTemp <= loopTo2; iTemp++) { oNpcDataFile.WriteLine(aNpcActiveSkill[iTemp]); } oNpcDataFile.Close(); } if (CheckBoxStopActive.Checked == true) { outFile.Close(); ToolStripProgressBar.Value = 0; ToolStripStatusLabel.Text = "Complete."; MessageBox.Show("Done."); return; } // ---- Main module ---- ToolStripStatusLabel.Text = "Writing npdata file..."; this.Update(); iNpcDataFile = new System.IO.StreamReader(inNpcDataFile, System.Text.Encoding.Default, true); if (System.IO.File.Exists(outNpcDataFile)) { System.IO.File.Copy(outNpcDataFile, outNpcDataFile + ".bak", true); } oNpcDataFile = new System.IO.StreamWriter(outNpcDataFile, false, System.Text.Encoding.Unicode, 1); ToolStripProgressBar.Maximum = Conversions.ToInteger(iNpcDataFile.BaseStream.Length); ToolStripProgressBar.Value = 0; // npc_begin warrior 1 [gremlin] level=1 // npcdata.txt: skill_list={@s_race_demonic;@s_evil_attack;@s_npc_resist_unholy3} // npcgrp.txt: property_list={4298;4278;4333} aNpcSkill // skillpch.txt aSkillPch(1130509) = s_race13 int NpcId; string OldSkillList; string NewSkillList; while (iNpcDataFile.EndOfStream != true) { TempStr = Strings.Replace(iNpcDataFile.ReadLine(), Conversions.ToString((char)9), " ").Trim(); if (!string.IsNullOrEmpty(TempStr) & TempStr != null & TempStr.StartsWith("//") == false) { // tabs and spaces correction while (Strings.InStr(TempStr, " ") != 0) { TempStr = Strings.Replace(TempStr, " ", " "); } TempData = TempStr.Split((char)32); NpcId = Conversions.ToInteger(TempData[2]); // Preparing OldSkillList = ""; NewSkillList = ""; OldSkillList = Libraries.GetNeedParamFromStr(TempStr, "skill_list"); NewSkillList = aNpcPassiveSkill[NpcId]; if (NewSkillList == null) { NewSkillList = "{}"; } // Magical Defence fix if (MagicDefCheckBox.Checked == true) { NewSkillList = NewSkillList.Replace("}", ""); // If NewSkillList <> "{" Then NewSkillList = NewSkillList & ";" switch (TempData[1]) { case "pet": { if ((NewSkillList ?? "") != "{") { NewSkillList = NewSkillList + ";"; } NewSkillList = NewSkillList + "@" + CustomNameTextBox.Lines[0] + "}"; // "@s_summon_magic_defence}" break; } case "summon": { if ((NewSkillList ?? "") != "{") { NewSkillList = NewSkillList + ";"; } NewSkillList = NewSkillList + "@" + CustomNameTextBox.Lines[0] + "}"; // "@s_summon_magic_defence}" break; } case "monrace": { if ((NewSkillList ?? "") != "{") { NewSkillList = NewSkillList + ";"; } NewSkillList = NewSkillList + "@s_full_magic_defence;@s_npc_abnormal_immunity}"; // "@s_npc_abnormal_immunity}" break; } case "warrior": { if ((Libraries.GetNeedParamFromStr(TempStr, "race") ?? "") == "castle_guard" | (Libraries.GetNeedParamFromStr(TempStr, "race") ?? "") == "mercenary") { if (MagicDefCheckBox.Checked == true & AutosetToBossCheckBox.Checked == true) { if ((NewSkillList ?? "") != "{") { NewSkillList = NewSkillList + ";"; } NewSkillList = NewSkillList + "@" + CustomNameTextBox.Lines[1]; // & "}" ' "@s_full_magic_defence}" } else { } } else { } NewSkillList = NewSkillList + "}"; break; } case "boss": { if (MagicDefCheckBox.Checked == true & AutosetToBossCheckBox.Checked == true) { if ((NewSkillList ?? "") != "{") { NewSkillList = NewSkillList + ";"; } NewSkillList = NewSkillList + "@" + CustomNameTextBox.Lines[1]; // & "}" ' "@s_full_magic_defence}" } else { } NewSkillList = NewSkillList + "}"; break; } case "zzoldagu": { // NewSkillList = NewSkillList & "}" if (MagicDefCheckBox.Checked == true & AutosetToBossCheckBox.Checked == true) { if ((NewSkillList ?? "") != "{") { NewSkillList = NewSkillList + ";"; } NewSkillList = NewSkillList + "@" + CustomNameTextBox.Lines[1]; // & "}" ' "@s_full_magic_defence}" } else { } NewSkillList = NewSkillList + "}"; break; } default: { if ((NewSkillList ?? "") != "{") { NewSkillList = NewSkillList + ";"; } NewSkillList = NewSkillList + "@" + CustomNameTextBox.Lines[1] + "}"; // "@s_full_magic_defence}" break; } } } if ((OldSkillList ?? "") != (NewSkillList ?? "")) { // TempStr = TempStr.Replace(OldSkillList, NewSkillList).Replace(Chr(32), Chr(9)) TempStr = Libraries.SetNeedParamToStr(TempStr, "skill_list", NewSkillList); outFile.WriteLine("Fixing npc: " + TempData[0] + Constants.vbTab + TempData[1] + Constants.vbTab + TempData[2] + Constants.vbTab + TempData[3]); outFile.WriteLine(OldSkillList + Constants.vbNewLine + "-->" + Constants.vbNewLine + NewSkillList + Constants.vbNewLine); } } TempStr = TempStr.Replace((char)32, (char)9); oNpcDataFile.WriteLine(TempStr); ToolStripProgressBar.Value = Conversions.ToInteger(iNpcDataFile.BaseStream.Position); StatusStrip.Update(); } outFile.WriteLine(); outFile.WriteLine(Conversions.ToString(DateAndTime.Now) + " End"); outFile.WriteLine(); outFile.Close(); oNpcDataFile.Close(); ToolStripProgressBar.Value = 0; ToolStripStatusLabel.Text = "Complete."; MessageBox.Show("Done."); }
private void processEvaluate() { String[] sarray = { }; try { toolStripStatusLabelMessage.Text = "Processing..."; statusStrip1.Update(); // Get URL, username and password from registry RetrieveSettings(); // Clear spreadsheet (AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).ExcelApp.Cells.ClearContents(); DeleteCharts(); (AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).ExcelApp.Cells.ClearFormats(); /* * Excel.Range range; * range = (AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).ExcelApp.get_Range("A5", Missing.Value); * range = range.get_Resize(maxRows, colCount); * range.Cells.ClearFormats(); */ HiResTimer hrt = new HiResTimer(); // Remove comments String queryString = System.Text.RegularExpressions.Regex.Replace(syntaxEditBES.Text, @"//.*", string.Empty); queryString = System.Text.RegularExpressions.Regex.Replace(queryString, @"/\*[^/]*/", string.Empty); hrt.Start(); bes.Timeout = Timeout.Infinite; sarray = bes.GetRelevanceResult(queryString, userName, password); hrt.Stop(); TimeSpan t = TimeSpan.FromMilliseconds(hrt.ElapsedMicroseconds / 1000); // toolStripStatusLabelEvalTime.Text = "Evaluation time: " + (hrt.ElapsedMicroseconds / 1000).ToString() + " ms"; toolStripStatusLabelEvalTime.Text = "Query time: " + t.ToString().Remove(t.ToString().Length - 4); toolStripStatusLabelConnectedUser.Text = "Connected as " + userName; toolStripStatusLabelConnectedUser.BackColor = System.Drawing.SystemColors.Control; Array.Sort(sarray); for (int i = 0; i < sarray.Length; i++) { if (toolStripMenuItemSplit.Checked) { oneRow = SplitResults(sarray[i]); for (int j = 0; j < oneRow.Length; j++) { (AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).ExcelApp.Cells[i + 2, j + 1] = oneRow[j]; } } else { (AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).ExcelApp.Cells[i + 2, 1] = sarray[i]; } } (AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).ExcelApp.Columns.AutoFit(); for (int i = 0; i < oneRow.Length; i++) { Excel.Range rangeCol; rangeCol = (AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).ExcelApp.get_Range(excelColumnLetter(i) + "1", excelColumnLetter(i) + "1"); if (Convert.ToInt32(rangeCol.ColumnWidth) > maxColumnWidth) { rangeCol.ColumnWidth = maxColumnWidth; } } (AddinExpress.MSO.ADXAddinModule.CurrentInstance as AddinModule).ExcelApp.get_Range("A1", "A1").Select(); // Just to make the results look good, when only 1 item returned, it will say 1 item, rather than 1 items. if (sarray.Length == 0) { toolStripStatusLabelMessage.Text = "Results: " + sarray.Length + " items returned"; toolStripStatusLabelMessage.BackColor = System.Drawing.Color.LightGreen; return; } else if (sarray.Length == 1) { toolStripStatusLabelMessage.Text = "Results: " + sarray.Length + " item returned"; toolStripStatusLabelMessage.BackColor = System.Drawing.SystemColors.Control; } else if (sarray.Length <= Convert.ToInt32(2000)) { toolStripStatusLabelMessage.Text = "Results: " + sarray.Length + " items returned"; toolStripStatusLabelMessage.BackColor = System.Drawing.SystemColors.Control; } else { toolStripStatusLabelMessage.Text = "Results: " + sarray.Length + " items returned. " + "2000 items displayed"; toolStripStatusLabelMessage.BackColor = System.Drawing.SystemColors.Control; } } catch (Exception ex) { toolStripStatusLabelMessage.Text = "Error: " + ex.Message; toolStripStatusLabelMessage.BackColor = System.Drawing.Color.LightCoral; if ((ex.Message.ToLower().Contains("login failed")) || (ex.Message.ToLower().Contains("remote name could not be resolved")) || (ex.Message.ToLower().Contains("unable to connect to the remote server")) || (ex.Message.ToLower().Contains("invalid uri")) || (ex.Message.ToLower().Contains("uri prefix")) || (ex.Message.ToLower().Contains("connection was closed")) ) { toolStripStatusLabelConnectedUser.Text = "Not connected"; toolStripStatusLabelConnectedUser.BackColor = System.Drawing.Color.LightCoral; } if (ex.Message.ToLower().Contains("object reference not set to an instance of an object")) { toolStripStatusLabelMessage.Text = "Error: " + ex.Message + " - Note that this BigFix AddIn only works for BES 7.2 or above."; toolStripStatusLabelMessage.BackColor = System.Drawing.Color.LightCoral; toolStripStatusLabelConnectedUser.Text = "Not connected"; toolStripStatusLabelConnectedUser.BackColor = System.Drawing.Color.LightCoral; } toolStripStatusLabelEvalTime.Text = ""; } }
/// <summary> /// 【第一步、调用函数 SetUIInChinese 或者 SetUIInUKEnglish】; /// 【第二步、调用函数 ChangeLanguageOfUI】; /// ------------------------------------------------------------------------ /// 修改UI界面语言,请先执行设置语言的函数,然后再执行此函数来调用对应的资源来更新UI: /// 特别注意:调用此函数后,窗体会恢复到初始状态,还需要根据情况再次设置界面的具体内容,例如 visible/enable等属性; /// </summary> /// <param name="TargetSource"目标窗体对应的组件资源对象, /// 请使用此格式来实例化对象:ComponentResourceManager resource = new ComponentResourceManager(typeof(目标窗体类名称)); /// 例如:ComponentResourceManager resource = new ComponentResourceManager(typeof(Form1));></param> /// <param name="TargetControl">目标控件,可以是窗体(this)或者其它 Control 类型,这里只需要 this 就会自动将窗体里面所有的 Control 更新为对应语言的资源</param> public void ChangeLanguageOfUI(ComponentResourceManager TargetSource, Control TargetControl) { try { TargetSource.ApplyResources(TargetControl, TargetControl.Name); TargetControl.ResumeLayout(); //TargetControl.Update(); TargetControl.Refresh(); if (TargetControl is MenuStrip) { //菜单 MenuStrip tempMenu = TargetControl as MenuStrip; tempMenu.SuspendLayout(); foreach (ToolStripMenuItem item in tempMenu.Items) { if (null != item) { TargetSource.ApplyResources(item, item.Name); if (null != item.DropDownItems && item.DropDownItems.Count > 0) { foreach (ToolStripMenuItem subitem in item.DropDownItems) { if (null != subitem) { TargetSource.ApplyResources(subitem, subitem.Name); } } } } } tempMenu.ResumeLayout(); tempMenu.Update(); tempMenu.Refresh(); } else if (TargetControl is StatusStrip) { //状态栏 StatusStrip tempStatusStrip = TargetControl as StatusStrip; tempStatusStrip.SuspendLayout(); foreach (ToolStripStatusLabel item in tempStatusStrip.Items) { if (null != item) { TargetSource.ApplyResources(item, item.Name); } } tempStatusStrip.ResumeLayout(); tempStatusStrip.Update(); tempStatusStrip.Refresh(); } else if (TargetControl is ToolStrip)//如果传入的控件是StatusStrip,这里的判断条件也是 true,这可能是因为继承的关系 { //工具栏按钮 ToolStrip tempToolStrip = TargetControl as ToolStrip; tempToolStrip.SuspendLayout(); foreach (ToolStripButton item in tempToolStrip.Items) { if (null != item) { TargetSource.ApplyResources(item, item.Name); } } tempToolStrip.ResumeLayout(); tempToolStrip.Update(); tempToolStrip.Refresh(); } else if (TargetControl is Form) { //窗体 TargetSource.ApplyResources(TargetControl, "$this"); foreach (Control item in TargetControl.Controls) { if (null != item) { ChangeLanguageOfUI(TargetSource, item); } } TargetControl.ResumeLayout(); TargetControl.Update(); TargetControl.Refresh(); } else if (TargetControl is DataGridView) { //DataGridView DataGridView tempDataGridView = TargetControl as DataGridView; foreach (DataGridViewColumn item in tempDataGridView.Columns) { if (null != item) { TargetSource.ApplyResources(item, item.Name); } } //tempDataGridView.Update(); tempDataGridView.Refresh(); } else if (TargetControl is TreeView) { //TreeView TreeView tempTreeView = TargetControl as TreeView; if (tempTreeView.Nodes.Count > 0) { tempTreeView.SuspendLayout(); TreeNode[] tempTreeNodes = new TreeNode[tempTreeView.Nodes.Count]; for (int i = 0; i < tempTreeView.Nodes.Count; i++) { if (i == 0) { tempTreeNodes[i] = (TreeNode)TargetSource.GetObject(tempTreeView.Name + ".Nodes"); } else { tempTreeNodes[i] = (TreeNode)TargetSource.GetObject(tempTreeView.Name + ".Nodes" + i.ToString()); } } tempTreeView.Nodes.Clear(); tempTreeView.Nodes.AddRange(tempTreeNodes); tempTreeView.ResumeLayout(); } } else if (TargetControl is CheckedListBox) { //CheckedListBox CheckedListBox tempCheckedListBox = TargetControl as CheckedListBox; if (tempCheckedListBox.Items.Count > 0) { object[] tempCheckedListBoxItems = new object[tempCheckedListBox.Items.Count]; for (int i = 0; i < tempCheckedListBox.Items.Count; i++) { if (i == 0) { tempCheckedListBoxItems[i] = TargetSource.GetString(tempCheckedListBox.Name + ".Items"); } else { tempCheckedListBoxItems[i] = TargetSource.GetString(tempCheckedListBox.Name + ".Items" + i.ToString()); } } tempCheckedListBox.Items.Clear(); tempCheckedListBox.Items.AddRange(tempCheckedListBoxItems); tempCheckedListBox.ResumeLayout(); tempCheckedListBox.Update(); tempCheckedListBox.Refresh(); } } else if (TargetControl is ListBox) { //ListBox ListBox tempListBox = TargetControl as ListBox; if (tempListBox.Items.Count > 0) { object[] tempListBoxItems = null;// new object[tempListBox.Items.Count]; int iItemIndexCount = 0; string TempItem = ""; //发生错误:值不能为 null。 //参数名: item; 在 System.Windows.Forms.ListBox.ObjectCollection.AddInternal(Object item) for (int i = 0; i < tempListBox.Items.Count; i++) { if (i == 0) { TempItem = TargetSource.GetString(tempListBox.Name + ".Items"); if (null != TempItem && TempItem != "") { tempListBoxItems = new object[1]; //Array.Resize<object>(ref tempListBoxItems, iItemIndexCount + 1); tempListBoxItems[iItemIndexCount] = TempItem; iItemIndexCount++; } } else { TempItem = TargetSource.GetString(tempListBox.Name + ".Items" + i.ToString()); if (null != TempItem && TempItem != "") { Array.Resize<object>(ref tempListBoxItems, iItemIndexCount + 1); tempListBoxItems[iItemIndexCount] = TempItem; iItemIndexCount++; } } } if (null != tempListBoxItems) { tempListBox.Items.Clear(); tempListBox.Items.AddRange(tempListBoxItems); tempListBox.ResumeLayout(); tempListBox.Update(); tempListBox.Refresh(); } else { ErrorMessage.Enqueue("窗体 " + TargetControl.FindForm().Name + " 的ListBox控件 " + TargetControl.Name + " 子项为空或者没有建立多语言版本的资源"); } } } else if (TargetControl is ListView) { //ListView ListView tempListView = TargetControl as ListView; if (tempListView.Items.Count > 0) { ListViewItem[] tempTreeNodes = new ListViewItem[tempListView.Items.Count]; for (int i = 0; i < tempListView.Items.Count; i++) { if (i == 0) { tempTreeNodes[i] = (ListViewItem)TargetSource.GetObject(tempListView.Name + ".Items"); } else { tempTreeNodes[i] = (ListViewItem)TargetSource.GetObject(tempListView.Name + ".Items" + i.ToString()); } } tempListView.Items.Clear(); tempListView.Items.AddRange(tempTreeNodes); } if (tempListView.Columns.Count > 0) { for (int i = 0; i < tempListView.Columns.Count; i++) { TargetSource.ApplyResources(tempListView.Columns[i], "columnHeader" + (i + 1).ToString()); } } tempListView.ResumeLayout(); tempListView.Update(); tempListView.Refresh(); } else if (TargetControl is ComboBox) { //ComboBox ComboBox tempComboBox = TargetControl as ComboBox; if (tempComboBox.Items.Count > 0) { tempComboBox.SuspendLayout(); object[] AllItems = null;// new object[1];//tempComboBox.Items.Count int iItemIndexCount = 0; string TempItem = ""; // 发生错误:值不能为 null。 // 参数名: item; 在 System.Windows.Forms.ComboBox.ObjectCollection.AddInternal(Object item) for (int i = 0; i < tempComboBox.Items.Count; i++) { if (iItemIndexCount == 0) { //Array.Resize<object>(ref AllItems, iItemIndexCount + 1); TempItem = TargetSource.GetString(tempComboBox.Name + ".Items"); if (null != TempItem && TempItem != "") { AllItems = new object[1]; AllItems[iItemIndexCount] = TempItem; iItemIndexCount++; } // } else { TempItem = TargetSource.GetString(tempComboBox.Name + ".Items" + i.ToString()); if (null != TempItem && TempItem != "") { Array.Resize<object>(ref AllItems, iItemIndexCount + 1); AllItems[iItemIndexCount] = TempItem; iItemIndexCount++; } } } if (null != AllItems) { tempComboBox.Items.Clear(); tempComboBox.Items.AddRange(AllItems); tempComboBox.SelectedIndex = 0; tempComboBox.ResumeLayout(); //tempComboBox.Update(); tempComboBox.Refresh(); } else { ErrorMessage.Enqueue("窗体 " + TargetControl.FindForm().Name + " 的ComboBox控件 " + TargetControl.Name + " 子项为空或者没有建立多语言版本的资源"); } } } else { if (TargetControl.HasChildren == true) { foreach (Control item in TargetControl.Controls) { if (null != item) { ChangeLanguageOfUI(TargetSource, item); } } } } } catch (Exception ex) { //throw ex; ErrorMessage.Enqueue(DateTime.Now.ToString() + "*-*" + "发生错误:" + ex.Message + "; " + ex.StackTrace); } }
private void DeleteImprov_Click(object sender, EventArgs e) { if (this.TypeName.Text == "") { MessageBox.Show("Укажите тип прибора!"); return; } if (this.DocName.Text == "") { MessageBox.Show("Укажите документ-основание!"); return; } StatusStrip.Items["StatusText"].Text = "Процесс начат..."; StatusStrip.Update(); Guid DevicePassportTypeID = new Guid("{42826E25-AD0E-4D9C-8B18-CD88E6796972}"); CardData CardTypeDictionary = Session.CardManager.GetDictionaryData(RefTypes.ID); SectionData DocumentTypes = CardTypeDictionary.Sections[RefTypes.DocumentTypes.ID]; RowData DevicePassportType = DocumentTypes.GetRow(DevicePassportTypeID); RowDataCollection DevicePassportProperties = DevicePassportType.ChildSections[RefTypes.Properties.ID].Rows; SearchQuery searchQuery = Session.CreateSearchQuery(); searchQuery.CombineResults = ConditionGroupOperation.And; CardTypeQuery typeQuery = searchQuery.AttributiveSearch.CardTypeQueries.AddNew(CardOrd.ID); SectionQuery sectionQuery = typeQuery.SectionQueries.AddNew(CardOrd.MainInfo.ID); sectionQuery.Operation = SectionQueryOperation.And; sectionQuery.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery.ConditionGroup.Conditions.AddNew("Type", FieldType.RefId, ConditionOperation.Equals, DevicePassportTypeID); sectionQuery = typeQuery.SectionQueries.AddNew(CardOrd.Properties.ID); sectionQuery.Operation = SectionQueryOperation.And; sectionQuery.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery.ConditionGroup.Conditions.AddNew("Name", FieldType.String, ConditionOperation.Equals, "Прибор"); sectionQuery.ConditionGroup.Conditions.AddNew("Value", FieldType.RefId, ConditionOperation.Equals, DeviceType.Id); sectionQuery = typeQuery.SectionQueries.AddNew(CardOrd.SelectedValues.ID); sectionQuery.Operation = SectionQueryOperation.And; sectionQuery.ConditionGroup.Operation = ConditionGroupOperation.And; sectionQuery.ConditionGroup.Conditions.AddNew("SelectedValue", FieldType.RefCardId, ConditionOperation.Equals, Document.Id); // Получение текста запроса searchQuery.Limit = 0; string query = searchQuery.GetXml(); Console.WriteLine(query); Console.ReadLine(); CardDataCollection coll = Session.CardManager.FindCards(query); Clear(); StatusStrip.Items["StatusText"].Text = "Найдено паспортов: " + coll.Count.ToString() + "..."; StatusStrip.Update(); int i = 0; for (i = 0; i < coll.Count; i++) { CardData Card = coll[i]; Card.ForceUnlock(); StatusStrip.Items["StatusText"].Text = i.ToString() + " из " + coll.Count + ". " + Card.Description; StatusStrip.Update(); SectionData Properties = Card.Sections[CardOrd.Properties.ID]; RowDataCollection DocumentCol = Properties.FindRow("@Name = 'Документ'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowData DocumentRow = DocumentCol.First(r => new Guid(r.GetString("SelectedValue")).Equals(Document.Id)); if (DocumentRow != null) { int Order = (int)DocumentRow.GetInt32("Order"); RowDataCollection Assembly = Properties.FindRow("@Name = 'Сборочный узел'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection RepareItem = Properties.FindRow("@Name = 'Запись справочника ремонтных работ и доработок'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Indication = Properties.FindRow("@Name = 'Указание'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Check = Properties.FindRow("@Name = 'Выполнено'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection CheckDate = Properties.FindRow("@Name = 'Дата выполнения'").ChildSections[CardOrd.SelectedValues.ID].Rows; RowDataCollection Comments = Properties.FindRow("@Name = 'Комментарии'").ChildSections[CardOrd.SelectedValues.ID].Rows; if (Assembly.FirstOrDefault(r => r.GetInt32("Order") == Order) != null) { Assembly.Remove(Assembly.First(r => r.GetInt32("Order") == Order).Id); } if (RepareItem.FirstOrDefault(r => r.GetInt32("Order") == Order) != null) { RepareItem.Remove(RepareItem.First(r => r.GetInt32("Order") == Order).Id); } if (Indication.FirstOrDefault(r => r.GetInt32("Order") == Order) != null) { Indication.Remove(Indication.First(r => r.GetInt32("Order") == Order).Id); } if (Check.FirstOrDefault(r => r.GetInt32("Order") == Order) != null) { Check.Remove(Check.First(r => r.GetInt32("Order") == Order).Id); } if (CheckDate.FirstOrDefault(r => r.GetInt32("Order") == Order) != null) { CheckDate.Remove(CheckDate.First(r => r.GetInt32("Order") == Order).Id); } if (Comments.FirstOrDefault(r => r.GetInt32("Order") == Order) != null) { Comments.Remove(Comments.First(r => r.GetInt32("Order") == Order).Id); } DocumentCol.Remove(DocumentRow.Id); } Clear(); } StatusStrip.Items["StatusText"].Text = i.ToString() + " карточек успешно обработано."; StatusStrip.Update(); }
private string[] FuncArr3 = new string[1001]; // name private void ButtonFetch_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(ComboBoxFixType.Text)) { MessageBox.Show("Select target to fix", "Select target", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string AiFile; string AiFuncFile; OpenFileDialog.Filter = "Lineage II AI file|*.obj|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } AiFile = OpenFileDialog.FileName; OpenFileDialog.Filter = "Lineage II AI " + ComboBoxFixType.Text + " fix file|*.txt|All files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } AiFuncFile = OpenFileDialog.FileName; string TempStr; // Loading all func in table var TempArr = new string[3]; int ArrMarker = -1; var inAiFix = new System.IO.StreamReader(AiFuncFile, System.Text.Encoding.Default, true, 1); if ((inAiFix.ReadLine() ?? "") != ("[" + ComboBoxFixType.Text + "]" ?? "")) { MessageBox.Show("Wrong file type. Waiting list for '" + ComboBoxFixType.Text + "'. Select valid file", "Wrong fix file", MessageBoxButtons.OK, MessageBoxIcon.Error); inAiFix.Close(); return; } ToolStripProgressBar.Maximum = Conversions.ToInteger(inAiFix.BaseStream.Length); ToolStripProgressBar.Value = 0; while (inAiFix.EndOfStream != true) { TempStr = inAiFix.ReadLine().Trim(); if (!string.IsNullOrEmpty(TempStr) & TempStr.StartsWith("//") == false) { if ((ComboBoxFixType.Text ?? "") == "func_call") { TempStr = TempStr.Replace(",", "|"); } TempArr = TempStr.Split((char)124); // 124 - | ArrMarker += 1; FuncArr1[ArrMarker] = TempArr[0]; // id FuncArr2[ArrMarker] = TempArr[1]; // marker ([QUEST_ACCEPTED,default], [0,1,2], [QUEST_ACCEPTED,default]) FuncArr3[ArrMarker] = TempArr[2]; // name (fetch_i (creature), func (ShowPage), event (704)) ToolStripProgressBar.Value = Conversions.ToInteger(inAiFix.BaseStream.Length / (double)inAiFix.BaseStream.Position * 100); } this.Update(); } inAiFix.Close(); ToolStripProgressBar.Value = 0; // Work with ai.obj System.IO.File.Copy(AiFile, System.IO.Path.GetDirectoryName(AiFile) + @"\" + System.IO.Path.GetFileNameWithoutExtension(AiFile) + ".bak", true); var inAi = new System.IO.StreamReader( System.IO.Path.GetDirectoryName(AiFile) + @"\" + System.IO.Path.GetFileNameWithoutExtension(AiFile) + ".bak", System.Text.Encoding.Default, true, 1); var outAi = new System.IO.StreamWriter(AiFile, false, System.Text.Encoding.Unicode, 1); var outAiLog = new System.IO.StreamWriter( System.IO.Path.GetDirectoryName(AiFile) + @"\" + System.IO.Path.GetFileNameWithoutExtension(AiFile) + ".log", LogOverwriteCheckBox.Checked, System.Text.Encoding.Unicode, 1); outAiLog.WriteLine("L2ScriptMaker AI.obj check and fix." + Constants.vbNewLine + DateAndTime.Now.ToString() + Constants.vbNewLine + "Work with " + ComboBoxFixType.Text + Constants.vbNewLine); string sTemp; int iTemp; // check controls string ClassNameMarker = ""; string HandlerNameMarker = ""; string LastPushConstMarker = ""; long LineNum = 1; ToolStripProgressBar.Maximum = Conversions.ToInteger(inAi.BaseStream.Length); ToolStripProgressBar.Value = 0; while (inAi.EndOfStream != true) { TempStr = inAi.ReadLine(); // TempStr = TempStr.Trim LineNum += 1; ToolStripProgressBar.Value = Conversions.ToInteger(inAi.BaseStream.Position); StatusStrip.Update(); this.Update(); if (TempStr.StartsWith("class ") == true) { ClassNameMarker = TempStr; } if (TempStr.StartsWith("handler ") == true) { HandlerNameMarker = TempStr.Remove(0, Strings.InStr(TempStr, "//") + 2).Trim(); } if (Strings.InStr(6, TempStr, "//") != 0 & Strings.InStr(TempStr, ComboBoxFixType.Text) == 0) { // If InStr(6, TempStr, "push_event") <> 0 And (ComboBoxFixType.Text = "func_call" Or ComboBoxFixType.Text = "fetch_i") Then // push_event // myself // push_const 704 // add // fetch_i // c_ai1 // push_const 384 // add // fetch_i // name // push_const 104 // Write previous line // outAi.WriteLine(TempStr) // TempStr = inAi.ReadLine // LastPushConstMarker = TempStr.Replace(Chr(9), Chr(32)).Replace("push_const", "").Trim LastPushConstMarker = Strings.Mid(TempStr, Strings.InStr(TempStr, "//") + 2, TempStr.Length - (Strings.InStr(TempStr, "//") + 1)).Trim(); } if (Strings.InStr(TempStr, ComboBoxFixType.Text) != 0 & TempStr.Trim().StartsWith("//") == false & Strings.InStr(5, TempStr, "//") != 0) { switch (ComboBoxFixType.Text) { case "fetch_i": { // fetch_i // param2 // push_const 2272 // Write previous line outAi.WriteLine(TempStr); // Define name for fetch_i sTemp = Strings.Mid(TempStr, Strings.InStr(TempStr, "//") + 2, TempStr.Length - (Strings.InStr(TempStr, "//") + 1)).Trim(); iTemp = Array.IndexOf(FuncArr3, sTemp); if (iTemp == -1) { // MessageBox.Show(ComboBoxFixType.Text + " not found in table!" + vbNewLine + TempStr, "Not found", MessageBoxButtons.OK, MessageBoxIcon.Error) outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine(">>>>>> Not found :" + Constants.vbNewLine + TempStr + Constants.vbNewLine); break; } TempStr = inAi.ReadLine(); LineNum += 1; if (Strings.InStr(TempStr, "push_const") == 0) { outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine(ComboBoxFixType.Text + " definition failed. Waiting push_const next after " + ComboBoxFixType.Text + Constants.vbNewLine + TempStr); outAi.WriteLine(TempStr); inAi.Close(); outAi.Close(); outAiLog.Close(); MessageBox.Show( "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + (ComboBoxFixType.Text + " definition failed. Waiting push_const next after " + ComboBoxFixType.Text + Constants.vbNewLine + TempStr), "Definition failed", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } iTemp = FindIndex(sTemp, LastPushConstMarker); if (iTemp == -1) { iTemp = FindIndex(sTemp, HandlerNameMarker); if (iTemp == -1) { iTemp = FindIndex(sTemp, "default"); if (iTemp == -1) { outAi.WriteLine(TempStr); outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine("Warning! Required 'default' for '" + sTemp + "'. Ignored."); outAiLog.WriteLine("Debug info:" + Constants.vbNewLine + "Fixed class: " + ClassNameMarker + Constants.vbNewLine + "Fixed handler: " + HandlerNameMarker + Constants.vbNewLine + "Last push_const: " + LastPushConstMarker); break; } } } if ((TempStr.Trim() ?? "") != ("push_const " + FuncArr1[iTemp] ?? "")) { outAiLog.WriteLine("Fix to: '" + FuncArr3[iTemp] + "'" + Constants.vbNewLine + "Fixed class: " + ClassNameMarker + Constants.vbNewLine + "Fixed handler: " + HandlerNameMarker + Constants.vbNewLine + "Last push_const: " + LastPushConstMarker); outAiLog.WriteLine("Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine("Fix as:" + TempStr + " --> " + "push_const " + FuncArr1[iTemp] + Constants.vbNewLine); TempStr = Conversions.ToString((char)9) + "push_const " + FuncArr1[iTemp]; } LastPushConstMarker = sTemp; break; } case "push_event": { // push_event // myself // push_const 704 // Write previous line outAi.WriteLine(TempStr); // Define name for push_event sTemp = Strings.Mid(TempStr, Strings.InStr(TempStr, "//") + 2, TempStr.Length - (Strings.InStr(TempStr, "//") + 1)).Trim(); iTemp = Array.IndexOf(FuncArr3, sTemp); if (iTemp == -1) { outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine(">>>>>> Not found :" + Constants.vbNewLine + TempStr + Constants.vbNewLine); break; } TempStr = inAi.ReadLine(); LineNum += 1; if (Strings.InStr(TempStr, "push_const") == 0) { outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine(ComboBoxFixType.Text + " definition failed. Waiting push_const next after " + ComboBoxFixType.Text + Constants.vbNewLine + TempStr); outAi.WriteLine(TempStr); inAi.Close(); outAi.Close(); outAiLog.Close(); MessageBox.Show( "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + (ComboBoxFixType.Text + " definition failed. Waiting push_const next after " + ComboBoxFixType.Text + Constants.vbNewLine + TempStr), "Definition failed", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } iTemp = FindIndex(sTemp, LastPushConstMarker); if (iTemp == -1) { iTemp = FindIndex(sTemp, HandlerNameMarker); if (iTemp == -1) { iTemp = FindIndex(sTemp, "default"); if (iTemp == -1) { outAi.WriteLine(TempStr); outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine("Warning! Required 'default' for '" + sTemp + "'. Ignored."); outAiLog.WriteLine("Debug info:" + Constants.vbNewLine + "Fixed class: " + ClassNameMarker + Constants.vbNewLine + "Fixed handler: " + HandlerNameMarker + Constants.vbNewLine + "Last push_const: " + LastPushConstMarker); break; } } } if ((TempStr.Trim() ?? "") != ("push_const " + FuncArr1[iTemp] ?? "")) { outAiLog.WriteLine("Fix to: '" + FuncArr3[iTemp] + "'" + Constants.vbNewLine + "Fixed class: " + ClassNameMarker + Constants.vbNewLine + "Fixed handler: " + HandlerNameMarker + Constants.vbNewLine + "Last push_const: " + LastPushConstMarker); outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine("Fix as:" + TempStr + " --> " + "push_const " + FuncArr1[iTemp] + Constants.vbNewLine); TempStr = Conversions.ToString((char)9) + "push_const " + FuncArr1[iTemp]; } LastPushConstMarker = FuncArr1[iTemp]; break; } case "func_call": { sTemp = Strings.Mid(TempStr, Strings.InStr(TempStr, "func["), Strings.InStr(TempStr, "]") - Strings.InStr(TempStr, "func[") + 1); iTemp = Array.IndexOf(FuncArr3, sTemp); if (iTemp == -1) { outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine("Func not found in table!" + Constants.vbNewLine + TempStr, "Func_call not found", MessageBoxButtons.OK, MessageBoxIcon.Error); inAi.Close(); outAi.Close(); outAiLog.Close(); MessageBox.Show( "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Func not found in table!" + Constants.vbNewLine + TempStr, "Func_call not found", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } iTemp = FindIndex(sTemp, LastPushConstMarker); if (iTemp == -1) { iTemp = FindIndex(sTemp, HandlerNameMarker); if (iTemp == -1) { iTemp = FindIndex(sTemp, "default"); if (iTemp == -1) { outAi.WriteLine(TempStr); outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine("Warning! Required 'default' for '" + sTemp + "'. Ignored."); outAiLog.WriteLine("Debug info:" + Constants.vbNewLine + "Fixed class: " + ClassNameMarker + Constants.vbNewLine + "Fixed handler: " + HandlerNameMarker + Constants.vbNewLine + "Last push_const: " + LastPushConstMarker); break; } } } if ((Strings.Mid(TempStr, Strings.InStr(TempStr, "func_call ") + 10, Strings.InStr(TempStr, "// ") - Strings.InStr(TempStr, "func_call ") - 10) .Trim() ?? "") != (FuncArr1[iTemp] ?? "")) { outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine("Fix to: '" + FuncArr3[iTemp] + "'" + Constants.vbNewLine + "Fixed class: " + ClassNameMarker + Constants.vbNewLine + "Fixed handler: " + HandlerNameMarker + Constants.vbNewLine + "Fix " + Strings.Mid(TempStr, Strings.InStr(TempStr, "func_call ") + 10, Strings.InStr(TempStr, "// ") - Strings.InStr(TempStr, "func_call ") - 10).Trim() + " to " + FuncArr1[iTemp] + Constants.vbNewLine); TempStr = TempStr.Replace( Strings.Mid(TempStr, Strings.InStr(TempStr, "func_call ") + 10, Strings.InStr(TempStr, "// ") - Strings.InStr(TempStr, "func_call ") - 10) .Trim(), FuncArr1[iTemp]); } break; } case "handler": { // handler 3 138 // TALKED // HandlerNameMarker // Define name for push_event // sTemp = Mid(TempStr, (InStr(TempStr, "//") + 2), TempStr.Length - (InStr(TempStr, "//") + 1)).Trim sTemp = HandlerNameMarker; iTemp = Array.IndexOf(FuncArr3, sTemp); if (iTemp == -1) { outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine(">>>>>> Not found :" + Constants.vbNewLine + TempStr + Constants.vbNewLine); break; } if (TempStr.StartsWith("handler " + FuncArr1[iTemp] + " ") == false) { string[] tempStr2; tempStr2 = TempStr.Replace((char)9, (char)32).Split((char)32); TempStr = "handler " + FuncArr1[iTemp] + " " + tempStr2[2] + Conversions.ToString((char)9) + "//" + Conversions.ToString((char)9) + FuncArr3[iTemp]; outAiLog.WriteLine(Constants.vbNewLine + "Line: " + Conversions.ToString(LineNum) + Constants.vbTab + "Class: " + ClassNameMarker + Constants.vbTab + "Handler: " + HandlerNameMarker); outAiLog.WriteLine("Fix to: '" + FuncArr3[iTemp] + "'" + Constants.vbNewLine + "Fixed class: " + ClassNameMarker + Constants.vbNewLine + "Fixed handler: " + HandlerNameMarker + Constants.vbNewLine + "Fix " + tempStr2[1] + " to " + FuncArr1[iTemp] + Constants.vbNewLine); } break; } default: { outAi.WriteLine(TempStr); break; } } } outAi.WriteLine(TempStr); } outAiLog.WriteLine(Constants.vbNewLine + "Work complete" + Constants.vbNewLine + DateAndTime.Now.ToString() + Constants.vbNewLine); ToolStripProgressBar.Value = 0; inAi.Close(); outAi.Close(); outAiLog.Close(); MessageBox.Show("Fixing done. Check Log file for full information.", "Complete", MessageBoxButtons.OK); }
public static void ToolStripText(ToolStripLabel toolStripLabel, ref StatusStrip SS, String text) { toolStripLabel.Text = text; SS.Invalidate(); SS.Update(); }