Fixed a few bugs and switched to .NET framework 4.7

This commit is contained in:
Grigory Chudov
2018-10-21 14:12:05 -04:00
parent dd1358f8dc
commit 9754a9a328
82 changed files with 842 additions and 557 deletions

View File

@@ -86,9 +86,10 @@ namespace CUETools.CTDB.EACPlugin
}
foreach (var coverart in metadata.coverart)
{
var uri = Options.CoversSearch == CTDBCoversSearch.Large ?
var uri = Options.CoversSize == CTDBCoversSize.Large ?
coverart.uri : coverart.uri150 ?? coverart.uri;
if (knownUrls.Contains(uri) || !coverart.primary)
if (knownUrls.Contains(uri) ||
(Options.CoversSearch == CTDBCoversSearch.Primary && !coverart.primary))
continue;
var ms = new MemoryStream();
if (!this.ctdb.FetchFile(uri, ms))

View File

@@ -41,36 +41,43 @@ namespace AudioDataPlugIn
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.radioButtonCoversNone = new System.Windows.Forms.RadioButton();
this.radioButtonCoversPrimary = new System.Windows.Forms.RadioButton();
this.radioButtonCoversExtensive = new System.Windows.Forms.RadioButton();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.radioButtonCoversSmall = new System.Windows.Forms.RadioButton();
this.radioButtonCoversLarge = new System.Windows.Forms.RadioButton();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(95, 13);
this.label1.Location = new System.Drawing.Point(142, 20);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(139, 13);
this.label1.Size = new System.Drawing.Size(205, 20);
this.label1.TabIndex = 0;
this.label1.Text = "CUETools DB Plugin V2.1.7";
//
// label2
//
this.label2.Location = new System.Drawing.Point(95, 67);
this.label2.Location = new System.Drawing.Point(142, 103);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(230, 34);
this.label2.Size = new System.Drawing.Size(345, 52);
this.label2.TabIndex = 1;
this.label2.Text = "Copyright (c) 2011-12 Grigory Chudov";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(95, 36);
this.linkLabel1.Location = new System.Drawing.Point(142, 55);
this.linkLabel1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(164, 13);
this.linkLabel1.Size = new System.Drawing.Size(234, 20);
this.linkLabel1.TabIndex = 3;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "http://db.cuetools.net/about.php";
@@ -79,18 +86,20 @@ namespace AudioDataPlugIn
// pictureBox1
//
this.pictureBox1.Image = global::CUETools.CTDB.EACPlugin.Properties.Resources.ctdb64;
this.pictureBox1.Location = new System.Drawing.Point(13, 13);
this.pictureBox1.Location = new System.Drawing.Point(20, 20);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(64, 64);
this.pictureBox1.Size = new System.Drawing.Size(96, 98);
this.pictureBox1.TabIndex = 4;
this.pictureBox1.TabStop = false;
//
// radioButtonMBExtensive
//
this.radioButtonMBExtensive.AutoSize = true;
this.radioButtonMBExtensive.Location = new System.Drawing.Point(6, 16);
this.radioButtonMBExtensive.Location = new System.Drawing.Point(9, 25);
this.radioButtonMBExtensive.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButtonMBExtensive.Name = "radioButtonMBExtensive";
this.radioButtonMBExtensive.Size = new System.Drawing.Size(71, 17);
this.radioButtonMBExtensive.Size = new System.Drawing.Size(102, 24);
this.radioButtonMBExtensive.TabIndex = 6;
this.radioButtonMBExtensive.TabStop = true;
this.radioButtonMBExtensive.Text = "Extensive";
@@ -99,9 +108,10 @@ namespace AudioDataPlugIn
// radioButtonMBFast
//
this.radioButtonMBFast.AutoSize = true;
this.radioButtonMBFast.Location = new System.Drawing.Point(6, 50);
this.radioButtonMBFast.Location = new System.Drawing.Point(9, 77);
this.radioButtonMBFast.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButtonMBFast.Name = "radioButtonMBFast";
this.radioButtonMBFast.Size = new System.Drawing.Size(45, 17);
this.radioButtonMBFast.Size = new System.Drawing.Size(66, 24);
this.radioButtonMBFast.TabIndex = 7;
this.radioButtonMBFast.TabStop = true;
this.radioButtonMBFast.Text = "Fast";
@@ -110,9 +120,10 @@ namespace AudioDataPlugIn
// radioButtonMBDefault
//
this.radioButtonMBDefault.AutoSize = true;
this.radioButtonMBDefault.Location = new System.Drawing.Point(6, 33);
this.radioButtonMBDefault.Location = new System.Drawing.Point(9, 51);
this.radioButtonMBDefault.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButtonMBDefault.Name = "radioButtonMBDefault";
this.radioButtonMBDefault.Size = new System.Drawing.Size(59, 17);
this.radioButtonMBDefault.Size = new System.Drawing.Size(86, 24);
this.radioButtonMBDefault.TabIndex = 8;
this.radioButtonMBDefault.TabStop = true;
this.radioButtonMBDefault.Text = "Default";
@@ -123,9 +134,11 @@ namespace AudioDataPlugIn
this.groupBox1.Controls.Add(this.radioButtonMBFast);
this.groupBox1.Controls.Add(this.radioButtonMBDefault);
this.groupBox1.Controls.Add(this.radioButtonMBExtensive);
this.groupBox1.Location = new System.Drawing.Point(12, 127);
this.groupBox1.Location = new System.Drawing.Point(18, 195);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(136, 87);
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox1.Size = new System.Drawing.Size(204, 134);
this.groupBox1.TabIndex = 15;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Metadata search mode:";
@@ -133,9 +146,10 @@ namespace AudioDataPlugIn
// buttonOk
//
this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOk.Location = new System.Drawing.Point(303, 189);
this.buttonOk.Location = new System.Drawing.Point(648, 291);
this.buttonOk.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(75, 25);
this.buttonOk.Size = new System.Drawing.Size(112, 38);
this.buttonOk.TabIndex = 17;
this.buttonOk.Text = "OK";
this.buttonOk.UseVisualStyleBackColor = true;
@@ -144,9 +158,10 @@ namespace AudioDataPlugIn
// buttonCancel
//
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(303, 158);
this.buttonCancel.Location = new System.Drawing.Point(648, 243);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 25);
this.buttonCancel.Size = new System.Drawing.Size(112, 38);
this.buttonCancel.TabIndex = 19;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
@@ -154,11 +169,13 @@ namespace AudioDataPlugIn
// groupBox2
//
this.groupBox2.Controls.Add(this.radioButtonCoversNone);
this.groupBox2.Controls.Add(this.radioButtonCoversSmall);
this.groupBox2.Controls.Add(this.radioButtonCoversLarge);
this.groupBox2.Location = new System.Drawing.Point(154, 127);
this.groupBox2.Controls.Add(this.radioButtonCoversPrimary);
this.groupBox2.Controls.Add(this.radioButtonCoversExtensive);
this.groupBox2.Location = new System.Drawing.Point(231, 195);
this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(136, 87);
this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox2.Size = new System.Drawing.Size(204, 134);
this.groupBox2.TabIndex = 16;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Covers search mode:";
@@ -166,20 +183,59 @@ namespace AudioDataPlugIn
// radioButtonCoversNone
//
this.radioButtonCoversNone.AutoSize = true;
this.radioButtonCoversNone.Location = new System.Drawing.Point(6, 50);
this.radioButtonCoversNone.Location = new System.Drawing.Point(9, 77);
this.radioButtonCoversNone.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButtonCoversNone.Name = "radioButtonCoversNone";
this.radioButtonCoversNone.Size = new System.Drawing.Size(51, 17);
this.radioButtonCoversNone.Size = new System.Drawing.Size(72, 24);
this.radioButtonCoversNone.TabIndex = 7;
this.radioButtonCoversNone.TabStop = true;
this.radioButtonCoversNone.Text = "None";
this.radioButtonCoversNone.UseVisualStyleBackColor = true;
//
// radioButtonCoversPrimary
//
this.radioButtonCoversPrimary.AutoSize = true;
this.radioButtonCoversPrimary.Location = new System.Drawing.Point(9, 51);
this.radioButtonCoversPrimary.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButtonCoversPrimary.Name = "radioButtonCoversPrimary";
this.radioButtonCoversPrimary.Size = new System.Drawing.Size(86, 24);
this.radioButtonCoversPrimary.TabIndex = 8;
this.radioButtonCoversPrimary.TabStop = true;
this.radioButtonCoversPrimary.Text = "Primary";
this.radioButtonCoversPrimary.UseVisualStyleBackColor = true;
//
// radioButtonCoversExtensive
//
this.radioButtonCoversExtensive.AutoSize = true;
this.radioButtonCoversExtensive.Location = new System.Drawing.Point(9, 25);
this.radioButtonCoversExtensive.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButtonCoversExtensive.Name = "radioButtonCoversExtensive";
this.radioButtonCoversExtensive.Size = new System.Drawing.Size(102, 24);
this.radioButtonCoversExtensive.TabIndex = 6;
this.radioButtonCoversExtensive.TabStop = true;
this.radioButtonCoversExtensive.Text = "Extensive";
this.radioButtonCoversExtensive.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.radioButtonCoversSmall);
this.groupBox3.Controls.Add(this.radioButtonCoversLarge);
this.groupBox3.Location = new System.Drawing.Point(443, 195);
this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.groupBox3.Size = new System.Drawing.Size(163, 134);
this.groupBox3.TabIndex = 17;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Covers size:";
//
// radioButtonCoversSmall
//
this.radioButtonCoversSmall.AutoSize = true;
this.radioButtonCoversSmall.Location = new System.Drawing.Point(6, 33);
this.radioButtonCoversSmall.Location = new System.Drawing.Point(9, 51);
this.radioButtonCoversSmall.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButtonCoversSmall.Name = "radioButtonCoversSmall";
this.radioButtonCoversSmall.Size = new System.Drawing.Size(50, 17);
this.radioButtonCoversSmall.Size = new System.Drawing.Size(73, 24);
this.radioButtonCoversSmall.TabIndex = 8;
this.radioButtonCoversSmall.TabStop = true;
this.radioButtonCoversSmall.Text = "Small";
@@ -188,9 +244,10 @@ namespace AudioDataPlugIn
// radioButtonCoversLarge
//
this.radioButtonCoversLarge.AutoSize = true;
this.radioButtonCoversLarge.Location = new System.Drawing.Point(6, 16);
this.radioButtonCoversLarge.Location = new System.Drawing.Point(9, 25);
this.radioButtonCoversLarge.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.radioButtonCoversLarge.Name = "radioButtonCoversLarge";
this.radioButtonCoversLarge.Size = new System.Drawing.Size(52, 17);
this.radioButtonCoversLarge.Size = new System.Drawing.Size(75, 24);
this.radioButtonCoversLarge.TabIndex = 6;
this.radioButtonCoversLarge.TabStop = true;
this.radioButtonCoversLarge.Text = "Large";
@@ -199,10 +256,11 @@ namespace AudioDataPlugIn
// Options
//
this.AcceptButton = this.buttonOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(390, 227);
this.ClientSize = new System.Drawing.Size(773, 354);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOk);
@@ -212,6 +270,7 @@ namespace AudioDataPlugIn
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Options";
@@ -223,6 +282,8 @@ namespace AudioDataPlugIn
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -242,6 +303,9 @@ namespace AudioDataPlugIn
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton radioButtonCoversNone;
private System.Windows.Forms.RadioButton radioButtonCoversPrimary;
private System.Windows.Forms.RadioButton radioButtonCoversExtensive;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.RadioButton radioButtonCoversSmall;
private System.Windows.Forms.RadioButton radioButtonCoversLarge;
}

