Пример #1
0
        public SAV_BoxViewer(Main p)
        {
            InitializeComponent();
            parent = p;
            CenterToParent();

            AllowDrop = true;
            DragEnter += tabMain_DragEnter;
            DragDrop += (sender, e) =>
            {
                Cursor = DefaultCursor;
                System.Media.SystemSounds.Asterisk.Play();
            };

            SlotPictureBoxes = new[] {
                                    bpkx1, bpkx2, bpkx3, bpkx4, bpkx5, bpkx6,
                                    bpkx7, bpkx8, bpkx9, bpkx10,bpkx11,bpkx12,
                                    bpkx13,bpkx14,bpkx15,bpkx16,bpkx17,bpkx18,
                                    bpkx19,bpkx20,bpkx21,bpkx22,bpkx23,bpkx24,
                                    bpkx25,bpkx26,bpkx27,bpkx28,bpkx29,bpkx30,
                                };
            foreach (PictureBox pb in SlotPictureBoxes)
            {
                pb.AllowDrop = true;
                pb.GiveFeedback += (sender, e) => { e.UseDefaultCursors = false; };
                pb.MouseUp += pbBoxSlot_MouseUp;
                pb.MouseDown += pbBoxSlot_MouseDown;
                pb.MouseMove += pbBoxSlot_MouseMove;
                pb.DragDrop += pbBoxSlot_DragDrop;
                pb.DragEnter += pbBoxSlot_DragEnter;
                pb.QueryContinueDrag += pbBoxSlot_QueryContinueDrag;
            }
            for (int i = SAV.BoxSlotCount; i < SlotPictureBoxes.Length; i++)
                SlotPictureBoxes[i].Visible = false;

            try
            {
                CB_BoxSelect.Items.Clear();
                for (int i = 0; i < SAV.BoxCount; i++)
                    CB_BoxSelect.Items.Add(SAV.getBoxName(i));
            }
            catch
            {
                CB_BoxSelect.Items.Clear();
                for (int i = 1; i <= SAV.BoxCount; i++)
                    CB_BoxSelect.Items.Add($"BOX {i}");
            }
            CB_BoxSelect.SelectedIndex = 0;
        }
Пример #2
0
        public SAV_SuperTrain(Main frm1)
        {
            m_parent = frm1;
            sav = (byte[])Main.SAV.Data.Clone();
            trba = Main.trainingbags;
            trba[0] = "---";
            offsetTime = Main.SAV.SuperTrain + 0x08;
            offsetSpec = Main.SAV.SuperTrain + 0x188;
            offsetVal = Main.SAV.SuperTrain + 0x18A;
            InitializeComponent();
            Util.TranslateInterface(this, Main.curlanguage);
            string[] stages = Main.trainingstage;
            listBox1.Items.Clear();
            for (int i = 0; i < 30; i++)
                listBox1.Items.Add((i + 1).ToString("00") + " - " + stages[i + 2]);

            setup();
        }
Пример #3
0
        private string withOT = "Memories with"; // these get replaced when the form is translated.

        #endregion Fields

        #region Constructors

        // Keeping the form reference as a lot of control elements are required to operate.
        public MemoryAmie(Main frm1)
        {
            InitializeComponent();
            CB_Country0.DisplayMember = CB_Country1.DisplayMember = CB_Country2.DisplayMember = CB_Country3.DisplayMember = CB_Country4.DisplayMember = "Text";
            CB_Country0.ValueMember = CB_Country1.ValueMember = CB_Country2.ValueMember = CB_Country3.ValueMember = CB_Country4.ValueMember = "Value";
            CB_Region0.DisplayMember = CB_Region1.DisplayMember = CB_Region2.DisplayMember = CB_Region3.DisplayMember = CB_Region4.DisplayMember = "Text";
            CB_Region0.ValueMember = CB_Region1.ValueMember = CB_Region2.ValueMember = CB_Region3.ValueMember = CB_Region4.ValueMember = "Value";
            Util.TranslateInterface(this, Main.curlanguage);
            m_parent = frm1;
            string[] arguments = L_Arguments.Text.Split(new[] {" ; "}, StringSplitOptions.None);

            for (int i = 5; i < Math.Min(arguments.Length, vartypes.Length + 5); i++)
            {
                if (arguments[i] == null) continue;
                vartypes[i - 5] = arguments[i] + ":";
            }
            try
            {
                disabled = arguments[0];
                notleft = arguments[1];
                ot = arguments[2];
                past = arguments[3];
                withOT = arguments[4];
            }
            catch
            {
                disabled = "Disabled";
                notleft = "Never left";
                ot = "OT";
                past = "Past Gen";
                withOT = "Memories with";
            }
            h = Main.pk6.Data;

            getCountries();
            getLangStrings();
            loadFields();
        }
