Exemplo n.º 1
0
        private void LoadFunction()
        {
            if(!loaded)
            {
                try
                {
                    OpenFileDialog dialog = new OpenFileDialog();
                    if(dialog.ShowDialog() == true)
                    {
                        file = dialog.FileName;
                    }
                    amountOfLines = File.ReadAllLines(file).Length;
                    Debug.WriteLine(amountOfLines);
                    fs = new FileStream(file, FileMode.Open);
                    reader = new StreamReader(fs);

                    this.versionString = reader.ReadLine();
                    this.versionTextBox.Text = this.versionString;

                    this.line = reader.ReadLine();
                    for(int i = 0; i < amountOfLines-1;i++)
                    {
                        this.mallItemArray = line.Split('|');
                        this.item = new MallItem(mallItemArray[0], mallItemArray[1], mallItemArray[2], mallItemArray[3], mallItemArray[4], mallItemArray[5],
                                              mallItemArray[6], mallItemArray[7], mallItemArray[8], mallItemArray[9], mallItemArray[10], mallItemArray[11],
                                              mallItemArray[12], mallItemArray[13], mallItemArray[14], mallItemArray[15], mallItemArray[16], mallItemArray[17],
                                              mallItemArray[18], mallItemArray[19], mallItemArray[20], mallItemArray[21], mallItemArray[22], mallItemArray[23],
                                              mallItemArray[24], mallItemArray[25], mallItemArray[26], mallItemArray[27], mallItemArray[28], mallItemArray[29],
                                              mallItemArray[30], mallItemArray[31], mallItemArray[32], mallItemArray[33], mallItemArray[34], mallItemArray[35],
                                              mallItemArray[36], mallItemArray[37], mallItemArray[38], mallItemArray[39], mallItemArray[40], mallItemArray[41],
                                              mallItemArray[42], mallItemArray[43], mallItemArray[44], mallItemArray[45], mallItemArray[46], mallItemArray[47],
                                              mallItemArray[48], mallItemArray[49], mallItemArray[50], mallItemArray[51], mallItemArray[52], mallItemArray[53],
                                              mallItemArray[54], mallItemArray[55], mallItemArray[56], mallItemArray[57]);
                        this.itemListBox.Items.Add(mallItemArray[0] + " - " + mallItemArray[7]);
                        mallItemList.Add(item);
                        this.line = reader.ReadLine();
                    }
                    loaded = true;
                    #region
                    this.textBox01.Text = mallItemList[0].unknown01;
                    this.textBox02.Text = mallItemList[0].unknown02;
                    this.textBox03.Text = mallItemList[0].unknown03;
                    this.textBox04.Text = mallItemList[0].unknown04;
                    this.textBox05.Text = mallItemList[0].unknown05;
                    this.textBox06.Text = mallItemList[0].unknown06;
                    this.textBox07.Text = mallItemList[0].unknown07;
                    this.textBox08.Text = mallItemList[0].unknown08;
                    this.textBox09.Text = mallItemList[0].unknown09;
                    this.textBox10.Text = mallItemList[0].unknown10;

                    this.textBox11.Text = mallItemList[0].unknown11;
                    this.textBox12.Text = mallItemList[0].unknown12;
                    this.textBox13.Text = mallItemList[0].unknown13;
                    this.textBox14.Text = mallItemList[0].unknown14;
                    this.textBox15.Text = mallItemList[0].unknown15;
                    this.textBox16.Text = mallItemList[0].unknown16;
                    this.textBox17.Text = mallItemList[0].unknown17;
                    this.textBox18.Text = mallItemList[0].unknown18;
                    this.textBox19.Text = mallItemList[0].unknown19;
                    this.textBox20.Text = mallItemList[0].unknown20;

                    this.textBox21.Text = mallItemList[0].unknown21;
                    this.textBox22.Text = mallItemList[0].unknown22;
                    this.textBox23.Text = mallItemList[0].unknown23;
                    this.textBox24.Text = mallItemList[0].unknown24;
                    this.textBox25.Text = mallItemList[0].unknown25;
                    this.textBox26.Text = mallItemList[0].unknown26;
                    this.textBox27.Text = mallItemList[0].unknown27;
                    this.textBox28.Text = mallItemList[0].unknown28;
                    this.textBox29.Text = mallItemList[0].unknown29;
                    this.textBox30.Text = mallItemList[0].unknown30;

                    this.textBox31.Text = mallItemList[0].unknown31;
                    this.textBox32.Text = mallItemList[0].unknown32;
                    this.textBox33.Text = mallItemList[0].unknown33;
                    this.textBox34.Text = mallItemList[0].unknown34;
                    this.textBox35.Text = mallItemList[0].unknown35;
                    this.textBox36.Text = mallItemList[0].unknown36;
                    this.textBox37.Text = mallItemList[0].unknown37;
                    this.textBox38.Text = mallItemList[0].unknown38;
                    this.textBox39.Text = mallItemList[0].unknown39;
                    this.textBox40.Text = mallItemList[0].unknown40;

                    this.textBox41.Text = mallItemList[0].unknown41;
                    this.textBox42.Text = mallItemList[0].unknown42;
                    this.textBox43.Text = mallItemList[0].unknown43;
                    this.textBox44.Text = mallItemList[0].unknown44;
                    this.textBox45.Text = mallItemList[0].unknown45;
                    this.textBox46.Text = mallItemList[0].unknown46;
                    this.textBox47.Text = mallItemList[0].unknown47;
                    this.textBox48.Text = mallItemList[0].unknown48;
                    this.textBox49.Text = mallItemList[0].unknown49;
                    this.textBox50.Text = mallItemList[0].unknown50;

                    this.textBox51.Text = mallItemList[0].unknown51;
                    this.textBox52.Text = mallItemList[0].unknown52;
                    this.textBox53.Text = mallItemList[0].unknown53;
                    this.textBox54.Text = mallItemList[0].unknown54;
                    this.textBox55.Text = mallItemList[0].unknown55;
                    this.textBox56.Text = mallItemList[0].unknown56;
                    this.textBox57.Text = mallItemList[0].unknown57;
                    this.textBox58.Text = mallItemList[0].unknown58;
#endregion
                }
                catch(Exception ex)
                {
                    loaded = false;
                    DateTime date = DateTime.Now;
                    string datum = (date.Day + "/" + date.Month + "/" + date.Year + "   " + date.Hour + ":" + date.Minute + ":" + date.Second).ToString();
                    Debug.WriteLine(ex.Message);
                    Debug.WriteLine(ex.StackTrace);
                    errorStream = new FileStream("LoadingError.log", FileMode.Append, FileAccess.Write);
                    errorWriter = new StreamWriter(errorStream);
                    errorWriter.WriteLine("-------" + datum + "--------");
                    errorWriter.WriteLine("------- Start Error Message -------");
                    errorWriter.WriteLine(ex.Message);
                    errorWriter.WriteLine();
                    errorWriter.WriteLine("------- End Error Message -------");
                    errorWriter.WriteLine();
                    errorWriter.WriteLine("-------- Start Stacktrace --------");
                    errorWriter.WriteLine(ex.StackTrace);
                    errorWriter.WriteLine();
                    errorWriter.WriteLine("-------- End Stacktrace -----------");
                    errorWriter.Close();
                    MessageBox.Show("An error occured, please check the LoadingError.log in the folder where the Item Mall Editor program is located.", "Error", MessageBoxButton.OK);
                }
                finally
                {
                    if(reader != null)
                    {
                        reader.Close();
                    }
                    if(errorStream != null)
                    {
                        errorStream.Close();
                    }
                    if(errorWriter != null)
                    {
                        errorWriter.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("Data is already loaded in.");
            }
        }
Exemplo n.º 2
0
        private void addItemContextMenuItem_Click(object sender, RoutedEventArgs e)
        {
            if(loaded)
            {
                try
                {
                    this.item = new MallItem("000000", "", "", "", "", "", "", "NAME", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
                                                    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");

                itemListBox.Items.Add(item.unknown01 + " - " + item.unknown08);
                mallItemList.Add(item);
                }

                catch(Exception ex)
                {
                    DateTime date = DateTime.Now;
                    string datum = (date.Day + "/" + date.Month + "/" + date.Year + "   " + date.Hour + ":" + date.Minute + ":" + date.Second).ToString();
                    Debug.WriteLine(ex.Message);
                    Debug.WriteLine(ex.StackTrace);
                    errorStream = new FileStream("AddItemErrorLog.log", FileMode.Append, FileAccess.Write);
                    errorWriter = new StreamWriter(errorStream);
                    errorWriter.WriteLine("-------" + datum + "--------");
                    errorWriter.WriteLine("------- Start Error Message -------");
                    errorWriter.WriteLine(ex.Message);
                    errorWriter.WriteLine();
                    errorWriter.WriteLine("------- End Error Message -------");
                    errorWriter.WriteLine();
                    errorWriter.WriteLine("-------- Start Stacktrace --------");
                    errorWriter.WriteLine(ex.StackTrace);
                    errorWriter.WriteLine();
                    errorWriter.WriteLine("-------- End Stacktrace -----------");
                    errorWriter.Close();
                    MessageBox.Show("An error occured, please check the AddItemErrorLog.log in the folder where the Item Mall Editor program is located.", "Error", MessageBoxButton.OK);
                }
                
            }
            
        }
Exemplo n.º 3
0
        private void SearchFunction()
        {
            if(searchOptionComboBox.SelectedIndex == 0)
            {
                Debug.WriteLine("Searching on ID");
                string searchValue = searchTextBox.Text.Trim();

                MallItem item;
                int i;
                Boolean found = false;
                for(i = 0; i<mallItemList.Count;i++)
                {
                    item = mallItemList[i];
                    if (item.unknown01.Equals(searchValue))
                    {
                        itemListBox.SelectedIndex = i;
                        itemListBox.ScrollIntoView(itemListBox.Items.GetItemAt(i));
                        found = true;
                        break;
                    }
                    else { }
                }
                if ((found == false) && i == mallItemList.Count)
                {
                    MessageBox.Show("No matches found");
                }
            }
            else
            {
                Debug.WriteLine("Searching on " + searchOptionComboBox.SelectionBoxItem);

                MallItem item;
                int i;
                Boolean found = false;
                string searchvalue = searchTextBox.Text.Trim();
                for(i = 0; i<mallItemList.Count;i++)
                {
                    item = mallItemList[i];
                    if(item.unknown08.Equals(searchvalue))
                    {
                        itemListBox.SelectedIndex = i;
                        itemListBox.ScrollIntoView(itemListBox.Items.GetItemAt(i));
                        found = true;
                        break;
                    }
                    else
                    {

                    }
                }
                if((found == false) && i == mallItemList.Count)
                {
                    MessageBox.Show("No Matches found.");
                }


            }
        }