diff --git a/CUETools.CTDB.EACPlugin/FormSubmitParity.Designer.cs b/CUETools.CTDB.EACPlugin/FormSubmitParity.Designer.cs new file mode 100644 index 0000000..7fc3c9d --- /dev/null +++ b/CUETools.CTDB.EACPlugin/FormSubmitParity.Designer.cs @@ -0,0 +1,75 @@ +namespace CUETools.CTDB.EACPlugin +{ + partial class FormSubmitParity + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); + this.SuspendLayout(); + // + // progressBar1 + // + this.progressBar1.Dock = System.Windows.Forms.DockStyle.Top; + this.progressBar1.Location = new System.Drawing.Point(10, 10); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(329, 23); + this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + this.progressBar1.TabIndex = 0; + // + // backgroundWorker1 + // + this.backgroundWorker1.WorkerReportsProgress = true; + this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork); + this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted); + this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged); + // + // FormSubmitParity + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(349, 49); + this.ControlBox = false; + this.Controls.Add(this.progressBar1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormSubmitParity"; + this.Padding = new System.Windows.Forms.Padding(10); + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Contacting CTDB..."; + this.Load += new System.EventHandler(this.FormMetadata_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ProgressBar progressBar1; + private System.ComponentModel.BackgroundWorker backgroundWorker1; + } +} \ No newline at end of file diff --git a/CUETools.CTDB.EACPlugin/FormSubmitParity.cs b/CUETools.CTDB.EACPlugin/FormSubmitParity.cs new file mode 100644 index 0000000..6818cbe --- /dev/null +++ b/CUETools.CTDB.EACPlugin/FormSubmitParity.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using CUETools.CTDB.EACPlugin.Properties; + +namespace CUETools.CTDB.EACPlugin +{ + public partial class FormSubmitParity : Form + { + private CUEToolsDB ctdb; + private int confidence, quality; + private string artist, title, agent, drivename; + + public FormSubmitParity(CUEToolsDB ctdb, int confidence, int quality, string artist, string title) + { + this.ctdb = ctdb; + this.confidence = confidence; + this.quality = quality; + this.artist = artist; + this.title = title; + this.InitializeComponent(); + } + + public FormSubmitParity(CUEToolsDB ctdb, string agent, string drivename) + { + this.ctdb = ctdb; + this.agent = agent; + this.drivename = drivename; + this.InitializeComponent(); + } + + private void FormMetadata_Load(object sender, EventArgs e) + { + this.Icon = Resources.ctdb; + this.backgroundWorker1.RunWorkerAsync(); + } + + private void UploadProgress(object sender, Krystalware.UploadHelper.UploadProgressEventArgs e) + { + this.backgroundWorker1.ReportProgress((int)e.percent, e.uri); + } + + private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) + { + this.ctdb.UploadHelper.onProgress += UploadProgress; + if (this.agent != null) + { + this.ctdb.ContactDB(this.agent, this.drivename, false, false); + } + else + { + this.ctdb.DoVerify(); + this.ctdb.Submit(this.confidence, this.quality, this.artist, this.title); + } + this.ctdb.UploadHelper.onProgress -= UploadProgress; + } + + private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + this.DialogResult = DialogResult.OK; + } + + private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) + { + this.progressBar1.Style = e.ProgressPercentage != 0 ? ProgressBarStyle.Continuous : ProgressBarStyle.Marquee; + this.progressBar1.Value = Math.Max(0, Math.Min(100, e.ProgressPercentage)); + } + } +} diff --git a/CUETools.CTDB.EACPlugin/FormSubmitParity.resx b/CUETools.CTDB.EACPlugin/FormSubmitParity.resx new file mode 100644 index 0000000..7aafc39 --- /dev/null +++ b/CUETools.CTDB.EACPlugin/FormSubmitParity.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/CUETools.CTDB.EACPlugin/Resources/ctdb32.png b/CUETools.CTDB.EACPlugin/Resources/ctdb32.png new file mode 100644 index 0000000..cfe050a Binary files /dev/null and b/CUETools.CTDB.EACPlugin/Resources/ctdb32.png differ