Пример #4
0
        public SAV_Database(Main f1)
        {
            m_parent = f1;
            InitializeComponent();
            PKXBOXES = new[]
            {
                bpkx1, bpkx2, bpkx3, bpkx4, bpkx5, bpkx6,
                bpkx7, bpkx8, bpkx9, bpkx10,bpkx11,bpkx12,
                bpkx13,bpkx14,bpkx15,bpkx16,bpkx17,bpkx18,
                bpkx19,bpkx20,bpkx21,bpkx22,bpkx23,bpkx24,
                bpkx25,bpkx26,bpkx27,bpkx28,bpkx29,bpkx30,

                bpkx31,bpkx32,bpkx33,bpkx34,bpkx35,bpkx36,
                bpkx37,bpkx38,bpkx39,bpkx40,bpkx41,bpkx42,
                bpkx43,bpkx44,bpkx45,bpkx46,bpkx47,bpkx48,
                bpkx49,bpkx50,bpkx51,bpkx52,bpkx53,bpkx54,
                bpkx55,bpkx56,bpkx57,bpkx58,bpkx59,bpkx60,
                bpkx61,bpkx62,bpkx63,bpkx64,bpkx65,bpkx66,
            };

            // Enable Scrolling when hovered over
            PAN_Box.MouseHover += (sender, args) =>
            {
                if (ActiveForm == this)
                    SCR_Box.Focus();
            };
            foreach (var slot in PKXBOXES)
            {
                slot.MouseEnter += (sender, args) =>
                {
                    if (ActiveForm == this)
                        SCR_Box.Focus();
                };
                // Enable Click
                slot.MouseClick += (sender, args) =>
                {
                    if (ModifierKeys == Keys.Control)
                        clickView(sender, args);
                    else if (ModifierKeys == Keys.Alt)
                        clickDelete(sender, args);
                    else if (ModifierKeys == Keys.Shift)
                        clickSet(sender, args);
                };
            }
            
            Counter = L_Count.Text;
            Viewed = L_Viewed.Text;
            L_Viewed.Text = ""; // invis for now
            populateComboBoxes();

            ContextMenuStrip mnu = new ContextMenuStrip();
            ToolStripMenuItem mnuView = new ToolStripMenuItem("View");
            ToolStripMenuItem mnuDelete = new ToolStripMenuItem("Delete");

            // Assign event handlers
            mnuView.Click += clickView;
            mnuDelete.Click += clickDelete;

            // Add to main context menu
            mnu.Items.AddRange(new ToolStripItem[] { mnuView, mnuDelete });

            // Assign to datagridview
            foreach (PictureBox p in PKXBOXES)
                p.ContextMenuStrip = mnu;

            // Load initial database
            Database.Add(new DatabaseList
            {
                Version = 0,
                Title = "Misc",
                Description = "Individual pk6 files present in the db/sav.",
            });

            // Load databases
            foreach (string file in Directory.GetFiles(DatabasePath, "*", SearchOption.AllDirectories))
            {
                if (new FileInfo(file).Extension == ".pk6")
                    Database[0].Slot.Add(new PK6(File.ReadAllBytes(file), file));
                else
                    loadDatabase(File.ReadAllBytes(file));
            }
            // Fetch from save file
            foreach (var pk6 in Main.SAV.BoxData.Where(pk => pk.Species != 0))
                Database[0].Slot.Add(pk6);

            // Prepare Database
            prepareDBForSearch();
            Menu_SearchSettings.DropDown.Closing += (sender, e) =>
            {
                if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
                    e.Cancel = true;
            };
            CenterToParent();
        }
