diff --git a/emutool/emutool/MainForm.Designer.cs b/emutool/emutool/MainForm.Designer.cs index 21189e6..3ef688f 100644 --- a/emutool/emutool/MainForm.Designer.cs +++ b/emutool/emutool/MainForm.Designer.cs @@ -34,7 +34,7 @@ private void InitializeComponent() this.RandomizeUuidCheck = new System.Windows.Forms.CheckBox(); this.label2 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.generateAllAmibosCheck = new System.Windows.Forms.CheckBox(); + this.CreateAllCheck = new System.Windows.Forms.CheckBox(); this.UseNameCheck = new System.Windows.Forms.CheckBox(); this.DirectoryNameBox = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); @@ -49,8 +49,8 @@ private void InitializeComponent() this.label3 = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.LastPathCheck = new System.Windows.Forms.CheckBox(); - this.label7 = new System.Windows.Forms.Label(); this.LastPathLabel = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); @@ -68,7 +68,7 @@ private void InitializeComponent() // // AmiiboNameBox // - this.AmiiboNameBox.Location = new System.Drawing.Point(124, 23); + this.AmiiboNameBox.Location = new System.Drawing.Point(124, 25); this.AmiiboNameBox.MaxLength = 10; this.AmiiboNameBox.Name = "AmiiboNameBox"; this.AmiiboNameBox.Size = new System.Drawing.Size(255, 20); @@ -78,7 +78,7 @@ private void InitializeComponent() // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(15, 26); + this.label1.Location = new System.Drawing.Point(15, 28); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(43, 13); this.label1.TabIndex = 2; @@ -87,7 +87,7 @@ private void InitializeComponent() // RandomizeUuidCheck // this.RandomizeUuidCheck.AutoSize = true; - this.RandomizeUuidCheck.Location = new System.Drawing.Point(18, 206); + this.RandomizeUuidCheck.Location = new System.Drawing.Point(18, 202); this.RandomizeUuidCheck.Name = "RandomizeUuidCheck"; this.RandomizeUuidCheck.Size = new System.Drawing.Size(168, 17); this.RandomizeUuidCheck.TabIndex = 4; @@ -99,7 +99,7 @@ private void InitializeComponent() // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(15, 129); + this.label2.Location = new System.Drawing.Point(15, 125); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(361, 65); this.label2.TabIndex = 5; @@ -107,7 +107,6 @@ private void InitializeComponent() // // groupBox2 // - this.groupBox2.Controls.Add(this.generateAllAmibosCheck); this.groupBox2.Controls.Add(this.UseNameCheck); this.groupBox2.Controls.Add(this.DirectoryNameBox); this.groupBox2.Controls.Add(this.label8); @@ -124,28 +123,28 @@ private void InitializeComponent() this.groupBox2.Controls.Add(this.RandomizeUuidCheck); this.groupBox2.Location = new System.Drawing.Point(418, 12); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(396, 453); + this.groupBox2.Size = new System.Drawing.Size(396, 341); this.groupBox2.TabIndex = 6; this.groupBox2.TabStop = false; - this.groupBox2.Text = "2 - Customize the virtual amiibo"; + this.groupBox2.Text = "2 - Generation settings"; // - // generateAllAmibosCheck + // CreateAllCheck // - this.generateAllAmibosCheck.AutoSize = true; - this.generateAllAmibosCheck.Location = new System.Drawing.Point(18, 297); - this.generateAllAmibosCheck.Name = "generateAllAmibosCheck"; - this.generateAllAmibosCheck.Size = new System.Drawing.Size(297, 17); - this.generateAllAmibosCheck.TabIndex = 11; - this.generateAllAmibosCheck.Text = "Generate all amiibos at once, instead of the selected one."; - this.generateAllAmibosCheck.UseVisualStyleBackColor = true; - this.generateAllAmibosCheck.CheckedChanged += new System.EventHandler(this.generateAllAmibosCheck_CheckedChanged); + this.CreateAllCheck.AutoSize = true; + this.CreateAllCheck.Location = new System.Drawing.Point(51, 514); + this.CreateAllCheck.Name = "CreateAllCheck"; + this.CreateAllCheck.Size = new System.Drawing.Size(294, 17); + this.CreateAllCheck.TabIndex = 11; + this.CreateAllCheck.Text = "Generate all amiibos at once, instead of the selected one"; + this.CreateAllCheck.UseVisualStyleBackColor = true; + this.CreateAllCheck.CheckedChanged += new System.EventHandler(this.generateAllAmibosCheck_CheckedChanged); // // UseNameCheck // this.UseNameCheck.AutoSize = true; this.UseNameCheck.Checked = true; this.UseNameCheck.CheckState = System.Windows.Forms.CheckState.Checked; - this.UseNameCheck.Location = new System.Drawing.Point(124, 75); + this.UseNameCheck.Location = new System.Drawing.Point(124, 77); this.UseNameCheck.Name = "UseNameCheck"; this.UseNameCheck.Size = new System.Drawing.Size(160, 17); this.UseNameCheck.TabIndex = 10; @@ -156,7 +155,7 @@ private void InitializeComponent() // DirectoryNameBox // this.DirectoryNameBox.Enabled = false; - this.DirectoryNameBox.Location = new System.Drawing.Point(124, 49); + this.DirectoryNameBox.Location = new System.Drawing.Point(124, 51); this.DirectoryNameBox.MaxLength = 10; this.DirectoryNameBox.Name = "DirectoryNameBox"; this.DirectoryNameBox.Size = new System.Drawing.Size(255, 20); @@ -166,7 +165,7 @@ private void InitializeComponent() // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label8.Location = new System.Drawing.Point(229, 403); + this.label8.Location = new System.Drawing.Point(229, 294); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(34, 13); this.label8.TabIndex = 13; @@ -175,7 +174,7 @@ private void InitializeComponent() // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(15, 422); + this.label9.Location = new System.Drawing.Point(15, 313); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(32, 13); this.label9.TabIndex = 11; @@ -184,7 +183,7 @@ private void InitializeComponent() // FtpPortBox // this.FtpPortBox.Enabled = false; - this.FtpPortBox.Location = new System.Drawing.Point(230, 419); + this.FtpPortBox.Location = new System.Drawing.Point(230, 310); this.FtpPortBox.Name = "FtpPortBox"; this.FtpPortBox.Size = new System.Drawing.Size(149, 20); this.FtpPortBox.TabIndex = 14; @@ -193,7 +192,7 @@ private void InitializeComponent() // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label5.Location = new System.Drawing.Point(15, 52); + this.label5.Location = new System.Drawing.Point(15, 54); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(96, 13); this.label5.TabIndex = 8; @@ -202,7 +201,7 @@ private void InitializeComponent() // SaveImageCheck // this.SaveImageCheck.AutoSize = true; - this.SaveImageCheck.Location = new System.Drawing.Point(18, 274); + this.SaveImageCheck.Location = new System.Drawing.Point(18, 247); this.SaveImageCheck.Name = "SaveImageCheck"; this.SaveImageCheck.Size = new System.Drawing.Size(245, 17); this.SaveImageCheck.TabIndex = 7; @@ -212,7 +211,7 @@ private void InitializeComponent() // FtpAddressBox // this.FtpAddressBox.Enabled = false; - this.FtpAddressBox.Location = new System.Drawing.Point(53, 419); + this.FtpAddressBox.Location = new System.Drawing.Point(53, 310); this.FtpAddressBox.Name = "FtpAddressBox"; this.FtpAddressBox.Size = new System.Drawing.Size(149, 20); this.FtpAddressBox.TabIndex = 12; @@ -221,7 +220,7 @@ private void InitializeComponent() // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label6.Location = new System.Drawing.Point(55, 403); + this.label6.Location = new System.Drawing.Point(55, 294); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(56, 13); this.label6.TabIndex = 11; @@ -230,7 +229,7 @@ private void InitializeComponent() // FtpSaveCheck // this.FtpSaveCheck.AutoSize = true; - this.FtpSaveCheck.Location = new System.Drawing.Point(18, 368); + this.FtpSaveCheck.Location = new System.Drawing.Point(18, 270); this.FtpSaveCheck.Name = "FtpSaveCheck"; this.FtpSaveCheck.Size = new System.Drawing.Size(184, 17); this.FtpSaveCheck.TabIndex = 11; @@ -253,7 +252,7 @@ private void InitializeComponent() this.label3.AutoSize = true; this.label3.BackColor = System.Drawing.SystemColors.Control; this.label3.ForeColor = System.Drawing.Color.DimGray; - this.label3.Location = new System.Drawing.Point(60, 570); + this.label3.Location = new System.Drawing.Point(473, 530); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(291, 13); this.label3.TabIndex = 8; @@ -265,7 +264,7 @@ private void InitializeComponent() this.groupBox3.Controls.Add(this.LastPathLabel); this.groupBox3.Controls.Add(this.label7); this.groupBox3.Controls.Add(this.CreateButton); - this.groupBox3.Location = new System.Drawing.Point(418, 471); + this.groupBox3.Location = new System.Drawing.Point(418, 358); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(396, 112); this.groupBox3.TabIndex = 9; @@ -285,14 +284,6 @@ private void InitializeComponent() this.LastPathCheck.UseVisualStyleBackColor = true; this.LastPathCheck.Visible = false; // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(12, 92); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(0, 13); - this.label7.TabIndex = 11; - // // LastPathLabel // this.LastPathLabel.AutoSize = true; @@ -305,12 +296,20 @@ private void InitializeComponent() this.LastPathLabel.Text = "Dummy"; this.LastPathLabel.Visible = false; // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(12, 92); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(0, 13); + this.label7.TabIndex = 11; + // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel2, this.toolStripStatusLabel1}); - this.statusStrip1.Location = new System.Drawing.Point(0, 593); + this.statusStrip1.Location = new System.Drawing.Point(0, 567); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(826, 22); this.statusStrip1.SizingGrip = false; @@ -333,7 +332,7 @@ private void InitializeComponent() // // AmiiboPictureBox // - this.AmiiboPictureBox.Location = new System.Drawing.Point(17, 60); + this.AmiiboPictureBox.Location = new System.Drawing.Point(17, 63); this.AmiiboPictureBox.Name = "AmiiboPictureBox"; this.AmiiboPictureBox.Size = new System.Drawing.Size(362, 434); this.AmiiboPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -344,7 +343,7 @@ private void InitializeComponent() // this.SeriesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.SeriesComboBox.FormattingEnabled = true; - this.SeriesComboBox.Location = new System.Drawing.Point(17, 26); + this.SeriesComboBox.Location = new System.Drawing.Point(17, 29); this.SeriesComboBox.Name = "SeriesComboBox"; this.SeriesComboBox.Size = new System.Drawing.Size(177, 21); this.SeriesComboBox.TabIndex = 1; @@ -354,7 +353,7 @@ private void InitializeComponent() // this.AmiiboComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.AmiiboComboBox.FormattingEnabled = true; - this.AmiiboComboBox.Location = new System.Drawing.Point(202, 26); + this.AmiiboComboBox.Location = new System.Drawing.Point(202, 29); this.AmiiboComboBox.Name = "AmiiboComboBox"; this.AmiiboComboBox.Size = new System.Drawing.Size(177, 21); this.AmiiboComboBox.TabIndex = 2; @@ -362,19 +361,20 @@ private void InitializeComponent() // // groupBox1 // + this.groupBox1.Controls.Add(this.CreateAllCheck); this.groupBox1.Controls.Add(this.AmiiboComboBox); this.groupBox1.Controls.Add(this.SeriesComboBox); this.groupBox1.Controls.Add(this.AmiiboPictureBox); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(396, 510); + this.groupBox1.Size = new System.Drawing.Size(396, 547); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = "1 - Choose a virtual amiibo"; // // AboutButton // - this.AboutButton.Location = new System.Drawing.Point(29, 532); + this.AboutButton.Location = new System.Drawing.Point(437, 494); this.AboutButton.Name = "AboutButton"; this.AboutButton.Size = new System.Drawing.Size(362, 28); this.AboutButton.TabIndex = 12; @@ -386,7 +386,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(826, 615); + this.ClientSize = new System.Drawing.Size(826, 589); this.Controls.Add(this.AboutButton); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.groupBox3); @@ -407,6 +407,7 @@ private void InitializeComponent() this.statusStrip1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.AmiiboPictureBox)).EndInit(); this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -442,7 +443,7 @@ private void InitializeComponent() private System.Windows.Forms.Button AboutButton; private System.Windows.Forms.Label LastPathLabel; private System.Windows.Forms.CheckBox LastPathCheck; - private System.Windows.Forms.CheckBox generateAllAmibosCheck; + private System.Windows.Forms.CheckBox CreateAllCheck; } } diff --git a/emutool/emutool/MainForm.cs b/emutool/emutool/MainForm.cs index 1814fed..db1194e 100644 --- a/emutool/emutool/MainForm.cs +++ b/emutool/emutool/MainForm.cs @@ -86,7 +86,7 @@ private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) var cur_amiibo = CurrentSeriesAmiibos[AmiiboComboBox.SelectedIndex]; AmiiboPictureBox.ImageLocation = cur_amiibo.ImageURL; AmiiboNameBox.Text = cur_amiibo.AmiiboName; - generateAllAmibosCheck.Checked = false; + CreateAllCheck.Checked = false; } catch(Exception ex) { @@ -94,15 +94,6 @@ private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) } } - private DialogResult ShowQuestionBox(string msg) - { - return MessageBox.Show(msg, DialogCaption, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); - } - - private bool CancelAmiiboCreation(string dir) - { - return ShowQuestionBox($"Virtual amiibo will be created in {dir}.\n\nThe directory will be deleted if it already exists.\n\nProceed with amiibo creation?") != DialogResult.OK; - } private void ShowErrorBox(string msg) { MessageBox.Show(msg, DialogCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -146,178 +137,179 @@ private string SelectDirectory() return null; } - private void Button1_Click(object sender, EventArgs e) + private void CreateAmiibo(string name, string dir_name, string base_dir, AmiiboAPI.Amiibo cur_amiibo) { - try + string out_path; + bool use_last_path = LastPathCheck.Checked; + if (use_last_path) { + if (string.IsNullOrEmpty(LastUsedPath)) + { + use_last_path = false; + } + } - var cur_amiibo = CurrentSeriesAmiibos[AmiiboComboBox.SelectedIndex]; - if (string.IsNullOrEmpty(AmiiboNameBox.Text)) - { - ShowErrorBox("No amiibo name was specified."); - return; - } - + bool save_to_ftp = FtpSaveCheck.Checked; + IPAddress ftp_ip = null; + int ftp_port = 0; + + // For FTP, use a temp directory to save the resulting files from amiibo.Save() before transfer + var ftp_tmp_path = Path.Combine(Environment.CurrentDirectory, "temp_ftp"); + var ftp_sd_folder = "/emuiibo/amiibo/"; + if (!string.IsNullOrEmpty(dir_name)) ftp_sd_folder += $"{dir_name}/"; - bool use_name_as_dir = UseNameCheck.Checked; - if(!use_name_as_dir && string.IsNullOrEmpty(DirectoryNameBox.Text)) + if (save_to_ftp) + { + // Prepare FTP path + out_path = Path.Combine(ftp_tmp_path, dir_name); + + // Validate the FTP address + if (!IPAddress.TryParse(FtpAddressBox.Text, out ftp_ip)) { - ShowErrorBox("No amiibo directory name was specified."); + ShowErrorBox("FTP address is invalid"); return; } - string name = AmiiboNameBox.Text; - string dir_name = name; - if(!use_name_as_dir) + if (!int.TryParse(FtpPortBox.Text, out ftp_port)) + { + ShowErrorBox("FTP port is invalid"); + return; + } + } + else + { + if (use_last_path) + { + out_path = Path.Combine(LastUsedPath, dir_name); + } + else { - dir_name = DirectoryNameBox.Text; + out_path = Path.Combine(base_dir, dir_name); } + } - string out_path = ""; - bool use_last_path = LastPathCheck.Checked; - if(use_last_path) + // Actually save the amiibo + var amiibo = AmiiboUtils.BuildAmiibo(cur_amiibo, name); + amiibo.Save(out_path, RandomizeUuidCheck.Checked, SaveImageCheck.Checked); + + + // Special handling for FTP + if (save_to_ftp) + { + var success = true; + using (var client = new FtpClient(ftp_ip.ToString(), ftp_port, new NetworkCredential("", ""))) { - if(string.IsNullOrEmpty(LastUsedPath)) + client.ConnectTimeout = 1000; + client.Connect(); + foreach (var file in Directory.GetFiles(out_path)) { - use_last_path = false; + var file_name = Path.GetFileName(file); + // Upload each file created, creating directories along the way + var status = client.UploadFile(file, ftp_sd_folder + file_name, createRemoteDir: true); + if (status != FtpStatus.Success) + { + success = false; + break; + } } + client.Disconnect(); } - bool save_to_ftp = FtpSaveCheck.Checked; - IPAddress ftp_ip = null; - int ftp_port = 0; - - // For FTP, use a temp directory to save the resulting files from amiibo.Save() before transfer - var ftp_tmp_path = Path.Combine(Environment.CurrentDirectory, "temp_ftp"); - var ftp_sd_folder = $"/emuiibo/amiibo/{dir_name}/"; - var selected_path = ""; + ExceptionUtils.Unless(success, "Error during FTP upload, please try again"); - if(save_to_ftp) + // Clean the temp directory + Directory.Delete(ftp_tmp_path, true); + } + else + { + if (!use_last_path) { - // Prepare FTP path - out_path = Path.Combine(ftp_tmp_path, dir_name); + // Update last used path + LastUsedPath = base_dir; + } + } + } - // Validate the FTP address - if(!IPAddress.TryParse(FtpAddressBox.Text, out ftp_ip)) + private void Button1_Click(object sender, EventArgs e) + { + try + { + string base_dir = null; + if(!FtpSaveCheck.Checked) + { + // If we're saving normally and we're not using the last path, ask the user for the path + base_dir = SelectDirectory(); + if(base_dir == null) { - ShowErrorBox("FTP address is invalid"); + // User cancelled return; } + } - if(!int.TryParse(FtpPortBox.Text, out ftp_port)) + if(!CreateAllCheck.Checked) + { + var cur_amiibo = CurrentSeriesAmiibos[AmiiboComboBox.SelectedIndex]; + if (string.IsNullOrEmpty(AmiiboNameBox.Text)) { - ShowErrorBox("FTP port is invalid"); + ShowErrorBox("No amiibo name was specified."); return; } - if(CancelAmiiboCreation($"'ftp://{ftp_ip.ToString()}:{ftp_port}{ftp_sd_folder}'")) + bool use_name_as_dir = UseNameCheck.Checked; + if (!use_name_as_dir && string.IsNullOrEmpty(DirectoryNameBox.Text)) { - // User cancelled + ShowErrorBox("No amiibo directory name was specified."); return; } - } - else - { - if(use_last_path) - { - if(CancelAmiiboCreation("the last used path")) - { - // User cancelled - return; - } - out_path = Path.Combine(LastUsedPath, dir_name); - } - else + + string name = AmiiboNameBox.Text; + string dir_name = name; + if (!use_name_as_dir) { - // If we're saving normally and we're not using the last path, ask the user for the path - selected_path = SelectDirectory(); - if(selected_path == null) - { - // User cancelled - return; - } - out_path = Path.Combine(selected_path, dir_name); - if(CancelAmiiboCreation($"'{out_path}'")) - { - // User cancelled - return; - } + dir_name = DirectoryNameBox.Text; } - } - // Actually save the amiibo - if (generateAllAmibosCheck.Checked) + CreateAmiibo(name, dir_name, base_dir, cur_amiibo); + MessageBox.Show("The virtual amiibo was successfully created.", DialogCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else { + var actual_base_dir = base_dir; AmiiboSeries = Amiibos.GetAmiiboSeries(); if (AmiiboSeries.Any()) { foreach (var series in AmiiboSeries) { + base_dir = Path.Combine(actual_base_dir, series); + FsUtils.RecreateDirectory(base_dir); CurrentSeriesAmiibos = Amiibos.GetAmiibosBySeries(series); if (CurrentSeriesAmiibos.Any()) { - var index = 0; foreach (var amiibo in CurrentSeriesAmiibos) { - - var amiibo_build = AmiiboUtils.BuildAmiibo(CurrentSeriesAmiibos[index], amiibo.AmiiboName); - amiibo_build.Save(out_path + "\\" + series + "\\" + amiibo.AmiiboName, RandomizeUuidCheck.Checked, SaveImageCheck.Checked); - index++; + CreateAmiibo(amiibo.AmiiboName, amiibo.AmiiboName, base_dir, amiibo); } } - } - } - } else - { - var amiibo = AmiiboUtils.BuildAmiibo(cur_amiibo, name); - amiibo.Save(out_path, RandomizeUuidCheck.Checked, SaveImageCheck.Checked); - } - - - // Special handling for FTP - if(save_to_ftp) - { - var success = true; - using(var client = new FtpClient(ftp_ip.ToString(), ftp_port, new NetworkCredential("", ""))) - { - client.ConnectTimeout = 1000; - client.Connect(); - foreach(var file in Directory.GetFiles(out_path)) - { - var file_name = Path.GetFileName(file); - // Upload each file created, creating directories along the way - var status = client.UploadFile(file, ftp_sd_folder + file_name, createRemoteDir: true); - if(status != FtpStatus.Success) + else { - success = false; - break; + MessageBox.Show("Ey, no amiibos"); } } - client.Disconnect(); } - - ExceptionUtils.Unless(success, "Error during FTP upload, please try again"); - - // Clean the temp directory - Directory.Delete(ftp_tmp_path, true); - } - else - { - if(!use_last_path) + else { - // Update last used path - LastUsedPath = selected_path; + MessageBox.Show("Ey, no series"); } + MessageBox.Show("All virtual amiibos were successfully created.", DialogCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } - - MessageBox.Show("The virtual amiibo was successfully created.", DialogCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } - catch(Exception ex) + catch (Exception ex) { ExceptionUtils.LogExceptionMessage(ex); } + LastPathLabel.Visible = LastPathCheck.Visible = !string.IsNullOrEmpty(LastUsedPath); - if(LastPathLabel.Visible) + if (LastPathLabel.Visible) { LastPathLabel.Text = "Last path: " + LastUsedPath; } @@ -339,7 +331,7 @@ private void CheckBox3_CheckedChanged(object sender, EventArgs e) DirectoryNameBox.Enabled = !UseNameCheck.Checked; if (!UseNameCheck.Checked) { - generateAllAmibosCheck.Checked = false; + CreateAllCheck.Checked = false; } } @@ -359,16 +351,19 @@ private void AboutButton_Click(object sender, EventArgs e) private void generateAllAmibosCheck_CheckedChanged(object sender, EventArgs e) { - if (generateAllAmibosCheck.Checked) - { - UseNameCheck.Checked = true; - AmiiboNameBox.Text = "AllAmiibos"; - DirectoryNameBox.Text = ""; - } - else + if (!CreateAllCheck.Checked) { AmiiboNameBox.Text = AmiiboComboBox.Text; } + LastUsedPath = null; + LastPathLabel.Visible = false; + LastPathCheck.Checked = false; + UseNameCheck.Enabled = !CreateAllCheck.Checked; + AmiiboNameBox.Enabled = !CreateAllCheck.Checked; + DirectoryNameBox.Enabled = !CreateAllCheck.Checked && !UseNameCheck.Checked; + SeriesComboBox.Enabled = !CreateAllCheck.Checked; + AmiiboComboBox.Enabled = !CreateAllCheck.Checked; + AmiiboPictureBox.Visible = !CreateAllCheck.Checked; } } } \ No newline at end of file diff --git a/emutool/emutool/Properties/AssemblyInfo.cs b/emutool/emutool/Properties/AssemblyInfo.cs index bd294c3..16dc4cc 100644 --- a/emutool/emutool/Properties/AssemblyInfo.cs +++ b/emutool/emutool/Properties/AssemblyInfo.cs @@ -33,7 +33,7 @@ // Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión // utilizando el carácter "*", como se muestra a continuación: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.6.0.0")] -[assembly: AssemblyFileVersion("0.6.0.0")] +[assembly: AssemblyVersion("0.6.1.0")] +[assembly: AssemblyFileVersion("0.6.1.0")] [assembly: NeutralResourcesLanguage("en")]