Ejemplo n.º 1
0
        private static void GenerateNewAmiiboFiles(AmiiboTag amiibo, uint amount, string amiiboPath, string output)
        {
            Console.WriteLine("Generating and saving modified Amiibos");
            for (int i = 0; i < amount; i++)
            {
                var fileName = Path.GetFileNameWithoutExtension(amiiboPath) + AmiiboSNHelper.FileNameExtension + i + AmiiboSNHelper.FileType;
                var savePath = Path.Combine(output, fileName);

                Console.WriteLine($">> Creating Amiibo {savePath}");

                amiibo.UID = AmiiboSNHelper.CustomRandomizeSerial();

                if (!amiibo.IsUidValid())
                {
                    Console.WriteLine($">> Invalid UID for Amiibo Nr {i}");
                }
                else
                {
                    AmiiboSNHelper.EncryptNtag(savePath, amiibo);
                }
            }
        }
Ejemplo n.º 2
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.tbOutput.Text) || !Directory.Exists(this.tbOutput.Text))
            {
                MessageBox.Show($"Please enter a valid output directory", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            this.tbOutput.ReadOnly  = true;
            this.btnExecute.Enabled = false;
            this.numUpDown.ReadOnly = true;

            try
            {
                var abort = false;
                foreach (var item in this.amiibos)
                {
                    for (int i = 0; i < this.numUpDown.Value; i++)
                    {
                        var fileName = Path.GetFileNameWithoutExtension(item.FilePath) + AmiiboSNHelper.FileNameExtension + i + AmiiboSNHelper.FileType;
                        var savePath = Path.Combine(this.tbOutput.Text, fileName);
                        item.AmiiboTag.UID = AmiiboSNHelper.CustomRandomizeSerial();

                        if (!item.AmiiboTag.IsUidValid())
                        {
                            var diagResult = MessageBox.Show($"Created invalid UID for '{fileName}'{Environment.NewLine}Yes to skip current amiibo batch{Environment.NewLine}No to skip only faulty amiibo{Environment.NewLine}Cancel to abort generating", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
                            if (diagResult == DialogResult.Yes)
                            {
                                break;
                            }
                            else if (diagResult == DialogResult.Cancel)
                            {
                                abort = true;
                                break;
                            }
                        }
                        else
                        {
                            AmiiboSNHelper.EncryptNtag(savePath, item.AmiiboTag);
                        }
                    }

                    item.ReloadAmiibo();

                    if (abort)
                    {
                        break;
                    }
                }

                MessageBox.Show($"Successfully generated {this.amiibos.Count * this.numUpDown.Value} Amiibos!", "Finished", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error while generating" + Environment.NewLine + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.tbOutput.ReadOnly  = false;
                this.btnExecute.Enabled = true;
                this.numUpDown.ReadOnly = false;
            }
        }