Пример #5
0
        private int slotSelected = -1; // = null;

        #endregion Fields

        #region Constructors

        public SAV_Database(Main f1)
        {
            m_parent = f1;
            InitializeComponent();

            // Preset Filters to only show PKM available for loaded save
            CB_FormatComparator.SelectedIndex = 3; // <=

            PKXBOXES = new[]
            {
                bpkx1, bpkx2, bpkx3, bpkx4, bpkx5, bpkx6,
                bpkx7, bpkx8, bpkx9, bpkx10,bpkx11,bpkx12,
                bpkx13,bpkx14,bpkx15,bpkx16,bpkx17,bpkx18,
                bpkx19,bpkx20,bpkx21,bpkx22,bpkx23,bpkx24,
                bpkx25,bpkx26,bpkx27,bpkx28,bpkx29,bpkx30,

                bpkx31,bpkx32,bpkx33,bpkx34,bpkx35,bpkx36,
                bpkx37,bpkx38,bpkx39,bpkx40,bpkx41,bpkx42,
                bpkx43,bpkx44,bpkx45,bpkx46,bpkx47,bpkx48,
                bpkx49,bpkx50,bpkx51,bpkx52,bpkx53,bpkx54,
                bpkx55,bpkx56,bpkx57,bpkx58,bpkx59,bpkx60,
                bpkx61,bpkx62,bpkx63,bpkx64,bpkx65,bpkx66,
            };

            // Enable Scrolling when hovered over
            PAN_Box.MouseHover += (sender, args) =>
            {
                if (ActiveForm == this)
                    SCR_Box.Focus();
            };
            foreach (var slot in PKXBOXES)
            {
                slot.MouseEnter += (sender, args) =>
                {
                    if (ActiveForm == this)
                        SCR_Box.Focus();
                };
                // Enable Click
                slot.MouseClick += (sender, args) =>
                {
                    if (ModifierKeys == Keys.Control)
                        clickView(sender, args);
                    else if (ModifierKeys == Keys.Alt)
                        clickDelete(sender, args);
                    else if (ModifierKeys == Keys.Shift)
                        clickSet(sender, args);
                };
            }

            Counter = L_Count.Text;
            Viewed = L_Viewed.Text;
            L_Viewed.Text = ""; // invis for now
            populateComboBoxes();

            ContextMenuStrip mnu = new ContextMenuStrip();
            ToolStripMenuItem mnuView = new ToolStripMenuItem("View");
            ToolStripMenuItem mnuDelete = new ToolStripMenuItem("Delete");

            // Assign event handlers
            mnuView.Click += clickView;
            mnuDelete.Click += clickDelete;

            // Add to main context menu
            mnu.Items.AddRange(new ToolStripItem[] { mnuView, mnuDelete });

            // Assign to datagridview
            foreach (PictureBox p in PKXBOXES)
                p.ContextMenuStrip = mnu;

            // Load Data
            RawDB = new List<PKM>();
            foreach (string file in Directory.GetFiles(DatabasePath, "*", SearchOption.AllDirectories))
            {
                FileInfo fi = new FileInfo(file);
                if (fi.Extension.Contains(".pk") && PKX.getIsPKM(fi.Length))
                    RawDB.Add(PKMConverter.getPKMfromBytes(File.ReadAllBytes(file), file));
            }
            // Fetch from save file
            foreach (var pkm in Main.SAV.BoxData.Where(pk => pk.Species != 0))
                RawDB.Add(pkm);

            // Prepare Database
            RawDB = new List<PKM>(RawDB.Where(pk => pk.ChecksumValid && pk.Species != 0 && pk.Sanity == 0));
            RawDB = new List<PKM>(RawDB.Distinct());
            setResults(RawDB);

            Menu_SearchSettings.DropDown.Closing += (sender, e) =>
            {
                if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
                    e.Cancel = true;
            };
            CenterToParent();
        }
        private int slotSelected = -1; // = null;

        #endregion Fields

        #region Constructors

        public SAV_MysteryGiftDB(Main f1)
        {
            m_parent = f1;
            InitializeComponent();

            // Preset Filters to only show PKM available for loaded save
            CB_FormatComparator.SelectedIndex = 3; // <=

            PKXBOXES = new[]
            {
                bpkx1, bpkx2, bpkx3, bpkx4, bpkx5, bpkx6,
                bpkx7, bpkx8, bpkx9, bpkx10,bpkx11,bpkx12,
                bpkx13,bpkx14,bpkx15,bpkx16,bpkx17,bpkx18,
                bpkx19,bpkx20,bpkx21,bpkx22,bpkx23,bpkx24,
                bpkx25,bpkx26,bpkx27,bpkx28,bpkx29,bpkx30,

                bpkx31,bpkx32,bpkx33,bpkx34,bpkx35,bpkx36,
                bpkx37,bpkx38,bpkx39,bpkx40,bpkx41,bpkx42,
                bpkx43,bpkx44,bpkx45,bpkx46,bpkx47,bpkx48,
                bpkx49,bpkx50,bpkx51,bpkx52,bpkx53,bpkx54,
                bpkx55,bpkx56,bpkx57,bpkx58,bpkx59,bpkx60,
                bpkx61,bpkx62,bpkx63,bpkx64,bpkx65,bpkx66,
            };

            // Enable Scrolling when hovered over
            PAN_Box.MouseHover += (sender, args) =>
            {
                if (ActiveForm == this)
                    SCR_Box.Focus();
            };
            foreach (var slot in PKXBOXES)
            {
                slot.MouseEnter += (sender, args) =>
                {
                    if (ActiveForm == this)
                        SCR_Box.Focus();
                };
                // Enable Click
                slot.MouseClick += (sender, args) =>
                {
                    if (ModifierKeys == Keys.Control)
                        clickView(sender, args);
                };
            }

            Counter = L_Count.Text;
            Viewed = L_Viewed.Text;
            L_Viewed.Text = ""; // invis for now

            ContextMenuStrip mnu = new ContextMenuStrip();
            ToolStripMenuItem mnuView = new ToolStripMenuItem("View");

            // Assign event handlers
            mnuView.Click += clickView;

            // Add to main context menu
            mnu.Items.AddRange(new ToolStripItem[] { mnuView });

            // Assign to datagridview
            foreach (PictureBox p in PKXBOXES)
                p.ContextMenuStrip = mnu;

            // Load Data
            RawDB = new List<MysteryGift>();
            RawDB.AddRange(Legal.MGDB_G6);
            RawDB.AddRange(Legal.MGDB_G7);

            if (Directory.Exists(DatabasePath))
            foreach (string file in Directory.GetFiles(DatabasePath, "*", SearchOption.AllDirectories))
            {
                FileInfo fi = new FileInfo(file);
                if (!MysteryGift.getIsMysteryGift(fi.Length)) continue;
                var mg = MysteryGift.getMysteryGift(File.ReadAllBytes(file), fi.Extension);
                if (mg != null)
                    RawDB.Add(mg);
            }

            RawDB = new List<MysteryGift>(RawDB.Where(mg => !mg.IsItem && mg.IsPokémon && mg.Species > 0).Distinct().OrderBy(mg => mg.Species));
            foreach (var mg in RawDB)
                mg.GiftUsed = false;
            setResults(RawDB);

            Menu_SearchSettings.DropDown.Closing += (sender, e) =>
            {
                if (e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
                    e.Cancel = true;
            };

            populateComboBoxes();
            CenterToParent();
        }
Пример #7
0
        private void convert_Click(object sender, EventArgs e)
        {
            if (textBox2.Text == "" && (radioButton1.Checked || radioButton2.Checked))
            {
                MessageBox.Show("Please enter an Extract Path!");
            }
            else if (textBox3.Text == "" && radioButton3.Checked)
            {
                MessageBox.Show("Please enter an Cyber Sav File Path!");
            }
            else if ((maskedTextBox1.Text == "" || maskedTextBox2.Text == "") && radioButton3.Checked)
            {
                MessageBox.Show("Please enter valid Box numbers!");
            }
            else if (textBox1.Text == "")
            {
                MessageBox.Show("Please enter an Importable!");
            }
            else
            {
                string importable = textBox1.Text;

                List<Pokemon> pokemon = extractImportable(importable);

                if (pokemon.Count > 30 && radioButton2.Checked)
                {
                    MessageBox.Show("Only 30 Pokemon fit into a Box!");
                }
                else
                {
                    Main form = new Main(pokemon, textBox2.Text, radioButton1.Checked, textBox3.Text, radioButton3.Checked, maskedTextBox1.Text, maskedTextBox2.Text, checkBox1.Checked, gen7Check.Checked);
                    form.Form1_Load(null, null);
                    form.Close();
                    MessageBox.Show("Done!");
                }
            }
        }
Пример #8
0
        public SAV_Database(Main f1)
        {
            m_parent = f1;
            InitializeComponent();
            PKXBOXES = new[]
            {
                bpkx1, bpkx2, bpkx3, bpkx4, bpkx5, bpkx6,
                bpkx7, bpkx8, bpkx9, bpkx10,bpkx11,bpkx12,
                bpkx13,bpkx14,bpkx15,bpkx16,bpkx17,bpkx18,
                bpkx19,bpkx20,bpkx21,bpkx22,bpkx23,bpkx24,
                bpkx25,bpkx26,bpkx27,bpkx28,bpkx29,bpkx30,

                bpkx31,bpkx32,bpkx33,bpkx34,bpkx35,bpkx36,
                bpkx37,bpkx38,bpkx39,bpkx40,bpkx41,bpkx42,
                bpkx43,bpkx44,bpkx45,bpkx46,bpkx47,bpkx48,
                bpkx49,bpkx50,bpkx51,bpkx52,bpkx53,bpkx54,
                bpkx55,bpkx56,bpkx57,bpkx58,bpkx59,bpkx60,
                bpkx61,bpkx62,bpkx63,bpkx64,bpkx65,bpkx66,
            };

            // Enable Scrolling when hovered over
            var me = this;
            PAN_Box.MouseEnter += (sender, args) =>
            {
                if (ActiveForm == me)
                    SCR_Box.Focus();
            };
            foreach (var slot in PKXBOXES)
            {
                slot.MouseEnter += (sender, args) =>
                {
                    if (ActiveForm == me)
                        SCR_Box.Focus();
                };
                // Enable Click
                slot.MouseClick += (sender, args) =>
                {
                    if (ModifierKeys == Keys.Control)
                        clickView(sender, args);
                };
            }

            Counter = L_Count.Text;
            Viewed = L_Viewed.Text;
            L_Viewed.Text = ""; // invis for now
            populateComboBoxes();

            ContextMenuStrip mnu = new ContextMenuStrip();
            ToolStripMenuItem mnuView = new ToolStripMenuItem("View");

            // Assign event handlers
            mnuView.Click += clickView;

            // Add to main context menu
            mnu.Items.AddRange(new ToolStripItem[] { mnuView });

            // Assign to datagridview
            foreach (PictureBox p in PKXBOXES)
                p.ContextMenuStrip = mnu;

            // Load initial database
            Database.Add(new DatabaseList
            {
                Version = 0,
                Title = "Misc",
                Description = "Individual pk6 files present in the db/sav.",
            });

            // Load databases
            foreach (string file in Directory.GetFiles(DatabasePath, "*", SearchOption.AllDirectories))
            {
                if ((new FileInfo(file)).Extension == ".pk6")
                    Database[0].Slot.Add(new PK6(File.ReadAllBytes(file), file));
                else
                    loadDatabase(File.ReadAllBytes(file));
            }
            // Fetch from save file
            for (int i = 0; i < 930; i++)
            {
                string Identifier = String.Format("B{0}:{1}", (i / 30 + 1).ToString("00"), (i % 30 + 1).ToString("00"));
                PK6 pk6 = new PK6(PKX.decryptArray(Main.SAV.Data.Skip(Main.SAV.Box + 0xE8*i).Take(0xE8).ToArray()), Identifier);
                if (pk6.Species != 0)
                    Database[0].Slot.Add(pk6);
            }

            // Prepare Database
            prepareDBForSearch();
        }