private void backgroundLoader_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            try{
                string labelText = null;
                switch (e.ProgressPercentage)
                {
                case 1:
                    labelText = "Loading settings...";
                    break;

                case 2:
                    labelText = "Testing interaction web service";
                    break;

                case 3:
                    labelText = "Testing VTL DB";
                    break;

                case 4:
                    labelText = "Testing validation web service";
                    break;

                case 5:
                    labelText = "Testing SDMX metadata web service";
                    break;
                }

                StatusLabel.Text = labelText;
                StatusLabel.Refresh();
            }
            catch (Exception ex)
            {
                CommonItem.ErrManger.ErrorManagement(ex, false, this);
            }
        }
Ejemplo n.º 2
0
 public void ST(string msg)
 {
     try {
         StatusLabel.Text = msg;
         StatusLabel.Update();
         StatusLabel.Refresh();
     }
     catch
     {
     }
 }
Ejemplo n.º 3
0
        void FilterUnused(HashSet <string> filesToCheck, List <string> jclFiles, List <string> nonJclFiles)
        {
            int           counter   = 0;
            List <string> filesList = new List <string>(filesToCheck);

            foreach (string file in nonJclFiles)
            {
                counter++;
                percent = (counter * 100) / FilesFromRepository.Count;

                StatusLabel.Content = percent.ToString();
                StatusLabel.Refresh();
                CheckNonJCL(file, filesList);
            }
            foreach (string file in jclFiles)
            {
                counter++;
                percent             = (counter * 100) / FilesFromRepository.Count;
                StatusLabel.Content = percent.ToString();
                StatusLabel.Refresh();
                CheckJCL(file, filesList);
            }
        }
Ejemplo n.º 4
0
        private void BGWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            BgWorkerInformation BgData = (BgWorkerInformation)e.Argument;

            string[] VarLines = BgData.VarText.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);


            int           NumVars         = 0;
            List <string> VarPlaceholders = new List <string>();

            //get all of the split out info into a list
            List <Array> VarList = new List <Array>();

            for (int i = 0; i < VarLines.Length; i++)
            {
                string[] VarList_Split = (VarLines[i].Trim().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries));
                if (VarList_Split.Length > 1)
                {
                    NumVars++;
                    VarList.Add(VarList_Split.ToList().GetRange(1, VarList_Split.Length - 1).ToArray());
                    VarPlaceholders.Add(VarList_Split[0]);
                }
            }


            try {
                StatusLabel.Invoke((MethodInvoker) delegate
                {
                    StatusLabel.Text = "Recursing variable combinations... This might take a while...";
                });

                //Set up our code


                List <string> RecursedVars = Recursion(0, VarList).Distinct().ToList();


                using (StreamWriter outputFile = new StreamWriter(new FileStream(BgData.FileOutputLocation, FileMode.Create, FileAccess.Write), Encoding.UTF8))
                {
                    outputFile.WriteLine("Input Variable Data:");
                    outputFile.WriteLine(BgData.VarText + "\r\n\r\n");
                    outputFile.WriteLine("Input Code Data:");
                    outputFile.WriteLine(BgData.CodeText + "\r\n\r\n");
                    outputFile.WriteLine("Code Output:\r\n");

                    int LineCount = RecursedVars.Count;
                    LineCountString = LineCount.ToString();

                    for (int i = 0; i < LineCount; i++)
                    {
                        StringBuilder OutputCode = new StringBuilder();
                        OutputCode.Append(BgData.CodeText);

                        StatusLabel.Invoke((MethodInvoker) delegate {
                            StatusLabel.Text = "Writing line " + (i + 1).ToString() + " of " + LineCountString;
                            StatusLabel.Invalidate();
                            StatusLabel.Update();
                            StatusLabel.Refresh();
                            Application.DoEvents();
                        });

                        string[] Var_Replacements = RecursedVars[i].Split(' ');
                        for (int j = 0; j < NumVars; j++)
                        {
                            OutputCode.Replace(VarPlaceholders[j], Var_Replacements[j]);
                        }

                        outputFile.WriteLine(OutputCode.ToString());
                    }
                }


                e.Result = BgData.FileOutputLocation;
            }
            catch
            {
                MessageBox.Show("An error occurred while building your code.", "Ruh-roh!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.Result = null;
            }
        }