View File

@@ -12,18 +12,25 @@ using System.Runtime.Serialization.Formatters.Binary;
namespace AudioDataPlugIn
{
public enum CTDBCoversSize
{
Small,
Large
}
public enum CTDBCoversSearch
{
Large,
Small,
None
None,
Primary,
Extensive
}
public partial class Options : Form
{
private static CTDBMetadataSearch? metadataSearch = null;
private static CTDBCoversSearch? coversSearch = null;
private static string optionsKey = @"SOFTWARE\CUETools\EACPugin";
private static CTDBCoversSize? coversSize = null;
private static string optionsKey = @"SOFTWARE\CUETools\EACPugin";
public static CTDBMetadataSearch MetadataSearch
{
get
@@ -67,7 +74,7 @@ namespace AudioDataPlugIn
{
using (var key = Registry.CurrentUser.OpenSubKey(optionsKey, false))
{
var val = key.GetValue("CoversSearch") as string;
var val = key.GetValue("CoversSearchMode") as string;
coversSearch = (CTDBCoversSearch)Enum.Parse(typeof(CTDBCoversSearch), val);
}
}
@@ -76,7 +83,40 @@ namespace AudioDataPlugIn
}
}
return coversSearch ?? CTDBCoversSearch.Small;
return coversSearch ?? CTDBCoversSearch.Primary;
}
set
{
using (var key = Registry.CurrentUser.CreateSubKey(optionsKey))
{
key.SetValue("CoversSearchMode", value.ToString());
}
coversSearch = value;
}
}
public static CTDBCoversSize CoversSize
{
get
{
if (!coversSize.HasValue)
{
try
{
using (var key = Registry.CurrentUser.OpenSubKey(optionsKey, false))
{
var val = key.GetValue("CoversSearch") as string;
coversSize = (CTDBCoversSize)Enum.Parse(typeof(CTDBCoversSize), val);
}
}
catch (Exception)
{
}
}
return coversSize ?? CTDBCoversSize.Small;
}
set
@@ -86,7 +126,7 @@ namespace AudioDataPlugIn
key.SetValue("CoversSearch", value.ToString());
}
coversSearch = value;
coversSize = value;
}
}
@@ -135,19 +175,23 @@ namespace AudioDataPlugIn
this.radioButtonMBExtensive.Checked = MetadataSearch == CTDBMetadataSearch.Extensive;
this.radioButtonMBDefault.Checked = MetadataSearch == CTDBMetadataSearch.Default;
this.radioButtonMBFast.Checked = MetadataSearch == CTDBMetadataSearch.Fast;
this.radioButtonCoversLarge.Checked = CoversSearch == CTDBCoversSearch.Large;
this.radioButtonCoversSmall.Checked = CoversSearch == CTDBCoversSearch.Small;
this.radioButtonCoversExtensive.Checked = CoversSearch == CTDBCoversSearch.Extensive;
this.radioButtonCoversPrimary.Checked = CoversSearch == CTDBCoversSearch.Primary;
this.radioButtonCoversNone.Checked = CoversSearch == CTDBCoversSearch.None;
}
this.radioButtonCoversLarge.Checked = CoversSize == CTDBCoversSize.Large;
this.radioButtonCoversSmall.Checked = CoversSize == CTDBCoversSize.Small;
}
private void button2_Click(object sender, EventArgs e)
private void button2_Click(object sender, EventArgs e)
{
Options.MetadataSearch = this.radioButtonMBExtensive.Checked ? CTDBMetadataSearch.Extensive
: this.radioButtonMBDefault.Checked ? CTDBMetadataSearch.Default
: this.radioButtonMBFast.Checked ? CTDBMetadataSearch.Fast
: CTDBMetadataSearch.None;
Options.CoversSearch = this.radioButtonCoversLarge.Checked ? CTDBCoversSearch.Large
: this.radioButtonCoversSmall.Checked ? CTDBCoversSearch.Small
Options.CoversSize = this.radioButtonCoversLarge.Checked ? CTDBCoversSize.Large
: CTDBCoversSize.Small;
Options.CoversSearch = this.radioButtonCoversExtensive.Checked ? CTDBCoversSearch.Extensive
: this.radioButtonCoversPrimary.Checked ? CTDBCoversSearch.Primary
: CTDBCoversSearch.None;
}
}