Esempio n. 1
0
        public void LoadItemList( )
        {
            try {
                using (OpenFileDialog find = new OpenFileDialog( )) {
                    find.Filter = "ItemList.bin|ItemList.bin";
                    find.Title  = "Selecione sua ItemList.bin";

                    find.ShowDialog( );

                    if (find.CheckFileExists)
                    {
                        this.FilePath = find.FileName;

                        if (File.Exists(this.FilePath))
                        {
                            byte [] temp = File.ReadAllBytes(this.FilePath);

                            if (temp.Length != 910004)
                            {
                                MessageBox.Show("Sua ItemList.bin é inválida! Selecione a original do seu cliente!", "ItemList.bin inválida", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                this.LoadItemList( );
                            }
                            else
                            {
                                for (int i = 0; i < temp.Length; i++)
                                {
                                    temp [i] ^= 0x5A;
                                }

                                this.List = Pak.ToStruct <st_ItemList> (temp);

                                Task.Run(() => {
                                    this.listBox.Invoke(new MethodInvoker(delegate() {
                                        for (int i = 0; i < this.List.Item.Length; i++)
                                        {
                                            this.listBox.Items.Add($"{i.ToString ( ).PadLeft ( 4 , '0' )}: {this.List.Item [ i ].Name}");
                                        }
                                    }));
                                });
                            }
                        }
                        else
                        {
                            Environment.Exit(0);
                        }
                    }
                    else
                    {
                        Environment.Exit(0);
                    }
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        public void LoadItemList()
        {
            try
            {
                using (OpenFileDialog find = new OpenFileDialog())
                {
                    find.Filter = "ItemList.bin|ItemList.bin";
                    find.Title  = "Selecione sua ItemList.bin";

                    find.ShowDialog();

                    if (find.CheckFileExists)
                    {
                        this.FilePath = find.FileName;

                        if (File.Exists(this.FilePath))
                        {
                            byte[] temp = File.ReadAllBytes(this.FilePath);

                            if (temp.Length != 988004)
                            {
                                MessageBox.Show("Itemlist inválida", "ItemList.bin inválida", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                this.LoadItemList();
                            }
                            else
                            {
                                byte[] pKeyList = File.ReadAllBytes("./Keys.bin");
                                Array.Resize(ref pKeyList, pKeyList.Length + 1);

                                if (temp[0] == 0x5A && temp[1] == 0x5A)
                                {
                                    for (int i = 0; i < temp.Length; i++)
                                    {
                                        temp[i] ^= 0x5A;
                                    }
                                }
                                else
                                {
                                    for (int i = 0; i < temp.Length; i++)
                                    {
                                        temp[i] ^= (pKeyList[i & 63]);
                                    }
                                }


                                this.List = Pak.ToStruct <st_ItemList>(temp);

                                Task.Run(() =>
                                {
                                    if (listBox.Items.Count > 0)
                                    {
                                        listBox.Items.Clear();
                                    }

                                    itemCount = 0;
                                    this.listBox.Invoke(new MethodInvoker(delegate()
                                    {
                                        for (int i = 0; i < this.List.Item.Length; i++)
                                        {
                                            if (this.List.Item[i].Name != "")
                                            {
                                                itemCount++;
                                                label10.Text = "Quantidade de itens: (" + itemCount + " / 6500)";
                                            }
                                            this.SaveItemName.Item[i].Id   = i;
                                            this.SaveItemName.Item[i].Name = this.List.Item[i].Name;

                                            this.listBox.Items.Add($"{i.ToString().PadLeft(4, '0')}: {this.List.Item[i].Name}");
                                        }
                                    }));
                                });

                                abrirItemNamebinToolStripMenuItem.Enabled = true;
                            }
                        }
                        else
                        {
                            Environment.Exit(0);
                        }
                    }
                    else
                    {
                        Environment.Exit(0);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }