Exemple #1
0
        private void ddDrop(object sender, DragEventArgs e)
        {
            Type t = getType();

            if (t == null)
            {
                return;
            }
            Blank = getBlank(t);
            SAV   = SaveUtil.getBlankSAV(Blank.Format, PKMConverter.OT_Name);

            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
            string   path  = files[0]; // open first D&D

            if (Directory.Exists(path))
            {
                files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
            }

            output = new ConcurrentBag <string[]>();
            var convertCount = new ConcurrentBag <bool>();

            RTB_Output.AppendText("----------" + Environment.NewLine);
            currType = CB_PKMTypes.Text;
            Parallel.ForEach(files, file => { convertCount.Add(convert(file, t)); });
            RTB_Output.AppendText(string.Join(Environment.NewLine, output.SelectMany(s => s)));
            Alert($"Converted {convertCount.Count(a => a)} of {files.Length} to {t.Name}.");
        }
Exemple #2
0
        private void B_Open_Click(object sender, EventArgs e)
        {
            Type t = getType();

            if (t == null)
            {
                return;
            }
            Blank = getBlank(t);
            SAV   = SaveUtil.getBlankSAV(Blank.Format, PKMConverter.OT_Name);

            OpenFileDialog ofd = new OpenFileDialog {
                Filter = "PKM File|*.pkm|All Files|*.*"
            };

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string path = ofd.FileName;

            output   = new ConcurrentBag <string[]>();
            currType = CB_PKMTypes.Text;
            convert(path, t);
            RTB_Output.AppendText(string.Join(Environment.NewLine, output.SelectMany(s => s)));
        }
Exemple #3
0
        public Main()
        {
            InitializeComponent();
            DragEnter            += ddEnter;
            DragDrop             += ddDrop;
            RTB_Output.DragEnter += ddEnter;
            RTB_Output.DragDrop  += ddDrop;

            RTB_Output.Text = "Select Input and Output Generation." + Environment.NewLine
                              + Environment.NewLine
                              + "Drag & Drop each Pokémon to transfer." + Environment.NewLine;
            RTB_Output.AppendText("----------" + Environment.NewLine);

            CB_PKMTypes.Items.AddRange(PKMTypes.Select(t => t.Name).ToArray());
            CB_PKMTypes.SelectedIndex = 0;
        }
Exemple #4
0
 private void RTB_Output_Click(object sender, EventArgs e)
 {
     RTB_Output.Clear();
     RTB_Output.Text = "Open a file, or Drag/Drop several! Click this box to clear its text." + Environment.NewLine;
 }
Exemple #5
0
 private void ClearOutput(object sender, EventArgs e) => RTB_Output.Clear();