Ejemplo n.º 5
0
        private void BgWorkerClean_DoWork(object sender, DoWorkEventArgs e)
        {
            DictionaryData BGWorkerData = (DictionaryData)e.Argument;

            TranslationClient client = TranslationClient.Create();


            //selects the text encoding based on user selection
            Encoding InputSelectedEncoding  = null;
            Encoding OutputSelectedEncoding = null;

            this.Invoke((MethodInvoker) delegate()
            {
                InputSelectedEncoding  = Encoding.GetEncoding(InputEncodingDropdown.SelectedItem.ToString());
                OutputSelectedEncoding = Encoding.GetEncoding(OutputEncodingDropdown.SelectedItem.ToString());
            });



            //get the list of files
            var SearchDepth = SearchOption.TopDirectoryOnly;

            if (ScanSubfolderCheckbox.Checked)
            {
                SearchDepth = SearchOption.AllDirectories;
            }
            var files = Directory.EnumerateFiles(BGWorkerData.TextFileFolder, BGWorkerData.FileExtension, SearchDepth);



            try {
                foreach (string fileName in files)
                {
                    if (e.Cancel)
                    {
                        break;
                    }



                    //set up our variables to report
                    string Filename_Clean = Path.GetFileName(fileName);

                    string SubDirStructure = Path.GetDirectoryName(fileName).Replace(BGWorkerData.TextFileFolder, "").TrimStart('\\');


                    //creates subdirs if they don't exist
                    string Output_Location = BGWorkerData.OutputFileLocation + '\\' + SubDirStructure;

                    if (!Directory.Exists(Output_Location))
                    {
                        Directory.CreateDirectory(Output_Location);
                    }

                    Output_Location = Path.Combine(Output_Location, Path.GetFileName(fileName));

                    //report what we're working on
                    FilenameLabel.Invoke((MethodInvoker) delegate
                    {
                        FilenameLabel.Text = "Processing: " + Filename_Clean;
                        FilenameLabel.Invalidate();
                        FilenameLabel.Update();
                        FilenameLabel.Refresh();
                        Application.DoEvents();
                    });



                    // __        __    _ _          ___        _               _
                    // \ \      / / __(_) |_ ___   / _ \ _   _| |_ _ __  _   _| |_
                    //  \ \ /\ / / '__| | __/ _ \ | | | | | | | __| '_ \| | | | __|
                    //   \ V  V /| |  | | ||  __/ | |_| | |_| | |_| |_) | |_| | |_
                    //    \_/\_/ |_|  |_|\__\___|  \___/ \__,_|\__| .__/ \__,_|\__|
                    //                                            |_|


                    using (StreamReader inputfile = new StreamReader(fileName, InputSelectedEncoding))
                    {
                        if (e.Cancel)
                        {
                            break;
                        }

                        string readText = inputfile.ReadToEnd();

                        string[] readText_Chunked = new string[0];

                        if (!string.IsNullOrWhiteSpace(readText))
                        {
                            readText_Chunked = SplitStringByLength(readText, BGWorkerData.MaxCharsPerRequest);
                        }

                        StringBuilder TranslatedText_Output = new StringBuilder();

                        for (int i = 0; i < readText_Chunked.Length; i++)
                        {
                            if (e.Cancel)
                            {
                                break;
                            }

                            try
                            {
                                if (e.Cancel)
                                {
                                    break;
                                }

                                StatusLabel.Invoke((MethodInvoker) delegate
                                {
                                    StatusLabel.Text = "Status: Sending request " + (i + 1).ToString() + "/" + readText_Chunked.Length.ToString() + " to API...";
                                    StatusLabel.Invalidate();
                                    StatusLabel.Update();
                                    StatusLabel.Refresh();
                                    Application.DoEvents();
                                });

                                var response = client.TranslateText(readText_Chunked[i],
                                                                    sourceLanguage: BGWorkerData.InputLang,
                                                                    targetLanguage: BGWorkerData.OutputLang);

                                TranslatedText_Output.Append(response.TranslatedText + " ");
                            }
                            catch (Google.GoogleApiException ex)
                            {
                                if (e.Cancel)
                                {
                                    break;
                                }

                                if (ex.Error.Code == 403)
                                {
                                    if (ex.Error.Message.Contains("Daily Limit Exceeded"))
                                    {
                                        //report what we're working on
                                        StatusLabel.Invoke((MethodInvoker) delegate
                                        {
                                            StatusLabel.Text = "Status: " + ex.Error.Message;
                                            StatusLabel.Invalidate();
                                            StatusLabel.Update();
                                            StatusLabel.Refresh();
                                            Application.DoEvents();
                                        });

                                        MessageBox.Show("The Google Translate API reports that you have exceeded your daily use limit. You will need to visit the \"Quotas\" section of the Google Cloud Dashboard to increase your limits or, alternatively, wait until midnight for your quota to reset.", "Daily Limit Exceeded", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                                        e.Cancel = true;
                                        break;
                                    }

                                    else
                                    {
                                        if (e.Cancel)
                                        {
                                            break;
                                        }

                                        int retry_counter = 0;
                                        while (retry_counter < BGWorkerData.MaxRetries)
                                        {
                                            retry_counter++;

                                            int      TimerCounter = 0;
                                            DateTime d            = DateTime.Now;

                                            while (TimerCounter < BGWorkerData.DurationLength + 2)
                                            {
                                                TimeSpan ts = DateTime.Now.Subtract(d);
                                                if (ts.Seconds >= 1)
                                                {
                                                    //do some work
                                                    TimerCounter += ts.Seconds;
                                                    d             = DateTime.Now;

                                                    //report what we're working on
                                                    StatusLabel.Invoke((MethodInvoker) delegate
                                                    {
                                                        StatusLabel.Text = "Status: Rate limit reached. Sleeping for " + (BGWorkerData.DurationLength - TimerCounter + 1).ToString() + "...";
                                                        StatusLabel.Invalidate();
                                                        StatusLabel.Update();
                                                        StatusLabel.Refresh();
                                                        Application.DoEvents();
                                                    });
                                                }
                                            }

                                            try
                                            {
                                                //report what we're working on
                                                StatusLabel.Invoke((MethodInvoker) delegate
                                                {
                                                    StatusLabel.Text = "Status: Sending request " + (i + 1).ToString() + "/" + readText_Chunked.Length.ToString() + " to API... Retry #" + retry_counter.ToString();
                                                    StatusLabel.Invalidate();
                                                    StatusLabel.Update();
                                                    StatusLabel.Refresh();
                                                    Application.DoEvents();
                                                });

                                                var response = client.TranslateText(readText_Chunked[i],
                                                                                    sourceLanguage: BGWorkerData.InputLang,
                                                                                    targetLanguage: BGWorkerData.OutputLang);

                                                TranslatedText_Output.Append(response.TranslatedText + " ");

                                                retry_counter = BGWorkerData.MaxRetries;
                                            }
                                            catch
                                            {
                                            }
                                        }
                                    }
                                }

                                else if (ex.Error.Code == 429 || (ex.Error.Code >= 500 && ex.Error.Code < 600))
                                {
                                    int retry_counter = 0;
                                    while (retry_counter < BGWorkerData.MaxRetries)
                                    {
                                        retry_counter++;

                                        int      TimerCounter = 0;
                                        DateTime d            = DateTime.Now;

                                        while (TimerCounter < System.Math.Pow(retry_counter, 2))
                                        {
                                            TimeSpan ts = DateTime.Now.Subtract(d);
                                            if (ts.Seconds >= 1)
                                            {
                                                //do some work
                                                TimerCounter += ts.Seconds;
                                                d             = DateTime.Now;

                                                //report what we're working on
                                                StatusLabel.Invoke((MethodInvoker) delegate
                                                {
                                                    StatusLabel.Text = "Status: Error " + ex.Error.Code.ToString() + "; " + ex.Error.Message + " -- Retrying in " + (BGWorkerData.DurationLength - TimerCounter + 1).ToString() + "...";
                                                    StatusLabel.Invalidate();
                                                    StatusLabel.Update();
                                                    StatusLabel.Refresh();
                                                    Application.DoEvents();
                                                });
                                            }
                                        }

                                        try
                                        {
                                            //report what we're working on
                                            StatusLabel.Invoke((MethodInvoker) delegate
                                            {
                                                StatusLabel.Text = "Status: Sending request " + (i + 1).ToString() + "/" + readText_Chunked.Length.ToString() + " to API... Retry #" + retry_counter.ToString();
                                                StatusLabel.Invalidate();
                                                StatusLabel.Update();
                                                StatusLabel.Refresh();
                                                Application.DoEvents();
                                            });

                                            var response = client.TranslateText(readText_Chunked[i],
                                                                                sourceLanguage: BGWorkerData.InputLang,
                                                                                targetLanguage: BGWorkerData.OutputLang);

                                            TranslatedText_Output.Append(response.TranslatedText + " ");

                                            retry_counter = BGWorkerData.MaxRetries;
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }

                                else
                                {
                                    //report what we're working on
                                    StatusLabel.Invoke((MethodInvoker) delegate
                                    {
                                        StatusLabel.Text = "Status: " + ex.Error.Message;
                                        StatusLabel.Invalidate();
                                        StatusLabel.Update();
                                        StatusLabel.Refresh();
                                        Application.DoEvents();
                                    });
                                }
                            }
                        }



                        //open up the output file
                        using (StreamWriter outputFile = new StreamWriter(new FileStream(Output_Location, FileMode.Create), OutputSelectedEncoding))
                        {
                            outputFile.Write(TranslatedText_Output.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Transmogrifier encountered an issue somewhere while trying to translate your texts. The most common cause of this is trying to open your output file(s) while the program is still running. Did any of your input files move, or is your output file being opened/modified by another application? " +
                                "After clicking the \"OK\" Button, you will receive an error code. Please write down this error code (or take a screenshot) and contact the software's author ([email protected]) for additional help.", "Error while translating", MessageBoxButtons.OK, MessageBoxIcon.Error);

                MessageBox.Show(ex.ToString(), "Error Code", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 6
0
 public void StatusUpdate(string text)
 {
     StatusLabel.Text = text;
     StatusLabel.Refresh();
 }
Ejemplo n.º 7
0
        private void QuestPchButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog.FileName = "";
            OpenFileDialog.Filter   = "Lineage II config (itemdata.txt)|itemdata.txt|All files (*.*)|*.*";
            if (OpenFileDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            string QuestDataDir = System.IO.Path.GetDirectoryName(OpenFileDialog.FileName);

            if (System.IO.File.Exists("ai.obj") == false | System.IO.File.Exists("questname-e.txt") == false)
            {
                MessageBox.Show("Required all files (itemdata.txt and ai.obj and questname-e.txt) for generation", "Required files not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Initialization

            // quest_begin	id=257	level=1	name=[The Guard is Busy]
            // quest_begin	id=1	level=1	name=[Letters of Love]
            var QuestPchName = new string[2001];
            // [guard_is_busy1]	257
            // [letters_of_love1](1)

            var QuestPch2Name = new string[2001];
            // 257 4 1084 752 1085 1086  QuestPch2Name(257)
            // 1 4 687 688 1079 1080     QuestPch2Name(1)

            var UnDestrItems = new string[30001];

            // Dim inQuestEFile As New System.IO.StreamReader("questname-e.txt", System.Text.Encoding.Default, True, 1)
            // Dim inItemFile As New System.IO.StreamReader("itemdata.txt", System.Text.Encoding.Default, True, 1)
            // Dim inAiFile As New System.IO.StreamReader("ai.obj", System.Text.Encoding.Default, True, 1)

            // Dim outQuestPchFile As New System.IO.StreamWriter(QuestDataDir + "\quest_pch.txt", False, System.Text.Encoding.Unicode, 1)
            // Dim outQuestPch2File As New System.IO.StreamWriter(QuestDataDir + "\quest_pch2.txt", False, System.Text.Encoding.Unicode, 1)
            var outLogFile = new System.IO.StreamWriter(QuestDataDir + @"\quest_pch.log", true, System.Text.Encoding.Unicode, 1);

            outLogFile.WriteLine("L2ScriptMaker QuestPch/Pch2 Builder" + Constants.vbNewLine + DateAndTime.Now.ToString() + " Start" + Constants.vbNewLine);

            string sTemp;
            var    aTemp = new string[0];
            int    iTemp;

            var inQuestEFile = new System.IO.StreamReader("questname-e.txt", System.Text.Encoding.Default, true, 1);

            ProgressBar.Maximum = Conversions.ToInteger(inQuestEFile.BaseStream.Length);
            ProgressBar.Value   = 0;
            StatusLabel.Text    = "Loading quest names and generate quest_pch.txt ...";
            StatusLabel.Refresh();

            // Loading Quests Name to QuestPchName and Generate quest_pch
            // quest_begin	id=257	level=1	name=[The Guard is Busy]
            // quest_begin	id=1	level=1	name=[Letters of Love]
            // Dim QuestPchName(2000) As String
            // [guard_is_busy1]	257
            // [letters_of_love1] 1

            while (inQuestEFile.EndOfStream != true)
            {
                sTemp = inQuestEFile.ReadLine();
                // aTemp = sTemp.Split(Chr(9))
                // iTemp = CInt(aTemp(1).Remove(0, 3))
                iTemp = Conversions.ToInteger(Libraries.GetNeedParamFromStr(sTemp, "quest_id"));
                if (string.IsNullOrEmpty(QuestPchName[iTemp]))
                {
                    // QuestPchName(iTemp) = aTemp(3).Remove(0, 5)
                    QuestPchName[iTemp] = Libraries.GetNeedParamFromStr(sTemp, "main_name");
                    QuestPchName[iTemp] = QuestPchName[iTemp].Replace("  ", " ").Replace(" ", "_").ToLower().Trim();
                    QuestPchName[iTemp] = QuestPchName[iTemp].Replace("'", "").Replace("!", "").Replace(".", "").Replace(",", "").Replace("?", "");
                }

                ProgressBar.Value = Conversions.ToInteger(inQuestEFile.BaseStream.Position);
            }
            inQuestEFile.Close();
            ProgressBar.Value = 0;

            // item_begin	weapon	1	[small_sword]	item_type=weapon	slot_bit_type={rhand}	armor_type=none	etcitem_type=none	recipe_id=0	blessed=0	weight=1600	default_action=action_equip	consume_type=consume_type_normal	initial_count=1	maximum_count=1	soulshot_count=1	spiritshot_count=1	reduced_soulshot={}	reduced_spiritshot={}	reduced_mp_consume={}	immediate_effect=1	price=0	default_price=768	item_skill=[none]	critical_attack_skill=[none]	attack_skill=[none]	magic_skill=[none]	item_skill_enchanted_four=[none]	material_type=steel	crystal_type=none	crystal_count=0	is_trade=1	is_drop=1
            // is_destruct=1	physical_damage=8	random_damage=10	weapon_type=sword	can_penetrate=0	critical=8	hit_modify=0	avoid_modify=0	dual_fhit_rate=0	shield_defense=0	shield_defense_rate=0	attack_range=40	damage_range={0;0;40;120}	attack_speed=379	reuse_delay=0	mp_consume=0	magical_damage=6	durability=95	damaged=0	physical_defense=0	magical_defense=0	mp_bonus=0	category={}	enchanted=0	html=[item_default.htm]	equip_pet={0}	magic_weapon=0	enchant_enable=0	can_equip_sex=-1	can_equip_race={}	can_equip_change_class=-1	can_equip_class={}	can_equip_agit=-1	can_equip_castle=-1	can_equip_castle_num={}	can_equip_clan_leader=-1	can_equip_clan_level=-1	can_equip_hero=-1	can_equip_nobless=-1	can_equip_chaotic=-1	item_end
            // Dim UnDestrItems(30000) As String

            Array.Clear(aTemp, 0, aTemp.Length);
            var inItemFile = new System.IO.StreamReader("itemdata.txt", System.Text.Encoding.Default, true, 1);

            ProgressBar.Maximum = Conversions.ToInteger(inItemFile.BaseStream.Length);
            ProgressBar.Value   = 0;
            StatusLabel.Text    = "Loading itemdata and find all quest items ...";
            StatusLabel.Refresh();
            while (inItemFile.EndOfStream != true)
            {
                sTemp = inItemFile.ReadLine();
                if ((Libraries.GetNeedParamFromStr(sTemp, "item_type") ?? "") == "questitem")
                {
                    // If Libraries.GetNeedParamFromStr(sTemp, "is_destruct") = "0" Then
                    sTemp = sTemp.Replace(" = ", "=").Replace("  ", " ").Replace(" ", Conversions.ToString((char)9));
                    aTemp = sTemp.Split((char)9);
                    iTemp = Conversions.ToInteger(aTemp[2]);
                    // array protect
                    if (iTemp > UnDestrItems.Length)
                    {
                        MessageBox.Show("Itemdata use item with id >30000", "Big ItemID", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        inItemFile.Close();
                        return;
                    }
                    UnDestrItems[iTemp] = aTemp[3];
                }

                ProgressBar.Value = Conversions.ToInteger(inItemFile.BaseStream.Position);
            }
            ProgressBar.Value = 0;
            inItemFile.Close();

            // quest_begin	id=257	level=1	name=[The Guard is Busy]
            // quest_begin	id=1	level=1	name=[Letters of Love]
            // Dim QuestPchName(2000) As String
            // [guard_is_busy1]	257
            // [letters_of_love1] 1

            // push_const 337
            // func_call 184680547	//  func[GetMemoState]
            // push_const 337
            // func_call 184680543	//  func[HaveMemo]
            // push_const 337
            // func_call 184615017	//  func[SetCurrentQuestID]
            // push_const 3856
            // func_call 184680579	//  func[OwnItemCount]

            // Dim QuestPch2Name(2000) As String
            // 257 4 1084 752 1085 1086  QuestPch2Name(257)
            // 1 4 687 688 1079 1080     QuestPch2Name(1)

            Array.Clear(aTemp, 0, aTemp.Length);
            string sLastPushConst           = "";
            string sLastPushConst2          = "";
            string sLastQuestID             = "";
            string sLastPushConstForOwnItem = "";
            string sLastClass = "";

            var inAiFile = new System.IO.StreamReader("ai.obj", System.Text.Encoding.Default, true, 1);

            ProgressBar.Maximum = Conversions.ToInteger(inAiFile.BaseStream.Length);
            ProgressBar.Value   = 0;
            StatusLabel.Text    = "Loading Ai.obj and find all quests ...";
            StatusLabel.Refresh();

            while (inAiFile.EndOfStream != true)
            {
                sTemp = inAiFile.ReadLine();

                if (sTemp.StartsWith("class ") == true)
                {
                    sLastClass = sTemp;
                }
                if (Strings.InStr(sTemp, "push_parameter ") != 0)
                {
                    sLastPushConst2 = sLastPushConst;
                }
                if (Strings.InStr(sTemp, "push_const ") != 0)
                {
                    sLastPushConst2 = sLastPushConst;
                    sLastPushConst  = sTemp.Replace("push_const", "").Replace(Conversions.ToString((char)9), "").Replace(" ", "");
                }

                if (Strings.InStr(sTemp, "func_call") != 0)
                {
                    if (Strings.InStr(sTemp, "[SetCurrentQuestID]") != 0)
                    {
                        // Bug fix ">0" againts 'Song of Hunter' quest
                        if (Conversions.ToInteger(sLastPushConst) > 0)
                        {
                            sLastQuestID = sLastPushConst;
                        }
                        else
                        {
                            MessageBox.Show("Wrong Number into :" + sLastClass);
                        }
                    }

                    if (Strings.InStr(sTemp, "[DeleteItem1]") != 0 | Strings.InStr(sTemp, "[OwnItemCount]") != 0)
                    {
                        // Or InStr(sTemp, "[GiveItem1]") <> 0
                        // Or InStr(sTemp, "[OwnItemCount]") <> 0
                        if (!string.IsNullOrEmpty(sLastQuestID))
                        {
                            sLastPushConstForOwnItem = sLastPushConst;

                            if (Strings.InStr(sTemp, "[DeleteItem1]") != 0)
                            {
                                sLastPushConstForOwnItem = sLastPushConst2;
                            }

                            // PROCEDURE
                            if (Conversions.ToInteger(sLastPushConstForOwnItem) <= UnDestrItems.Length)
                            {
                                if (!string.IsNullOrEmpty(UnDestrItems[Conversions.ToInteger(sLastPushConstForOwnItem)]))
                                {
                                    if (!string.IsNullOrEmpty(sLastQuestID))
                                    {
                                        if (string.IsNullOrEmpty(QuestPchName[Conversions.ToInteger(sLastQuestID)]))
                                        {
                                            // Undefined quest in questname-e
                                            outLogFile.WriteLine(Constants.vbNewLine + "Last class: " + sLastClass + Constants.vbNewLine + "Undefined QuestId: " + sLastQuestID + " for Item " + sLastPushConstForOwnItem + " " + UnDestrItems[Conversions.ToInteger(sLastPushConstForOwnItem)]);
                                            // quest not exist in Questdata-e and not created in new list. Maybe later...
                                            if (MakeUndefinedBox.Checked == true)
                                            {
                                                QuestPchName[Conversions.ToInteger(sLastQuestID)]  = "[autoquestgen_" + Conversions.ToInteger(sLastQuestID).ToString() + "]";
                                                QuestPch2Name[Conversions.ToInteger(sLastQuestID)] = sLastPushConstForOwnItem;
                                            }
                                        }
                                        else if (string.IsNullOrEmpty(QuestPch2Name[Conversions.ToInteger(sLastQuestID)]))
                                        {
                                            // Quest exist in quest_pch list, but no items
                                            QuestPch2Name[Conversions.ToInteger(sLastQuestID)] = sLastPushConstForOwnItem;
                                        }
                                        else
                                        {
                                            // Quest exist in quest_pch list, quest_pch2 record exist. check item in list
                                            Array.Clear(aTemp, 0, aTemp.Length);
                                            aTemp = QuestPch2Name[Conversions.ToInteger(sLastQuestID)].Split(Conversions.ToChar(" "));
                                            if (Array.IndexOf(aTemp, sLastPushConstForOwnItem) == -1)
                                            {
                                                QuestPch2Name[Conversions.ToInteger(sLastQuestID)] = QuestPch2Name[Conversions.ToInteger(sLastQuestID)] + " " + sLastPushConstForOwnItem;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                // check - bad item id
                                outLogFile.WriteLine(Constants.vbNewLine + "Last class: " + sLastClass + Constants.vbNewLine + "Bad value for item: " + sLastPushConstForOwnItem);
                            }
                        }
                    }
                }

                if (Strings.InStr(sTemp, "handler_end") != 0)
                {
                    sLastPushConst           = "";
                    sLastQuestID             = "";
                    sLastPushConstForOwnItem = "";
                }

                ProgressBar.Value = Conversions.ToInteger(inAiFile.BaseStream.Position);
            }
            ProgressBar.Value = 0;
            inAiFile.Close();

            StatusLabel.Text = "Writing quest_pch.txt file ...";
            var outQuestPchFile = new System.IO.StreamWriter(QuestDataDir + @"\quest_pch.txt", false, System.Text.Encoding.Unicode, 1);
            var loopTo          = QuestPchName.Length - 1;

            for (iTemp = 0; iTemp <= loopTo; iTemp++)
            {
                if (!string.IsNullOrEmpty(QuestPchName[iTemp]))
                {
                    outQuestPchFile.WriteLine(QuestPchName[iTemp] + Constants.vbTab + iTemp.ToString());
                }
            }
            outQuestPchFile.Close();

            StatusLabel.Text = "Writing quest_pch2.txt file ...";
            var outQuestPch2File = new System.IO.StreamWriter(QuestDataDir + @"\quest_pch2.txt", false, System.Text.Encoding.Unicode, 1);
            var loopTo1          = QuestPch2Name.Length - 1;

            for (iTemp = 0; iTemp <= loopTo1; iTemp++)
            {
                if (!string.IsNullOrEmpty(QuestPch2Name[iTemp]))
                {
                    outQuestPch2File.WriteLine(iTemp.ToString() + " " + QuestPch2Name[iTemp].Split(Conversions.ToChar(" ")).Length.ToString() + " " + QuestPch2Name[iTemp]);
                }
            }
            outQuestPch2File.Close();

            outLogFile.WriteLine(Constants.vbNewLine + DateAndTime.Now.ToString() + " End" + Constants.vbNewLine);
            outLogFile.Close();

            StatusLabel.Text = "Work complete ...";
        }
Ejemplo n.º 8
0
 internal void SetStatus(string data)
 {
     StatusLabel.Text = data;
     StatusLabel.Refresh();
 }