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, 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) return;
// Create Temp File to Drag
string basepath = 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 };
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;
}
private void pbBoxSlot_DragDrop(object sender, DragEventArgs e)