Пример #1
0
        // Drag & Drop within Box
        private void pbBoxSlot_MouseDown(object sender, MouseEventArgs e)
        {
            if (ModifierKeys == Keys.Control || ModifierKeys == Keys.Alt || ModifierKeys == Keys.Shift || ModifierKeys == (Keys.Control | Keys.Alt))
            { clickSlot(sender, (EventArgs)e); return; }
            PictureBox pb = (PictureBox)(sender);
            if (pb.Image == null)
                return;

            pkm_from_slot = getSlot(sender);
            int offset = getPKXOffset(pkm_from_slot);
            if (e.Button == MouseButtons.Left && e.Clicks == 1)
            {
                // Create Temp File to Drag
                string basepath = System.Windows.Forms.Application.StartupPath;
                Cursor.Current = Cursors.Hand;

                // Prepare Data
                Array.Copy(savefile, offset, pkm_from, 0, 0xE8);
                pkm_from_offset = offset;

                // Make a new file name based off the PID
                byte[] dragdata = PKX.decryptArray(pkm_from);
                Array.Resize(ref dragdata, 0xE8);
                PKX pkx = new PKX(dragdata, "Boxes");
                string filename = pkx.Nickname;
                if (filename != pkx.Species)
                    filename += " (" + pkx.Species + ")";
                filename += " - " + pkx.PID + ".pk6";

                // Make File
                string newfile = Path.Combine(basepath, Util.CleanFileName(filename));
                try
                {
                    File.WriteAllBytes(newfile, dragdata);

                    string[] filesToDrag = { newfile };
                    this.DoDragDrop(new DataObject(DataFormats.FileDrop, filesToDrag), DragDropEffects.Move);
                    File.Delete(newfile); // after drop, delete the temporary file
                }
                catch (ArgumentException x)
                { Util.Error("Drag & Drop Error:", x.ToString()); }
                File.Delete(newfile);
                pkm_from_offset = 0;
            }
        }
Пример #2
0
        internal static string[] getPKXSummary(PKX data)
        {
            string[] response = new string[3];
            // Summarize
            string filename = data.Nickname;
            if (filename != data.Species)
                filename += " (" + data.Species + ")";
            response[0] = String.Format("{0} [{4}] lv{3} @ {1} -- {2}", filename, data.HeldItem, data.Nature, data.Level, data.Ability);
            response[1] = String.Format("{0} / {1} / {2} / {3}", data.Move1, data.Move2, data.Move3, data.Move4);
            response[2] = String.Format(
                "IVs:{0}{1}{2}{3}{4}{5}"
                + Environment.NewLine + Environment.NewLine +
                "EVs:{6}{7}{8}{9}{10}{11}",
                Environment.NewLine + data.HP_IV.ToString("00"),
                Environment.NewLine + data.ATK_IV.ToString("00"),
                Environment.NewLine + data.DEF_IV.ToString("00"),
                Environment.NewLine + data.SPA_IV.ToString("00"),
                Environment.NewLine + data.SPD_IV.ToString("00"),
                Environment.NewLine + data.SPE_IV.ToString("00"),
                Environment.NewLine + data.HP_EV.ToString("00"),
                Environment.NewLine + data.ATK_EV.ToString("00"),
                Environment.NewLine + data.DEF_EV.ToString("00"),
                Environment.NewLine + data.SPA_EV.ToString("00"),
                Environment.NewLine + data.SPD_EV.ToString("00"),
                Environment.NewLine + data.SPE_EV.ToString("00"));

            return response;
        }
Пример #3
0
        // Decrypted Export
        private void dragout_MouseDown(object sender, MouseEventArgs e)
        {
            if (!verifiedPKX()) { return; }
            {
                // Create Temp File to Drag
                string basepath = System.Windows.Forms.Application.StartupPath;
                Cursor.Current = Cursors.Hand;

                // Make a new file name
                byte[] dragdata = preparepkx(buff);
                PKX pkx = new PKX(dragdata, "Tabs");
                string filename = pkx.Nickname;
                if (filename != pkx.Species)
                    filename += " (" + pkx.Species + ")";
                filename += " - " + pkx.PID;

                filename += (e.Button == MouseButtons.Right) ? ".ek6" : ".pk6";
                dragdata = (e.Button == MouseButtons.Right) ? PKX.encryptArray(preparepkx(buff)) : preparepkx(buff);
                // Strip out party stats (if they are there)
                Array.Resize(ref dragdata, 232);
                // Make file
                string newfile = Path.Combine(basepath, Util.CleanFileName(filename));
                try
                {
                    File.WriteAllBytes(newfile, dragdata);

                    string[] filesToDrag = { newfile };
                    dragout.DoDragDrop(new DataObject(DataFormats.FileDrop, filesToDrag), DragDropEffects.Move);
                    File.Delete(newfile);
                }
                catch (Exception x)
                { Util.Error("Drag & Drop Error", x.ToString()); }
                File.Delete(newfile);
            }
        }