Пример #1
0
        private void dataGrid_SelectionChanged(object sender, EventArgs e)
        {
            if (this.dataGrid.SelectedRows.Count > 0)
            {
                var row = this.dataGrid.SelectedRows[0];
                var amiiboTagWrapper = (AmiiboTagWrapper)row.DataBoundItem;

                this.CleanUpAmiiboDisplay();

                this.btnExecute.Enabled = amiiboTagWrapper.AmiiboTag.IsDecrypted;

                this.amiiboImage.Image  = amiiboTagWrapper.GetBitmap(170, 170);
                this.lblAmiiboName.Text = amiiboTagWrapper.Name;

                this.tbStatueId.Text = amiiboTagWrapper.AmiiboTag.Amiibo.StatueId;
                this.tbSerial.Text   = AmiiboSNHelper.GetBytesAsString(amiiboTagWrapper.AmiiboTag.NtagSerial.ToArray());
                this.tbUID.Text      = AmiiboSNHelper.GetBytesAsString(amiiboTagWrapper.AmiiboTag.UID);
                this.lblWrites.Text  = "Write Counter: " + amiiboTagWrapper.AmiiboTag.WriteCounter.ToString();

                if (amiiboTagWrapper.AmiiboTag.HasUserData)
                {
                    this.tbNickname.Text     = amiiboTagWrapper.AmiiboTag.AmiiboSettings.AmiiboUserData.AmiiboNickname;
                    this.tbOwner.Text        = amiiboTagWrapper.AmiiboTag.AmiiboSettings.AmiiboUserData.OwnerMii.MiiNickname;
                    this.tbRegisterDate.Text = amiiboTagWrapper.AmiiboTag.AmiiboSettings.AmiiboUserData.AmiiboSetupDate.ToString("dd.MM.yyyy");
                }

                if (amiiboTagWrapper.AmiiboTag.HasAppData)
                {
                    this.tbDataSource.Text = "0" + amiiboTagWrapper.AmiiboTag.AmiiboSettings.AmiiboAppData.AppDataInitializationTitleID.TitleID.ToString("x2");
                    this.tbPlatform.Text   = amiiboTagWrapper.AmiiboTag.AmiiboSettings.AmiiboAppData.AppDataInitializationTitleID.Platform.ToString();
                }
            }
        }
Пример #2
0
        private static AmiiboTag GetDecryptedAmiibo(string amiiboPath)
        {
            Console.WriteLine("Decrypting Amiibo");
            var amiibo = AmiiboSNHelper.LoadAndDecryptNtag(amiiboPath);

            if (amiibo == null || !amiibo.IsDecrypted)
            {
                Console.WriteLine("Amiibo was not decrypted");
                Console.WriteLine("Check if you are missing the key_retail.bin");
                Environment.Exit(3);
            }

            return(amiibo);
        }
Пример #3
0
 private void AddAmiibos(string[] files)
 {
     foreach (var file in files)
     {
         var amiibo = AmiiboSNHelper.LoadAndDecryptNtag(file);
         if (amiibo != null)
         {
             if (!this.amiibos.Any(a => AmiiboSNHelper.EqualAmiiboTag(a.AmiiboTag, amiibo)))
             {
                 this.amiibos.Add(new AmiiboTagWrapper(file, amiibo));
             }
             else
             {
                 MessageBox.Show($"{file} was already loaded", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
 }
Пример #4
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);
                }
            }
        }
Пример #5
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;
            }
        }