diff --git a/CUEPlayer/Browser.Designer.cs b/CUEPlayer/Browser.Designer.cs new file mode 100644 index 0000000..bd45191 --- /dev/null +++ b/CUEPlayer/Browser.Designer.cs @@ -0,0 +1,69 @@ +namespace CUEPlayer +{ + partial class Browser + { + /// + /// 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.fileSystemTreeView1 = new CUEControls.FileSystemTreeView(); + this.SuspendLayout(); + // + // fileSystemTreeView1 + // + this.fileSystemTreeView1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.fileSystemTreeView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.fileSystemTreeView1.Location = new System.Drawing.Point(0, 0); + this.fileSystemTreeView1.Name = "fileSystemTreeView1"; + this.fileSystemTreeView1.ShowLines = false; + this.fileSystemTreeView1.ShowRootLines = false; + this.fileSystemTreeView1.Size = new System.Drawing.Size(284, 264); + this.fileSystemTreeView1.SpecialFolders = new CUEControls.ExtraSpecialFolder[] { + CUEControls.ExtraSpecialFolder.MyComputer, + CUEControls.ExtraSpecialFolder.MyMusic, + CUEControls.ExtraSpecialFolder.CommonMusic}; + this.fileSystemTreeView1.TabIndex = 1; + this.fileSystemTreeView1.NodeExpand += new CUEControls.FileSystemTreeViewNodeExpandHandler(this.fileSystemTreeView1_NodeExpand); + // + // Browser + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 264); + this.ControlBox = false; + this.Controls.Add(this.fileSystemTreeView1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.Name = "Browser"; + this.Text = "Browser"; + this.Load += new System.EventHandler(this.Browser_Load); + this.ResumeLayout(false); + + } + + #endregion + + private CUEControls.FileSystemTreeView fileSystemTreeView1; + } +} \ No newline at end of file diff --git a/CUEPlayer/Browser.cs b/CUEPlayer/Browser.cs new file mode 100644 index 0000000..d21d465 --- /dev/null +++ b/CUEPlayer/Browser.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using CUEControls; +using CUETools.Codecs; +using CUETools.Processor; + +namespace CUEPlayer +{ + public partial class Browser : Form + { + private CUEConfig _config; + + public Browser() + { + InitializeComponent(); + } + + public void Init(frmCUEPlayer parent) + { + _config = parent.Config; + MdiParent = parent; + Show(); + fileSystemTreeView1.IconManager = parent.IconMgr; + fileSystemTreeView1.SelectedFolder = ExtraSpecialFolder.MyMusic; + } + + internal FileSystemTreeView TreeView + { + get + { + return fileSystemTreeView1; + } + } + + private void fileSystemTreeView1_NodeExpand(object sender, CUEControls.FileSystemTreeViewNodeExpandEventArgs e) + { + List fileGroups = CUESheet.ScanFolder(_config, e.files); + foreach (FileGroupInfo fileGroup in fileGroups) + { + TreeNode node = fileSystemTreeView1.NewNode(fileGroup.main, fileGroup.type == FileGroupInfoType.Folder); + if (fileGroup.type == FileGroupInfoType.TrackFiles) + node.Text = node.Text + ": " + fileGroup.files.Count.ToString() + " files"; + e.node.Nodes.Add(node); + } + } + + private void Browser_Load(object sender, EventArgs e) + { + + } + } +} diff --git a/CUEPlayer/Browser.resx b/CUEPlayer/Browser.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/CUEPlayer/Browser.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/CUEPlayer/CUEPlayer.csproj b/CUEPlayer/CUEPlayer.csproj new file mode 100644 index 0000000..d16a30b --- /dev/null +++ b/CUEPlayer/CUEPlayer.csproj @@ -0,0 +1,261 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {04E59836-0C5A-4B9B-8899-848D56911758} + WinExe + Properties + CUEPlayer + CUEPlayer + v2.0 + 512 + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + true + full + false + ..\bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\Release\ + TRACE + prompt + 4 + true + + + + + + + + + + + + + + Form + + + Browser.cs + + + DataSet1.xsd + Component + + + True + True + DataSet1.xsd + + + Form + + + Deck.cs + + + Form + + + frmCUEPlayer.cs + + + Form + + + Output.cs + + + Form + + + Playlist.cs + + + + + Browser.cs + + + Deck.cs + + + frmCUEPlayer.cs + + + Output.cs + + + Playlist.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {CA4D64E6-6544-4A29-8BA5-7DB08D50D072} + CUEControls + + + {1DD41038-D885-46C5-8DDE-E0B82F066584} + CUETools.CDImage + + + {FAD09EE2-D6B2-4A8E-9F1C-2A9FB293661A} + CUETools.Codecs.CoreAudio + + + {6458A13A-30EF-45A9-9D58-E5031B17BEE2} + CUETools.Codecs + + + {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2} + CUETools.DSP.Mixer + + + {A6303861-CA06-4C2C-A104-BA9291538F6F} + CUETools.DSP.Resampler + + + {4911BD82-49EF-4858-8B51-5394F86739A4} + CUETools.Processor + + + {8DD1E84B-0B03-4C0B-9B42-1E49F75E7CB1} + ProgressODoom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataSet1.xsd + + + Designer + MSDataSetGenerator + DataSet1.Designer.cs + + + DataSet1.xsd + + + + + + + False + .NET Framework Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + False + SQL Server Compact 3.5 + true + + + + + + + + + + \ No newline at end of file diff --git a/CUEPlayer/CUEPlayer.csproj.user b/CUEPlayer/CUEPlayer.csproj.user new file mode 100644 index 0000000..e75ce89 --- /dev/null +++ b/CUEPlayer/CUEPlayer.csproj.user @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + en-US + false + + + false + + \ No newline at end of file diff --git a/CUEPlayer/CUEPlayer.sdf b/CUEPlayer/CUEPlayer.sdf new file mode 100644 index 0000000..7626ba6 Binary files /dev/null and b/CUEPlayer/CUEPlayer.sdf differ diff --git a/CUEPlayer/CUEPlayerDataSet.Designer.cs b/CUEPlayer/CUEPlayerDataSet.Designer.cs new file mode 100644 index 0000000..952e549 --- /dev/null +++ b/CUEPlayer/CUEPlayerDataSet.Designer.cs @@ -0,0 +1,227 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4200 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#pragma warning disable 1591 + +namespace CUEPlayer { + + + /// + ///Represents a strongly typed in-memory cache of data. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.Serializable()] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")] + [global::System.Xml.Serialization.XmlRootAttribute("CUEPlayerDataSet")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")] + public partial class CUEPlayerDataSet : global::System.Data.DataSet { + + private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public CUEPlayerDataSet() { + this.BeginInit(); + this.InitClass(); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + base.Tables.CollectionChanged += schemaChangedHandler; + base.Relations.CollectionChanged += schemaChangedHandler; + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected CUEPlayerDataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context, false) { + if ((this.IsBinarySerialized(info, context) == true)) { + this.InitVars(false); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + this.Tables.CollectionChanged += schemaChangedHandler1; + this.Relations.CollectionChanged += schemaChangedHandler1; + return; + } + string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string)))); + if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { + global::System.Data.DataSet ds = new global::System.Data.DataSet(); + ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); + this.DataSetName = ds.DataSetName; + this.Prefix = ds.Prefix; + this.Namespace = ds.Namespace; + this.Locale = ds.Locale; + this.CaseSensitive = ds.CaseSensitive; + this.EnforceConstraints = ds.EnforceConstraints; + this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); + this.InitVars(); + } + else { + this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); + } + this.GetSerializationData(info, context); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + base.Tables.CollectionChanged += schemaChangedHandler; + this.Relations.CollectionChanged += schemaChangedHandler; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.BrowsableAttribute(true)] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)] + public override global::System.Data.SchemaSerializationMode SchemaSerializationMode { + get { + return this._schemaSerializationMode; + } + set { + this._schemaSerializationMode = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public new global::System.Data.DataTableCollection Tables { + get { + return base.Tables; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public new global::System.Data.DataRelationCollection Relations { + get { + return base.Relations; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void InitializeDerivedDataSet() { + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public override global::System.Data.DataSet Clone() { + CUEPlayerDataSet cln = ((CUEPlayerDataSet)(base.Clone())); + cln.InitVars(); + cln.SchemaSerializationMode = this.SchemaSerializationMode; + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override bool ShouldSerializeTables() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override bool ShouldSerializeRelations() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) { + if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { + this.Reset(); + global::System.Data.DataSet ds = new global::System.Data.DataSet(); + ds.ReadXml(reader); + this.DataSetName = ds.DataSetName; + this.Prefix = ds.Prefix; + this.Namespace = ds.Namespace; + this.Locale = ds.Locale; + this.CaseSensitive = ds.CaseSensitive; + this.EnforceConstraints = ds.EnforceConstraints; + this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); + this.InitVars(); + } + else { + this.ReadXml(reader); + this.InitVars(); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() { + global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream(); + this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null)); + stream.Position = 0; + return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars() { + this.InitVars(true); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars(bool initTable) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitClass() { + this.DataSetName = "CUEPlayerDataSet"; + this.Prefix = ""; + this.Namespace = "http://tempuri.org/CUEPlayerDataSet.xsd"; + this.EnforceConstraints = true; + this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) { + if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) { + this.InitVars(); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + CUEPlayerDataSet ds = new CUEPlayerDataSet(); + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); + any.Namespace = ds.Namespace; + sequence.Items.Add(any); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } +} + +#pragma warning restore 1591 \ No newline at end of file diff --git a/CUEPlayer/CUEPlayerDataSet.xsc b/CUEPlayer/CUEPlayerDataSet.xsc new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/CUEPlayer/CUEPlayerDataSet.xsc @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/CUEPlayer/CUEPlayerDataSet.xsd b/CUEPlayer/CUEPlayerDataSet.xsd new file mode 100644 index 0000000..2c3ad68 --- /dev/null +++ b/CUEPlayer/CUEPlayerDataSet.xsd @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CUEPlayer/CUEPlayerDataSet.xss b/CUEPlayer/CUEPlayerDataSet.xss new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/CUEPlayer/CUEPlayerDataSet.xss @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/CUEPlayer/DataSet1.Designer.cs b/CUEPlayer/DataSet1.Designer.cs new file mode 100644 index 0000000..c9f6c9e --- /dev/null +++ b/CUEPlayer/DataSet1.Designer.cs @@ -0,0 +1,1521 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4200 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +#pragma warning disable 1591 + +namespace CUEPlayer { + + + /// + ///Represents a strongly typed in-memory cache of data. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.Serializable()] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")] + [global::System.Xml.Serialization.XmlRootAttribute("DataSet1")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")] + public partial class DataSet1 : global::System.Data.DataSet { + + private PlaylistDataTable tablePlaylist; + + private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public DataSet1() { + this.BeginInit(); + this.InitClass(); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + base.Tables.CollectionChanged += schemaChangedHandler; + base.Relations.CollectionChanged += schemaChangedHandler; + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected DataSet1(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context, false) { + if ((this.IsBinarySerialized(info, context) == true)) { + this.InitVars(false); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + this.Tables.CollectionChanged += schemaChangedHandler1; + this.Relations.CollectionChanged += schemaChangedHandler1; + return; + } + string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string)))); + if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { + global::System.Data.DataSet ds = new global::System.Data.DataSet(); + ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); + if ((ds.Tables["Playlist"] != null)) { + base.Tables.Add(new PlaylistDataTable(ds.Tables["Playlist"])); + } + this.DataSetName = ds.DataSetName; + this.Prefix = ds.Prefix; + this.Namespace = ds.Namespace; + this.Locale = ds.Locale; + this.CaseSensitive = ds.CaseSensitive; + this.EnforceConstraints = ds.EnforceConstraints; + this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); + this.InitVars(); + } + else { + this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema))); + } + this.GetSerializationData(info, context); + global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged); + base.Tables.CollectionChanged += schemaChangedHandler; + this.Relations.CollectionChanged += schemaChangedHandler; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public PlaylistDataTable Playlist { + get { + return this.tablePlaylist; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.BrowsableAttribute(true)] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)] + public override global::System.Data.SchemaSerializationMode SchemaSerializationMode { + get { + return this._schemaSerializationMode; + } + set { + this._schemaSerializationMode = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public new global::System.Data.DataTableCollection Tables { + get { + return base.Tables; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public new global::System.Data.DataRelationCollection Relations { + get { + return base.Relations; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void InitializeDerivedDataSet() { + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public override global::System.Data.DataSet Clone() { + DataSet1 cln = ((DataSet1)(base.Clone())); + cln.InitVars(); + cln.SchemaSerializationMode = this.SchemaSerializationMode; + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override bool ShouldSerializeTables() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override bool ShouldSerializeRelations() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) { + if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) { + this.Reset(); + global::System.Data.DataSet ds = new global::System.Data.DataSet(); + ds.ReadXml(reader); + if ((ds.Tables["Playlist"] != null)) { + base.Tables.Add(new PlaylistDataTable(ds.Tables["Playlist"])); + } + this.DataSetName = ds.DataSetName; + this.Prefix = ds.Prefix; + this.Namespace = ds.Namespace; + this.Locale = ds.Locale; + this.CaseSensitive = ds.CaseSensitive; + this.EnforceConstraints = ds.EnforceConstraints; + this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add); + this.InitVars(); + } + else { + this.ReadXml(reader); + this.InitVars(); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() { + global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream(); + this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null)); + stream.Position = 0; + return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars() { + this.InitVars(true); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars(bool initTable) { + this.tablePlaylist = ((PlaylistDataTable)(base.Tables["Playlist"])); + if ((initTable == true)) { + if ((this.tablePlaylist != null)) { + this.tablePlaylist.InitVars(); + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitClass() { + this.DataSetName = "DataSet1"; + this.Prefix = ""; + this.Namespace = "http://tempuri.org/DataSet1.xsd"; + this.EnforceConstraints = true; + this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; + this.tablePlaylist = new PlaylistDataTable(); + base.Tables.Add(this.tablePlaylist); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private bool ShouldSerializePlaylist() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) { + if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) { + this.InitVars(); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + DataSet1 ds = new DataSet1(); + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); + any.Namespace = ds.Namespace; + sequence.Items.Add(any); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + + public delegate void PlaylistRowChangeEventHandler(object sender, PlaylistRowChangeEvent e); + + /// + ///Represents the strongly named DataTable class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class PlaylistDataTable : global::System.Data.DataTable, global::System.Collections.IEnumerable { + + private global::System.Data.DataColumn columnid; + + private global::System.Data.DataColumn columnpath; + + private global::System.Data.DataColumn columnartist; + + private global::System.Data.DataColumn columntitle; + + private global::System.Data.DataColumn columnalbum; + + private global::System.Data.DataColumn columnlength; + + private global::System.Data.DataColumn columntrack; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PlaylistDataTable() { + this.TableName = "Playlist"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal PlaylistDataTable(global::System.Data.DataTable table) { + this.TableName = table.TableName; + if ((table.CaseSensitive != table.DataSet.CaseSensitive)) { + this.CaseSensitive = table.CaseSensitive; + } + if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) { + this.Locale = table.Locale; + } + if ((table.Namespace != table.DataSet.Namespace)) { + this.Namespace = table.Namespace; + } + this.Prefix = table.Prefix; + this.MinimumCapacity = table.MinimumCapacity; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected PlaylistDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn idColumn { + get { + return this.columnid; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn pathColumn { + get { + return this.columnpath; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn artistColumn { + get { + return this.columnartist; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn titleColumn { + get { + return this.columntitle; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn albumColumn { + get { + return this.columnalbum; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn lengthColumn { + get { + return this.columnlength; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataColumn trackColumn { + get { + return this.columntrack; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PlaylistRow this[int index] { + get { + return ((PlaylistRow)(this.Rows[index])); + } + } + + public event PlaylistRowChangeEventHandler PlaylistRowChanging; + + public event PlaylistRowChangeEventHandler PlaylistRowChanged; + + public event PlaylistRowChangeEventHandler PlaylistRowDeleting; + + public event PlaylistRowChangeEventHandler PlaylistRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void AddPlaylistRow(PlaylistRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PlaylistRow AddPlaylistRow(string path, string artist, string title, string album, int length, int track) { + PlaylistRow rowPlaylistRow = ((PlaylistRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + null, + path, + artist, + title, + album, + length, + track}; + rowPlaylistRow.ItemArray = columnValuesArray; + this.Rows.Add(rowPlaylistRow); + return rowPlaylistRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PlaylistRow FindByid(int id) { + return ((PlaylistRow)(this.Rows.Find(new object[] { + id}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public virtual global::System.Collections.IEnumerator GetEnumerator() { + return this.Rows.GetEnumerator(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public override global::System.Data.DataTable Clone() { + PlaylistDataTable cln = ((PlaylistDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataTable CreateInstance() { + return new PlaylistDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal void InitVars() { + this.columnid = base.Columns["id"]; + this.columnpath = base.Columns["path"]; + this.columnartist = base.Columns["artist"]; + this.columntitle = base.Columns["title"]; + this.columnalbum = base.Columns["album"]; + this.columnlength = base.Columns["length"]; + this.columntrack = base.Columns["track"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitClass() { + this.columnid = new global::System.Data.DataColumn("id", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnid); + this.columnpath = new global::System.Data.DataColumn("path", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnpath); + this.columnartist = new global::System.Data.DataColumn("artist", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnartist); + this.columntitle = new global::System.Data.DataColumn("title", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columntitle); + this.columnalbum = new global::System.Data.DataColumn("album", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnalbum); + this.columnlength = new global::System.Data.DataColumn("length", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnlength); + this.columntrack = new global::System.Data.DataColumn("track", typeof(int), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columntrack); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnid}, true)); + this.columnid.AutoIncrement = true; + this.columnid.AutoIncrementSeed = -1; + this.columnid.AutoIncrementStep = -1; + this.columnid.AllowDBNull = false; + this.columnid.ReadOnly = true; + this.columnid.Unique = true; + this.columnpath.AllowDBNull = false; + this.columnpath.MaxLength = 100; + this.columnartist.MaxLength = 100; + this.columntitle.MaxLength = 100; + this.columnalbum.MaxLength = 100; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PlaylistRow NewPlaylistRow() { + return ((PlaylistRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new PlaylistRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override global::System.Type GetRowType() { + return typeof(PlaylistRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.PlaylistRowChanged != null)) { + this.PlaylistRowChanged(this, new PlaylistRowChangeEvent(((PlaylistRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.PlaylistRowChanging != null)) { + this.PlaylistRowChanging(this, new PlaylistRowChangeEvent(((PlaylistRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.PlaylistRowDeleted != null)) { + this.PlaylistRowDeleted(this, new PlaylistRowChangeEvent(((PlaylistRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.PlaylistRowDeleting != null)) { + this.PlaylistRowDeleting(this, new PlaylistRowChangeEvent(((PlaylistRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void RemovePlaylistRow(PlaylistRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { + global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); + global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); + DataSet1 ds = new DataSet1(); + global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); + any1.Namespace = "http://www.w3.org/2001/XMLSchema"; + any1.MinOccurs = new decimal(0); + any1.MaxOccurs = decimal.MaxValue; + any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any1); + global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); + any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + any2.MinOccurs = new decimal(1); + any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; + sequence.Items.Add(any2); + global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute1.Name = "namespace"; + attribute1.FixedValue = ds.Namespace; + type.Attributes.Add(attribute1); + global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); + attribute2.Name = "tableTypeName"; + attribute2.FixedValue = "PlaylistDataTable"; + type.Attributes.Add(attribute2); + type.Particle = sequence; + global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); + if (xs.Contains(dsSchema.TargetNamespace)) { + global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); + global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); + try { + global::System.Xml.Schema.XmlSchema schema = null; + dsSchema.Write(s1); + for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { + schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); + s2.SetLength(0); + schema.Write(s2); + if ((s1.Length == s2.Length)) { + s1.Position = 0; + s2.Position = 0; + for (; ((s1.Position != s1.Length) + && (s1.ReadByte() == s2.ReadByte())); ) { + ; + } + if ((s1.Position == s1.Length)) { + return type; + } + } + } + } + finally { + if ((s1 != null)) { + s1.Close(); + } + if ((s2 != null)) { + s2.Close(); + } + } + } + xs.Add(dsSchema); + return type; + } + } + + /// + ///Represents strongly named DataRow class. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public partial class PlaylistRow : global::System.Data.DataRow { + + private PlaylistDataTable tablePlaylist; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal PlaylistRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tablePlaylist = ((PlaylistDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int id { + get { + return ((int)(this[this.tablePlaylist.idColumn])); + } + set { + this[this.tablePlaylist.idColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public string path { + get { + return ((string)(this[this.tablePlaylist.pathColumn])); + } + set { + this[this.tablePlaylist.pathColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public string artist { + get { + try { + return ((string)(this[this.tablePlaylist.artistColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'artist\' in table \'Playlist\' is DBNull.", e); + } + } + set { + this[this.tablePlaylist.artistColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public string title { + get { + try { + return ((string)(this[this.tablePlaylist.titleColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'title\' in table \'Playlist\' is DBNull.", e); + } + } + set { + this[this.tablePlaylist.titleColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public string album { + get { + try { + return ((string)(this[this.tablePlaylist.albumColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'album\' in table \'Playlist\' is DBNull.", e); + } + } + set { + this[this.tablePlaylist.albumColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int length { + get { + try { + return ((int)(this[this.tablePlaylist.lengthColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'length\' in table \'Playlist\' is DBNull.", e); + } + } + set { + this[this.tablePlaylist.lengthColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int track { + get { + try { + return ((int)(this[this.tablePlaylist.trackColumn])); + } + catch (global::System.InvalidCastException e) { + throw new global::System.Data.StrongTypingException("The value for column \'track\' in table \'Playlist\' is DBNull.", e); + } + } + set { + this[this.tablePlaylist.trackColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsartistNull() { + return this.IsNull(this.tablePlaylist.artistColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetartistNull() { + this[this.tablePlaylist.artistColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IstitleNull() { + return this.IsNull(this.tablePlaylist.titleColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SettitleNull() { + this[this.tablePlaylist.titleColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IsalbumNull() { + return this.IsNull(this.tablePlaylist.albumColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetalbumNull() { + this[this.tablePlaylist.albumColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IslengthNull() { + return this.IsNull(this.tablePlaylist.lengthColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SetlengthNull() { + this[this.tablePlaylist.lengthColumn] = global::System.Convert.DBNull; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool IstrackNull() { + return this.IsNull(this.tablePlaylist.trackColumn); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public void SettrackNull() { + this[this.tablePlaylist.trackColumn] = global::System.Convert.DBNull; + } + } + + /// + ///Row event argument class + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public class PlaylistRowChangeEvent : global::System.EventArgs { + + private PlaylistRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PlaylistRowChangeEvent(PlaylistRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PlaylistRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + } +} +namespace CUEPlayer.DataSet1TableAdapters { + + + /// + ///Represents the connection and commands used to retrieve and save data. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DataObjectAttribute(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner" + + ", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public partial class PlaylistTableAdapter : global::System.ComponentModel.Component { + + private global::System.Data.SqlServerCe.SqlCeDataAdapter _adapter; + + private global::System.Data.SqlServerCe.SqlCeConnection _connection; + + private global::System.Data.SqlServerCe.SqlCeTransaction _transaction; + + private global::System.Data.SqlServerCe.SqlCeCommand[] _commandCollection; + + private bool _clearBeforeFill; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public PlaylistTableAdapter() { + this.ClearBeforeFill = true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected internal global::System.Data.SqlServerCe.SqlCeDataAdapter Adapter { + get { + if ((this._adapter == null)) { + this.InitAdapter(); + } + return this._adapter; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.SqlServerCe.SqlCeConnection Connection { + get { + if ((this._connection == null)) { + this.InitConnection(); + } + return this._connection; + } + set { + this._connection = value; + if ((this.Adapter.InsertCommand != null)) { + this.Adapter.InsertCommand.Connection = value; + } + if ((this.Adapter.DeleteCommand != null)) { + this.Adapter.DeleteCommand.Connection = value; + } + if ((this.Adapter.UpdateCommand != null)) { + this.Adapter.UpdateCommand.Connection = value; + } + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + if ((this.CommandCollection[i] != null)) { + ((global::System.Data.SqlServerCe.SqlCeCommand)(this.CommandCollection[i])).Connection = value; + } + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal global::System.Data.SqlServerCe.SqlCeTransaction Transaction { + get { + return this._transaction; + } + set { + this._transaction = value; + for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) { + this.CommandCollection[i].Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.DeleteCommand != null))) { + this.Adapter.DeleteCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.InsertCommand != null))) { + this.Adapter.InsertCommand.Transaction = this._transaction; + } + if (((this.Adapter != null) + && (this.Adapter.UpdateCommand != null))) { + this.Adapter.UpdateCommand.Transaction = this._transaction; + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected global::System.Data.SqlServerCe.SqlCeCommand[] CommandCollection { + get { + if ((this._commandCollection == null)) { + this.InitCommandCollection(); + } + return this._commandCollection; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool ClearBeforeFill { + get { + return this._clearBeforeFill; + } + set { + this._clearBeforeFill = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitAdapter() { + this._adapter = new global::System.Data.SqlServerCe.SqlCeDataAdapter(); + global::System.Data.Common.DataTableMapping tableMapping = new global::System.Data.Common.DataTableMapping(); + tableMapping.SourceTable = "Table"; + tableMapping.DataSetTable = "Playlist"; + tableMapping.ColumnMappings.Add("id", "id"); + tableMapping.ColumnMappings.Add("path", "path"); + tableMapping.ColumnMappings.Add("artist", "artist"); + tableMapping.ColumnMappings.Add("title", "title"); + tableMapping.ColumnMappings.Add("album", "album"); + tableMapping.ColumnMappings.Add("length", "length"); + tableMapping.ColumnMappings.Add("track", "track"); + this._adapter.TableMappings.Add(tableMapping); + this._adapter.DeleteCommand = new global::System.Data.SqlServerCe.SqlCeCommand(); + this._adapter.DeleteCommand.Connection = this.Connection; + this._adapter.DeleteCommand.CommandText = "DELETE FROM [Playlist] WHERE (([id] = @p1))"; + this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text; + this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p1", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "id", global::System.Data.DataRowVersion.Original, null)); + this._adapter.InsertCommand = new global::System.Data.SqlServerCe.SqlCeCommand(); + this._adapter.InsertCommand.Connection = this.Connection; + this._adapter.InsertCommand.CommandText = "INSERT INTO [Playlist] ([path], [artist], [title], [album], [length], [track]) VA" + + "LUES (@p1, @p2, @p3, @p4, @p5, @p6)"; + this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text; + this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p1", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "path", global::System.Data.DataRowVersion.Current, null)); + this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p2", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "artist", global::System.Data.DataRowVersion.Current, null)); + this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p3", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "title", global::System.Data.DataRowVersion.Current, null)); + this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p4", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "album", global::System.Data.DataRowVersion.Current, null)); + this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p5", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "length", global::System.Data.DataRowVersion.Current, null)); + this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p6", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "track", global::System.Data.DataRowVersion.Current, null)); + this._adapter.UpdateCommand = new global::System.Data.SqlServerCe.SqlCeCommand(); + this._adapter.UpdateCommand.Connection = this.Connection; + this._adapter.UpdateCommand.CommandText = "UPDATE [Playlist] SET [path] = @p1, [artist] = @p2, [title] = @p3, [album] = @p4," + + " [length] = @p5, [track] = @p6 WHERE (([id] = @p7))"; + this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text; + this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p1", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "path", global::System.Data.DataRowVersion.Current, null)); + this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p2", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "artist", global::System.Data.DataRowVersion.Current, null)); + this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p3", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "title", global::System.Data.DataRowVersion.Current, null)); + this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p4", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "album", global::System.Data.DataRowVersion.Current, null)); + this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p5", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "length", global::System.Data.DataRowVersion.Current, null)); + this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p6", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "track", global::System.Data.DataRowVersion.Current, null)); + this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlServerCe.SqlCeParameter("@p7", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, true, 0, 0, "id", global::System.Data.DataRowVersion.Original, null)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitConnection() { + this._connection = new global::System.Data.SqlServerCe.SqlCeConnection(); + this._connection.ConnectionString = global::CUEPlayer.Properties.Settings.Default.CUEPlayerConnectionString; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private void InitCommandCollection() { + this._commandCollection = new global::System.Data.SqlServerCe.SqlCeCommand[1]; + this._commandCollection[0] = new global::System.Data.SqlServerCe.SqlCeCommand(); + this._commandCollection[0].Connection = this.Connection; + this._commandCollection[0].CommandText = "SELECT [id], [path], [artist], [title], [album], [length], [track] FROM [Playlist" + + "]"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)] + public virtual int Fill(DataSet1.PlaylistDataTable dataTable) { + this.Adapter.SelectCommand = this.CommandCollection[0]; + if ((this.ClearBeforeFill == true)) { + dataTable.Clear(); + } + int returnValue = this.Adapter.Fill(dataTable); + return returnValue; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, true)] + public virtual DataSet1.PlaylistDataTable GetData() { + this.Adapter.SelectCommand = this.CommandCollection[0]; + DataSet1.PlaylistDataTable dataTable = new DataSet1.PlaylistDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int Update(DataSet1.PlaylistDataTable dataTable) { + return this.Adapter.Update(dataTable); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int Update(DataSet1 dataSet) { + return this.Adapter.Update(dataSet, "Playlist"); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int Update(global::System.Data.DataRow dataRow) { + return this.Adapter.Update(new global::System.Data.DataRow[] { + dataRow}); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int Update(global::System.Data.DataRow[] dataRows) { + return this.Adapter.Update(dataRows); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)] + public virtual int Delete(int p1) { + this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(p1)); + global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State; + if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open) + != global::System.Data.ConnectionState.Open)) { + this.Adapter.DeleteCommand.Connection.Open(); + } + try { + int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery(); + return returnValue; + } + finally { + if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { + this.Adapter.DeleteCommand.Connection.Close(); + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)] + public virtual int Insert(string p1, string p2, string p3, string p4, global::System.Nullable p5, global::System.Nullable p6) { + if ((p1 == null)) { + throw new global::System.ArgumentNullException("p1"); + } + else { + this.Adapter.InsertCommand.Parameters[0].Value = ((string)(p1)); + } + if ((p2 == null)) { + this.Adapter.InsertCommand.Parameters[1].Value = global::System.DBNull.Value; + } + else { + this.Adapter.InsertCommand.Parameters[1].Value = ((string)(p2)); + } + if ((p3 == null)) { + this.Adapter.InsertCommand.Parameters[2].Value = global::System.DBNull.Value; + } + else { + this.Adapter.InsertCommand.Parameters[2].Value = ((string)(p3)); + } + if ((p4 == null)) { + this.Adapter.InsertCommand.Parameters[3].Value = global::System.DBNull.Value; + } + else { + this.Adapter.InsertCommand.Parameters[3].Value = ((string)(p4)); + } + if ((p5.HasValue == true)) { + this.Adapter.InsertCommand.Parameters[4].Value = ((int)(p5.Value)); + } + else { + this.Adapter.InsertCommand.Parameters[4].Value = global::System.DBNull.Value; + } + if ((p6.HasValue == true)) { + this.Adapter.InsertCommand.Parameters[5].Value = ((int)(p6.Value)); + } + else { + this.Adapter.InsertCommand.Parameters[5].Value = global::System.DBNull.Value; + } + global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State; + if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) + != global::System.Data.ConnectionState.Open)) { + this.Adapter.InsertCommand.Connection.Open(); + } + try { + int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery(); + return returnValue; + } + finally { + if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { + this.Adapter.InsertCommand.Connection.Close(); + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)] + public virtual int Update(string p1, string p2, string p3, string p4, global::System.Nullable p5, global::System.Nullable p6, int p7) { + if ((p1 == null)) { + throw new global::System.ArgumentNullException("p1"); + } + else { + this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(p1)); + } + if ((p2 == null)) { + this.Adapter.UpdateCommand.Parameters[1].Value = global::System.DBNull.Value; + } + else { + this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(p2)); + } + if ((p3 == null)) { + this.Adapter.UpdateCommand.Parameters[2].Value = global::System.DBNull.Value; + } + else { + this.Adapter.UpdateCommand.Parameters[2].Value = ((string)(p3)); + } + if ((p4 == null)) { + this.Adapter.UpdateCommand.Parameters[3].Value = global::System.DBNull.Value; + } + else { + this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(p4)); + } + if ((p5.HasValue == true)) { + this.Adapter.UpdateCommand.Parameters[4].Value = ((int)(p5.Value)); + } + else { + this.Adapter.UpdateCommand.Parameters[4].Value = global::System.DBNull.Value; + } + if ((p6.HasValue == true)) { + this.Adapter.UpdateCommand.Parameters[5].Value = ((int)(p6.Value)); + } + else { + this.Adapter.UpdateCommand.Parameters[5].Value = global::System.DBNull.Value; + } + this.Adapter.UpdateCommand.Parameters[6].Value = ((int)(p7)); + global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State; + if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open) + != global::System.Data.ConnectionState.Open)) { + this.Adapter.UpdateCommand.Connection.Open(); + } + try { + int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery(); + return returnValue; + } + finally { + if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { + this.Adapter.UpdateCommand.Connection.Close(); + } + } + } + } + + /// + ///TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + [global::System.ComponentModel.DesignerCategoryAttribute("code")] + [global::System.ComponentModel.ToolboxItem(true)] + [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerDesigner, Microsoft.VSD" + + "esigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapterManager")] + public partial class TableAdapterManager : global::System.ComponentModel.Component { + + private UpdateOrderOption _updateOrder; + + private PlaylistTableAdapter _playlistTableAdapter; + + private bool _backupDataSetBeforeUpdate; + + private global::System.Data.IDbConnection _connection; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public UpdateOrderOption UpdateOrder { + get { + return this._updateOrder; + } + set { + this._updateOrder = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" + + "ft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + + "", "System.Drawing.Design.UITypeEditor")] + public PlaylistTableAdapter PlaylistTableAdapter { + get { + return this._playlistTableAdapter; + } + set { + this._playlistTableAdapter = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool BackupDataSetBeforeUpdate { + get { + return this._backupDataSetBeforeUpdate; + } + set { + this._backupDataSetBeforeUpdate = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public global::System.Data.IDbConnection Connection { + get { + if ((this._connection != null)) { + return this._connection; + } + if (((this._playlistTableAdapter != null) + && (this._playlistTableAdapter.Connection != null))) { + return this._playlistTableAdapter.Connection; + } + return null; + } + set { + this._connection = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.ComponentModel.Browsable(false)] + public int TableAdapterInstanceCount { + get { + int count = 0; + if ((this._playlistTableAdapter != null)) { + count = (count + 1); + } + return count; + } + } + + /// + ///Update rows in top-down order. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private int UpdateUpdatedRows(DataSet1 dataSet, global::System.Collections.Generic.List allChangedRows, global::System.Collections.Generic.List allAddedRows) { + int result = 0; + if ((this._playlistTableAdapter != null)) { + global::System.Data.DataRow[] updatedRows = dataSet.Playlist.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent); + updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows); + if (((updatedRows != null) + && (0 < updatedRows.Length))) { + result = (result + this._playlistTableAdapter.Update(updatedRows)); + allChangedRows.AddRange(updatedRows); + } + } + return result; + } + + /// + ///Insert rows in top-down order. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private int UpdateInsertedRows(DataSet1 dataSet, global::System.Collections.Generic.List allAddedRows) { + int result = 0; + if ((this._playlistTableAdapter != null)) { + global::System.Data.DataRow[] addedRows = dataSet.Playlist.Select(null, null, global::System.Data.DataViewRowState.Added); + if (((addedRows != null) + && (0 < addedRows.Length))) { + result = (result + this._playlistTableAdapter.Update(addedRows)); + allAddedRows.AddRange(addedRows); + } + } + return result; + } + + /// + ///Delete rows in bottom-up order. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private int UpdateDeletedRows(DataSet1 dataSet, global::System.Collections.Generic.List allChangedRows) { + int result = 0; + if ((this._playlistTableAdapter != null)) { + global::System.Data.DataRow[] deletedRows = dataSet.Playlist.Select(null, null, global::System.Data.DataViewRowState.Deleted); + if (((deletedRows != null) + && (0 < deletedRows.Length))) { + result = (result + this._playlistTableAdapter.Update(deletedRows)); + allChangedRows.AddRange(deletedRows); + } + } + return result; + } + + /// + ///Remove inserted rows that become updated rows after calling TableAdapter.Update(inserted rows) first + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private global::System.Data.DataRow[] GetRealUpdatedRows(global::System.Data.DataRow[] updatedRows, global::System.Collections.Generic.List allAddedRows) { + if (((updatedRows == null) + || (updatedRows.Length < 1))) { + return updatedRows; + } + if (((allAddedRows == null) + || (allAddedRows.Count < 1))) { + return updatedRows; + } + global::System.Collections.Generic.List realUpdatedRows = new global::System.Collections.Generic.List(); + for (int i = 0; (i < updatedRows.Length); i = (i + 1)) { + global::System.Data.DataRow row = updatedRows[i]; + if ((allAddedRows.Contains(row) == false)) { + realUpdatedRows.Add(row); + } + } + return realUpdatedRows.ToArray(); + } + + /// + ///Update all changes to the dataset. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public virtual int UpdateAll(DataSet1 dataSet) { + if ((dataSet == null)) { + throw new global::System.ArgumentNullException("dataSet"); + } + if ((dataSet.HasChanges() == false)) { + return 0; + } + if (((this._playlistTableAdapter != null) + && (this.MatchTableAdapterConnection(this._playlistTableAdapter.Connection) == false))) { + throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + + "tring."); + } + global::System.Data.IDbConnection workConnection = this.Connection; + if ((workConnection == null)) { + throw new global::System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" + + "ger TableAdapter property to a valid TableAdapter instance."); + } + bool workConnOpened = false; + if (((workConnection.State & global::System.Data.ConnectionState.Broken) + == global::System.Data.ConnectionState.Broken)) { + workConnection.Close(); + } + if ((workConnection.State == global::System.Data.ConnectionState.Closed)) { + workConnection.Open(); + workConnOpened = true; + } + global::System.Data.IDbTransaction workTransaction = workConnection.BeginTransaction(); + if ((workTransaction == null)) { + throw new global::System.ApplicationException("The transaction cannot begin. The current data connection does not support transa" + + "ctions or the current state is not allowing the transaction to begin."); + } + global::System.Collections.Generic.List allChangedRows = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List allAddedRows = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List adaptersWithAcceptChangesDuringUpdate = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.Dictionary revertConnections = new global::System.Collections.Generic.Dictionary(); + int result = 0; + global::System.Data.DataSet backupDataSet = null; + if (this.BackupDataSetBeforeUpdate) { + backupDataSet = new global::System.Data.DataSet(); + backupDataSet.Merge(dataSet); + } + try { + // ---- Prepare for update ----------- + // + if ((this._playlistTableAdapter != null)) { + revertConnections.Add(this._playlistTableAdapter, this._playlistTableAdapter.Connection); + this._playlistTableAdapter.Connection = ((global::System.Data.SqlServerCe.SqlCeConnection)(workConnection)); + this._playlistTableAdapter.Transaction = ((global::System.Data.SqlServerCe.SqlCeTransaction)(workTransaction)); + if (this._playlistTableAdapter.Adapter.AcceptChangesDuringUpdate) { + this._playlistTableAdapter.Adapter.AcceptChangesDuringUpdate = false; + adaptersWithAcceptChangesDuringUpdate.Add(this._playlistTableAdapter.Adapter); + } + } + // + //---- Perform updates ----------- + // + if ((this.UpdateOrder == UpdateOrderOption.UpdateInsertDelete)) { + result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); + result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); + } + else { + result = (result + this.UpdateInsertedRows(dataSet, allAddedRows)); + result = (result + this.UpdateUpdatedRows(dataSet, allChangedRows, allAddedRows)); + } + result = (result + this.UpdateDeletedRows(dataSet, allChangedRows)); + // + //---- Commit updates ----------- + // + workTransaction.Commit(); + if ((0 < allAddedRows.Count)) { + global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; + allAddedRows.CopyTo(rows); + for (int i = 0; (i < rows.Length); i = (i + 1)) { + global::System.Data.DataRow row = rows[i]; + row.AcceptChanges(); + } + } + if ((0 < allChangedRows.Count)) { + global::System.Data.DataRow[] rows = new System.Data.DataRow[allChangedRows.Count]; + allChangedRows.CopyTo(rows); + for (int i = 0; (i < rows.Length); i = (i + 1)) { + global::System.Data.DataRow row = rows[i]; + row.AcceptChanges(); + } + } + } + catch (global::System.Exception ex) { + workTransaction.Rollback(); + // ---- Restore the dataset ----------- + if (this.BackupDataSetBeforeUpdate) { + global::System.Diagnostics.Debug.Assert((backupDataSet != null)); + dataSet.Clear(); + dataSet.Merge(backupDataSet); + } + else { + if ((0 < allAddedRows.Count)) { + global::System.Data.DataRow[] rows = new System.Data.DataRow[allAddedRows.Count]; + allAddedRows.CopyTo(rows); + for (int i = 0; (i < rows.Length); i = (i + 1)) { + global::System.Data.DataRow row = rows[i]; + row.AcceptChanges(); + row.SetAdded(); + } + } + } + throw ex; + } + finally { + if (workConnOpened) { + workConnection.Close(); + } + if ((this._playlistTableAdapter != null)) { + this._playlistTableAdapter.Connection = ((global::System.Data.SqlServerCe.SqlCeConnection)(revertConnections[this._playlistTableAdapter])); + this._playlistTableAdapter.Transaction = null; + } + if ((0 < adaptersWithAcceptChangesDuringUpdate.Count)) { + global::System.Data.Common.DataAdapter[] adapters = new System.Data.Common.DataAdapter[adaptersWithAcceptChangesDuringUpdate.Count]; + adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters); + for (int i = 0; (i < adapters.Length); i = (i + 1)) { + global::System.Data.Common.DataAdapter adapter = adapters[i]; + adapter.AcceptChangesDuringUpdate = true; + } + } + } + return result; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected virtual void SortSelfReferenceRows(global::System.Data.DataRow[] rows, global::System.Data.DataRelation relation, bool childFirst) { + global::System.Array.Sort(rows, new SelfReferenceComparer(relation, childFirst)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + protected virtual bool MatchTableAdapterConnection(global::System.Data.IDbConnection inputConnection) { + if ((this._connection != null)) { + return true; + } + if (((this.Connection == null) + || (inputConnection == null))) { + return true; + } + if (string.Equals(this.Connection.ConnectionString, inputConnection.ConnectionString, global::System.StringComparison.Ordinal)) { + return true; + } + return false; + } + + /// + ///Update Order Option + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + public enum UpdateOrderOption { + + InsertUpdateDelete = 0, + + UpdateInsertDelete = 1, + } + + /// + ///Used to sort self-referenced table's rows + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")] + private class SelfReferenceComparer : object, global::System.Collections.Generic.IComparer { + + private global::System.Data.DataRelation _relation; + + private int _childFirst; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + internal SelfReferenceComparer(global::System.Data.DataRelation relation, bool childFirst) { + this._relation = relation; + if (childFirst) { + this._childFirst = -1; + } + else { + this._childFirst = 1; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + private bool IsChildAndParent(global::System.Data.DataRow child, global::System.Data.DataRow parent) { + global::System.Diagnostics.Debug.Assert((child != null)); + global::System.Diagnostics.Debug.Assert((parent != null)); + global::System.Data.DataRow newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); + for ( + ; ((newParent != null) + && ((object.ReferenceEquals(newParent, child) == false) + && (object.ReferenceEquals(newParent, parent) == false))); + ) { + newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); + } + if ((newParent == null)) { + for (newParent = child.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); ((newParent != null) + && ((object.ReferenceEquals(newParent, child) == false) + && (object.ReferenceEquals(newParent, parent) == false))); + ) { + newParent = newParent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); + } + } + if (object.ReferenceEquals(newParent, parent)) { + return true; + } + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public int Compare(global::System.Data.DataRow row1, global::System.Data.DataRow row2) { + if (object.ReferenceEquals(row1, row2)) { + return 0; + } + if ((row1 == null)) { + return -1; + } + if ((row2 == null)) { + return 1; + } + + // Is row1 the child or grandchild of row2 + if (this.IsChildAndParent(row1, row2)) { + return this._childFirst; + } + + // Is row2 the child or grandchild of row1 + if (this.IsChildAndParent(row2, row1)) { + return (-1 * this._childFirst); + } + return 0; + } + } + } +} + +#pragma warning restore 1591 \ No newline at end of file diff --git a/CUEPlayer/DataSet1.cs b/CUEPlayer/DataSet1.cs new file mode 100644 index 0000000..cbf14c2 --- /dev/null +++ b/CUEPlayer/DataSet1.cs @@ -0,0 +1,9 @@ +namespace CUEPlayer { + + + public partial class DataSet1 { + partial class PlaylistDataTable + { + } + } +} diff --git a/CUEPlayer/DataSet1.xsc b/CUEPlayer/DataSet1.xsc new file mode 100644 index 0000000..551fc56 --- /dev/null +++ b/CUEPlayer/DataSet1.xsc @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/CUEPlayer/DataSet1.xsd b/CUEPlayer/DataSet1.xsd new file mode 100644 index 0000000..ec8a857 --- /dev/null +++ b/CUEPlayer/DataSet1.xsd @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + DELETE FROM [Playlist] WHERE (([id] = @p1)) + + + + + + + + INSERT INTO [Playlist] ([path], [artist], [title], [album], [length], [track]) VALUES (@p1, @p2, @p3, @p4, @p5, @p6) + + + + + + + + + + + + + SELECT [id], [path], [artist], [title], [album], [length], [track] FROM [Playlist] + + + + + + UPDATE [Playlist] SET [path] = @p1, [artist] = @p2, [title] = @p3, [album] = @p4, [length] = @p5, [track] = @p6 WHERE (([id] = @p7)) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CUEPlayer/DataSet1.xss b/CUEPlayer/DataSet1.xss new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/CUEPlayer/DataSet1.xss @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/CUEPlayer/Deck.Designer.cs b/CUEPlayer/Deck.Designer.cs new file mode 100644 index 0000000..ca284d4 --- /dev/null +++ b/CUEPlayer/Deck.Designer.cs @@ -0,0 +1,290 @@ +namespace CUEPlayer +{ + partial class Deck + { + /// + /// 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.components = new System.ComponentModel.Container(); + this.textBoxArtist = new System.Windows.Forms.TextBox(); + this.textBoxAlbum = new System.Windows.Forms.TextBox(); + this.textBoxTitle = new System.Windows.Forms.TextBox(); + this.textBoxDuration = new System.Windows.Forms.TextBox(); + this.pictureBox = new System.Windows.Forms.PictureBox(); + this.buttonPlay = new System.Windows.Forms.Button(); + this.buttonStop = new System.Windows.Forms.Button(); + this.mediaSlider = new MediaSlider.MediaSlider(); + this.buttonPause = new System.Windows.Forms.Button(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.mediaSliderVolume = new MediaSlider.MediaSlider(); + this.buttonRewind = new System.Windows.Forms.Button(); + this.buttonNext = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.SuspendLayout(); + // + // textBoxArtist + // + this.textBoxArtist.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBoxArtist.Location = new System.Drawing.Point(130, 12); + this.textBoxArtist.Name = "textBoxArtist"; + this.textBoxArtist.ReadOnly = true; + this.textBoxArtist.Size = new System.Drawing.Size(203, 13); + this.textBoxArtist.TabIndex = 10; + // + // textBoxAlbum + // + this.textBoxAlbum.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBoxAlbum.Location = new System.Drawing.Point(130, 31); + this.textBoxAlbum.Name = "textBoxAlbum"; + this.textBoxAlbum.ReadOnly = true; + this.textBoxAlbum.Size = new System.Drawing.Size(203, 13); + this.textBoxAlbum.TabIndex = 11; + // + // textBoxTitle + // + this.textBoxTitle.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBoxTitle.Location = new System.Drawing.Point(130, 50); + this.textBoxTitle.Name = "textBoxTitle"; + this.textBoxTitle.ReadOnly = true; + this.textBoxTitle.Size = new System.Drawing.Size(203, 13); + this.textBoxTitle.TabIndex = 12; + // + // textBoxDuration + // + this.textBoxDuration.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBoxDuration.Location = new System.Drawing.Point(130, 69); + this.textBoxDuration.Name = "textBoxDuration"; + this.textBoxDuration.ReadOnly = true; + this.textBoxDuration.Size = new System.Drawing.Size(123, 13); + this.textBoxDuration.TabIndex = 13; + // + // pictureBox + // + this.pictureBox.ErrorImage = global::CUEPlayer.Properties.Resources.ctdb; + this.pictureBox.Image = global::CUEPlayer.Properties.Resources.ctdb; + this.pictureBox.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.pictureBox.InitialImage = global::CUEPlayer.Properties.Resources.ctdb; + this.pictureBox.Location = new System.Drawing.Point(12, 12); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(100, 100); + this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox.TabIndex = 16; + this.pictureBox.TabStop = false; + // + // buttonPlay + // + this.buttonPlay.BackColor = System.Drawing.Color.Transparent; + this.buttonPlay.BackgroundImage = global::CUEPlayer.Properties.Resources.control_play_blue; + this.buttonPlay.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.buttonPlay.FlatAppearance.BorderSize = 0; + this.buttonPlay.Location = new System.Drawing.Point(206, 87); + this.buttonPlay.Name = "buttonPlay"; + this.buttonPlay.Size = new System.Drawing.Size(25, 25); + this.buttonPlay.TabIndex = 4; + this.buttonPlay.UseVisualStyleBackColor = false; + this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click); + // + // buttonStop + // + this.buttonStop.Image = global::CUEPlayer.Properties.Resources.control_stop_blue; + this.buttonStop.Location = new System.Drawing.Point(231, 87); + this.buttonStop.Name = "buttonStop"; + this.buttonStop.Size = new System.Drawing.Size(25, 25); + this.buttonStop.TabIndex = 9; + this.buttonStop.UseVisualStyleBackColor = true; + this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click); + // + // mediaSlider + // + this.mediaSlider.Animated = false; + this.mediaSlider.AnimationSize = 0.2F; + this.mediaSlider.AnimationSpeed = MediaSlider.MediaSlider.AnimateSpeed.Normal; + this.mediaSlider.AutoScrollMargin = new System.Drawing.Size(0, 0); + this.mediaSlider.AutoScrollMinSize = new System.Drawing.Size(0, 0); + this.mediaSlider.BackColor = System.Drawing.SystemColors.Control; + this.mediaSlider.BackgroundImage = null; + this.mediaSlider.ButtonAccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.mediaSlider.ButtonBorderColor = System.Drawing.Color.Black; + this.mediaSlider.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(160)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.mediaSlider.ButtonCornerRadius = ((uint)(4u)); + this.mediaSlider.ButtonSize = new System.Drawing.Size(10, 20); + this.mediaSlider.ButtonStyle = MediaSlider.MediaSlider.ButtonType.GlassOverlap; + this.mediaSlider.ContextMenuStrip = null; + this.mediaSlider.LargeChange = 2; + this.mediaSlider.Location = new System.Drawing.Point(0, 115); + this.mediaSlider.Margin = new System.Windows.Forms.Padding(0); + this.mediaSlider.Maximum = 1; + this.mediaSlider.Minimum = 0; + this.mediaSlider.Name = "mediaSlider"; + this.mediaSlider.Orientation = System.Windows.Forms.Orientation.Horizontal; + this.mediaSlider.ShowButtonOnHover = true; + this.mediaSlider.Size = new System.Drawing.Size(362, 25); + this.mediaSlider.SliderFlyOut = MediaSlider.MediaSlider.FlyOutStyle.None; + this.mediaSlider.SmallChange = 1; + this.mediaSlider.SmoothScrolling = true; + this.mediaSlider.TabIndex = 9; + this.mediaSlider.TickColor = System.Drawing.Color.DarkGray; + this.mediaSlider.TickStyle = System.Windows.Forms.TickStyle.None; + this.mediaSlider.TickType = MediaSlider.MediaSlider.TickMode.Standard; + this.mediaSlider.TrackBorderColor = System.Drawing.SystemColors.ButtonShadow; + this.mediaSlider.TrackDepth = 9; + this.mediaSlider.TrackFillColor = System.Drawing.SystemColors.ButtonFace; + this.mediaSlider.TrackProgressColor = System.Drawing.Color.FromArgb(((int)(((byte)(5)))), ((int)(((byte)(101)))), ((int)(((byte)(188))))); + this.mediaSlider.TrackShadow = true; + this.mediaSlider.TrackShadowColor = System.Drawing.SystemColors.ButtonShadow; + this.mediaSlider.TrackStyle = MediaSlider.MediaSlider.TrackType.Progress; + this.mediaSlider.Value = 0; + this.mediaSlider.ValueChanged += new System.EventHandler(this.mediaSliderA_ValueChanged); + this.mediaSlider.Scrolled += new System.EventHandler(this.mediaSlider_Scrolled); + // + // buttonPause + // + this.buttonPause.Image = global::CUEPlayer.Properties.Resources.control_pause_blue; + this.buttonPause.Location = new System.Drawing.Point(256, 87); + this.buttonPause.Name = "buttonPause"; + this.buttonPause.Size = new System.Drawing.Size(25, 25); + this.buttonPause.TabIndex = 17; + this.buttonPause.UseVisualStyleBackColor = true; + this.buttonPause.Click += new System.EventHandler(this.buttonPause_Click); + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // mediaSliderVolume + // + this.mediaSliderVolume.Animated = false; + this.mediaSliderVolume.AnimationSize = 0.2F; + this.mediaSliderVolume.AnimationSpeed = MediaSlider.MediaSlider.AnimateSpeed.Normal; + this.mediaSliderVolume.AutoScrollMargin = new System.Drawing.Size(0, 0); + this.mediaSliderVolume.AutoScrollMinSize = new System.Drawing.Size(0, 0); + this.mediaSliderVolume.BackColor = System.Drawing.SystemColors.Control; + this.mediaSliderVolume.BackgroundImage = null; + this.mediaSliderVolume.ButtonAccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.mediaSliderVolume.ButtonBorderColor = System.Drawing.Color.Black; + this.mediaSliderVolume.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(160)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.mediaSliderVolume.ButtonCornerRadius = ((uint)(4u)); + this.mediaSliderVolume.ButtonSize = new System.Drawing.Size(14, 14); + this.mediaSliderVolume.ButtonStyle = MediaSlider.MediaSlider.ButtonType.GlassOverlap; + this.mediaSliderVolume.ContextMenuStrip = null; + this.mediaSliderVolume.LargeChange = 5; + this.mediaSliderVolume.Location = new System.Drawing.Point(336, 12); + this.mediaSliderVolume.Margin = new System.Windows.Forms.Padding(0); + this.mediaSliderVolume.Maximum = 100; + this.mediaSliderVolume.Minimum = 0; + this.mediaSliderVolume.Name = "mediaSliderVolume"; + this.mediaSliderVolume.Orientation = System.Windows.Forms.Orientation.Vertical; + this.mediaSliderVolume.ShowButtonOnHover = false; + this.mediaSliderVolume.Size = new System.Drawing.Size(26, 100); + this.mediaSliderVolume.SliderFlyOut = MediaSlider.MediaSlider.FlyOutStyle.None; + this.mediaSliderVolume.SmallChange = 1; + this.mediaSliderVolume.SmoothScrolling = true; + this.mediaSliderVolume.TabIndex = 18; + this.mediaSliderVolume.TickColor = System.Drawing.Color.DarkGray; + this.mediaSliderVolume.TickStyle = System.Windows.Forms.TickStyle.None; + this.mediaSliderVolume.TickType = MediaSlider.MediaSlider.TickMode.Standard; + this.mediaSliderVolume.TrackBorderColor = System.Drawing.SystemColors.ActiveBorder; + this.mediaSliderVolume.TrackDepth = 6; + this.mediaSliderVolume.TrackFillColor = System.Drawing.SystemColors.ActiveBorder; + this.mediaSliderVolume.TrackProgressColor = System.Drawing.Color.Green; + this.mediaSliderVolume.TrackShadow = true; + this.mediaSliderVolume.TrackShadowColor = System.Drawing.SystemColors.ScrollBar; + this.mediaSliderVolume.TrackStyle = MediaSlider.MediaSlider.TrackType.Progress; + this.mediaSliderVolume.Value = 100; + this.mediaSliderVolume.Scrolled += new System.EventHandler(this.mediaSliderVolume_Scrolled); + // + // buttonRewind + // + this.buttonRewind.Image = global::CUEPlayer.Properties.Resources.control_rewind_blue; + this.buttonRewind.Location = new System.Drawing.Point(281, 87); + this.buttonRewind.Name = "buttonRewind"; + this.buttonRewind.Size = new System.Drawing.Size(25, 25); + this.buttonRewind.TabIndex = 19; + this.buttonRewind.UseVisualStyleBackColor = true; + this.buttonRewind.Click += new System.EventHandler(this.buttonRewind_Click); + // + // buttonNext + // + this.buttonNext.Image = global::CUEPlayer.Properties.Resources.control_end_blue; + this.buttonNext.Location = new System.Drawing.Point(306, 87); + this.buttonNext.Name = "buttonNext"; + this.buttonNext.Size = new System.Drawing.Size(25, 25); + this.buttonNext.TabIndex = 20; + this.buttonNext.UseVisualStyleBackColor = true; + this.buttonNext.Click += new System.EventHandler(this.buttonNext_Click); + // + // Deck + // + this.AllowDrop = true; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(361, 145); + this.ControlBox = false; + this.Controls.Add(this.buttonNext); + this.Controls.Add(this.buttonRewind); + this.Controls.Add(this.mediaSliderVolume); + this.Controls.Add(this.buttonPause); + this.Controls.Add(this.mediaSlider); + this.Controls.Add(this.pictureBox); + this.Controls.Add(this.textBoxDuration); + this.Controls.Add(this.buttonPlay); + this.Controls.Add(this.textBoxTitle); + this.Controls.Add(this.buttonStop); + this.Controls.Add(this.textBoxAlbum); + this.Controls.Add(this.textBoxArtist); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Deck"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Deck"; + this.DragDrop += new System.Windows.Forms.DragEventHandler(this.Deck_DragDrop); + this.DragOver += new System.Windows.Forms.DragEventHandler(this.Deck_DragOver); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button buttonPlay; + private System.Windows.Forms.Button buttonStop; + private System.Windows.Forms.TextBox textBoxArtist; + private System.Windows.Forms.TextBox textBoxAlbum; + private System.Windows.Forms.TextBox textBoxTitle; + private System.Windows.Forms.TextBox textBoxDuration; + private System.Windows.Forms.PictureBox pictureBox; + private MediaSlider.MediaSlider mediaSlider; + private System.Windows.Forms.Button buttonPause; + private System.Windows.Forms.Timer timer1; + private MediaSlider.MediaSlider mediaSliderVolume; + private System.Windows.Forms.Button buttonRewind; + private System.Windows.Forms.Button buttonNext; + + } +} \ No newline at end of file diff --git a/CUEPlayer/Deck.cs b/CUEPlayer/Deck.cs new file mode 100644 index 0000000..d654ab3 --- /dev/null +++ b/CUEPlayer/Deck.cs @@ -0,0 +1,317 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Threading; +using System.Windows.Forms; +using CUETools.Codecs; +using CUETools.Processor; +using CUETools.DSP.Mixer; + +namespace CUEPlayer +{ + public partial class Deck : Form + { + IAudioSource playingSource = null; + CUESheet playingCue = null; + int playingRow = -1; + long playingStart = 0; + long playingFinish = 0; + Thread playThread; + int iSource; + MixingSource mixer; + MixingWriter writer; + Deck nextDeck; + bool needUpdate = false; + + public Deck(int iSource, string suffix) + { + InitializeComponent(); + this.iSource = iSource; + if (suffix != null) + Text += " " + suffix; + //mediaSliderA.FlyOutInfo += new MediaSlider.MediaSlider.FlyOutInfoDelegate(mediaSliderA_FlyOutInfo); + } + + public void Init(frmCUEPlayer parent, Deck nextDeck) + { + MdiParent = parent; + mixer = (parent as frmCUEPlayer).Mixer; + writer = new MixingWriter(mixer, iSource); + this.nextDeck = nextDeck; + Show(); + } + + //void mediaSliderA_FlyOutInfo(ref string data) + //{ + // TimeSpan ts = TimeSpan.FromSeconds(mediaSliderA.Value / 44100.0); + // data = ts.ToString(); + //} + + internal int PlayingOffset + { + set + { + if (!mediaSlider.Capture) mediaSlider.Value = value; + } + } + + internal void UpdateDeck() + { + if (needUpdate) + { + needUpdate = false; + + DataSet1 dataSet = (MdiParent as frmCUEPlayer).DataSet; + + mediaSlider.Maximum = (int)(playingFinish - playingStart); + mediaSlider.Value = 0; + textBoxArtist.Text = playingRow < 0 ? "" : dataSet.Playlist[playingRow].artist; + textBoxAlbum.Text = playingRow < 0 ? "" : dataSet.Playlist[playingRow].album; + textBoxTitle.Text = playingRow < 0 ? "" : dataSet.Playlist[playingRow].title; + textBoxDuration.Text = ""; + pictureBox.Image = playingCue != null ? playingCue.Cover : pictureBox.InitialImage; + + if (nextDeck != null && nextDeck.playingSource == null && playingRow >= 0 && playingRow < dataSet.Playlist.Rows.Count - 1) + { + nextDeck.LoadDeck(playingRow + 1); + } + } + mediaSlider.Enabled = playingSource != null; + if (playingSource != null) + mediaSlider.Value = (int)(playingSource.Position - playingStart); + } + + private void mediaSliderA_ValueChanged(object sender, EventArgs e) + { + if (mediaSlider.Maximum == 1) return; + TimeSpan len1 = TimeSpan.FromSeconds(mediaSlider.Maximum / 44100.0); + TimeSpan len2 = TimeSpan.FromSeconds(mediaSlider.Value / 44100.0); + string lenStr1 = string.Format("{0:d}.{1:d2}:{2:d2}:{3:d2}", len1.Days, len1.Hours, len1.Minutes, len1.Seconds).TrimStart('0', ':', '.'); + string lenStr2 = string.Format("{0:d}.{1:d2}:{2:d2}:{3:d2}", len2.Days, len2.Hours, len2.Minutes, len2.Seconds).TrimStart('0', ':', '.'); + lenStr1 = "0:00".Substring(0, Math.Max(0, 4 - lenStr1.Length)) + lenStr1; + lenStr2 = "0:00".Substring(0, Math.Max(0, 4 - lenStr2.Length)) + lenStr2; + textBoxDuration.Text = lenStr2 + " / " + lenStr1; + } + + private int seekTo = -1; + private bool stopNow = false; + + private void PlayThread() + { + AudioBuffer buff = new AudioBuffer(playingSource.PCM, 0x2000); + + try + { + do + { + if (playingSource == null) + writer.Pause(); + else + { + if (seekTo >= 0 && playingStart + seekTo < playingFinish) + { + playingSource.Position = playingStart + seekTo; + seekTo = -1; + } + if (playingSource.Position == playingFinish || stopNow || seekTo == (int)(playingFinish - playingStart)) + { + seekTo = -1; + playingSource.Close(); + playingSource = null; + if (playingCue != null) + { + playingCue.Close(); + playingCue = null; + } + playingFinish = 0; + playingStart = 0; + playingRow = -1; + if (stopNow || nextDeck == null || nextDeck.playingSource == null) + { + writer.Flush(); + stopNow = false; + mixer.BufferPlaying(iSource, false); + needUpdate = true; + playThread = null; + return; + } + playingSource = nextDeck.playingSource; + playingCue = nextDeck.playingCue; + playingStart = nextDeck.playingStart; + playingFinish = nextDeck.playingFinish; + playingRow = nextDeck.playingRow; + needUpdate = true; + nextDeck.playingSource = null; + nextDeck.playingCue = null; + nextDeck.playingStart = 0; + nextDeck.playingFinish = 0; + nextDeck.playingRow = -1; + nextDeck.needUpdate = true; + } + playingSource.Read(buff, Math.Min(buff.Size, (int)(playingFinish - playingSource.Position))); + writer.Write(buff); + } + } while (true); + } + catch (Exception ex) + { + } + if (playingCue != null) + { + playingCue.Close(); + playingCue = null; + } + if (playingSource != null) + { + playingSource.Close(); + playingSource = null; + } + playThread = null; + } + + internal void LoadDeck(int row) + { + CUEConfig _config = (MdiParent as frmCUEPlayer).Config; + DataSet1 dataSet = (MdiParent as frmCUEPlayer).DataSet; + Playlist playlist = (MdiParent as frmCUEPlayer).wndPlaylist; + string path = dataSet.Playlist[row].path; + int track = dataSet.Playlist[row].track; + + try + { + playingCue = new CUESheet(_config); + playingCue.Open(path); + playingSource = new CUESheetAudio(playingCue); + playingSource.Position = (long)playingCue.TOC[track].Start * 588; + playingSource = new AudioPipe(playingSource, 0x2000); + playingStart = playingSource.Position; + playingFinish = playingStart + (long)playingCue.TOC[track].Length * 588; + playingRow = row; + //playlist.List.Items[playingRow].BackColor = Color.AliceBlue; + needUpdate = true; + UpdateDeck(); + } + catch (Exception ex) + { + playingStart = playingFinish = 0; + playingCue = null; + playingSource = null; + return; + } + } + + private void buttonPlay_Click(object sender, EventArgs e) + { + if (playingSource == null) + { + Playlist playlist = (MdiParent as frmCUEPlayer).wndPlaylist; + LoadDeck(playlist.List.SelectedIndices[0]); + } + mixer.BufferPlaying(iSource, true); + if (playThread == null) + { + playThread = new Thread(PlayThread); + playThread.Priority = ThreadPriority.AboveNormal; + playThread.IsBackground = true; + playThread.Name = Text; + playThread.Start(); + } + } + + private void buttonStop_Click(object sender, EventArgs e) + { + if (playThread != null) + { + stopNow = true; + playThread.Join(); + } + else + { + if (playingSource != null) + { + playingSource.Close(); + playingSource = null; + } + if (playingCue != null) + { + playingCue.Close(); + playingCue = null; + } + playingFinish = 0; + playingStart = 0; + playingRow = -1; + needUpdate = true; + UpdateDeck(); + } + } + + private void buttonPause_Click(object sender, EventArgs e) + { + mixer.BufferPlaying(iSource, false); + } + + private void timer1_Tick(object sender, EventArgs e) + { + UpdateDeck(); + } + + private void mediaSlider_Scrolled(object sender, EventArgs e) + { + if (playThread != null) + { + seekTo = mediaSlider.Value; + } + else + { + if (playingSource != null) + playingSource.Position = playingStart + mediaSlider.Value; + } + } + + private void mediaSliderVolume_Scrolled(object sender, EventArgs e) + { + writer.Volume = mediaSliderVolume.Value / 100.0f; + } + + private void Deck_DragOver(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.Serializable)) + { + e.Effect = DragDropEffects.Copy; + } + } + + private void Deck_DragDrop(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.Serializable)) + { + ListView.SelectedIndexCollection indexes = + e.Data.GetData(DataFormats.Serializable) as ListView.SelectedIndexCollection; + if (playThread == null && indexes != null) + { + LoadDeck(indexes[0]); + } + } + } + + private void buttonNext_Click(object sender, EventArgs e) + { + seekTo = (int)(playingFinish - playingStart); + } + + private void buttonRewind_Click(object sender, EventArgs e) + { + if (playThread != null) + { + seekTo = 0; + } + else if (playingSource != null) + { + playingSource.Position = playingStart; + } + } + } +} diff --git a/CUEPlayer/Deck.resx b/CUEPlayer/Deck.resx new file mode 100644 index 0000000..93f75a9 --- /dev/null +++ b/CUEPlayer/Deck.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/CUEPlayer/Output.Designer.cs b/CUEPlayer/Output.Designer.cs new file mode 100644 index 0000000..6d82c7a --- /dev/null +++ b/CUEPlayer/Output.Designer.cs @@ -0,0 +1,171 @@ +namespace CUEPlayer +{ + partial class Output + { + /// + /// 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.components = new System.ComponentModel.Container(); + this.mediaSliderVolume = new MediaSlider.MediaSlider(); + this.peakMeterCtrl1 = new Ernzo.WinForms.Controls.PeakMeterCtrl(); + this.buttonPause = new System.Windows.Forms.Button(); + this.buttonPlay = new System.Windows.Forms.Button(); + this.buttonStop = new System.Windows.Forms.Button(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.SuspendLayout(); + // + // mediaSliderVolume + // + this.mediaSliderVolume.Animated = false; + this.mediaSliderVolume.AnimationSize = 0.2F; + this.mediaSliderVolume.AnimationSpeed = MediaSlider.MediaSlider.AnimateSpeed.Normal; + this.mediaSliderVolume.AutoScrollMargin = new System.Drawing.Size(0, 0); + this.mediaSliderVolume.AutoScrollMinSize = new System.Drawing.Size(0, 0); + this.mediaSliderVolume.BackColor = System.Drawing.SystemColors.Control; + this.mediaSliderVolume.BackgroundImage = null; + this.mediaSliderVolume.ButtonAccentColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.mediaSliderVolume.ButtonBorderColor = System.Drawing.Color.Black; + this.mediaSliderVolume.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(160)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.mediaSliderVolume.ButtonCornerRadius = ((uint)(4u)); + this.mediaSliderVolume.ButtonSize = new System.Drawing.Size(14, 14); + this.mediaSliderVolume.ButtonStyle = MediaSlider.MediaSlider.ButtonType.GlassOverlap; + this.mediaSliderVolume.ContextMenuStrip = null; + this.mediaSliderVolume.LargeChange = 5; + this.mediaSliderVolume.Location = new System.Drawing.Point(9, 9); + this.mediaSliderVolume.Margin = new System.Windows.Forms.Padding(0); + this.mediaSliderVolume.Maximum = 100; + this.mediaSliderVolume.Minimum = 0; + this.mediaSliderVolume.Name = "mediaSliderVolume"; + this.mediaSliderVolume.Orientation = System.Windows.Forms.Orientation.Vertical; + this.mediaSliderVolume.ShowButtonOnHover = false; + this.mediaSliderVolume.Size = new System.Drawing.Size(37, 114); + this.mediaSliderVolume.SliderFlyOut = MediaSlider.MediaSlider.FlyOutStyle.None; + this.mediaSliderVolume.SmallChange = 1; + this.mediaSliderVolume.SmoothScrolling = true; + this.mediaSliderVolume.TabIndex = 14; + this.mediaSliderVolume.TickColor = System.Drawing.Color.DarkGray; + this.mediaSliderVolume.TickStyle = System.Windows.Forms.TickStyle.None; + this.mediaSliderVolume.TickType = MediaSlider.MediaSlider.TickMode.Standard; + this.mediaSliderVolume.TrackBorderColor = System.Drawing.SystemColors.ActiveBorder; + this.mediaSliderVolume.TrackDepth = 6; + this.mediaSliderVolume.TrackFillColor = System.Drawing.SystemColors.ActiveBorder; + this.mediaSliderVolume.TrackProgressColor = System.Drawing.Color.Green; + this.mediaSliderVolume.TrackShadow = true; + this.mediaSliderVolume.TrackShadowColor = System.Drawing.SystemColors.ScrollBar; + this.mediaSliderVolume.TrackStyle = MediaSlider.MediaSlider.TrackType.Progress; + this.mediaSliderVolume.Value = 0; + this.mediaSliderVolume.Scrolled += new System.EventHandler(this.mediaSliderVolume_Scrolled); + // + // peakMeterCtrl1 + // + this.peakMeterCtrl1.BandsCount = 2; + this.peakMeterCtrl1.ColorHigh = System.Drawing.Color.Red; + this.peakMeterCtrl1.ColorHighBack = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(150)))), ((int)(((byte)(150))))); + this.peakMeterCtrl1.ColorMedium = System.Drawing.Color.Yellow; + this.peakMeterCtrl1.ColorMediumBack = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(150))))); + this.peakMeterCtrl1.ColorNormal = System.Drawing.Color.Green; + this.peakMeterCtrl1.ColorNormalBack = System.Drawing.Color.FromArgb(((int)(((byte)(150)))), ((int)(((byte)(255)))), ((int)(((byte)(150))))); + this.peakMeterCtrl1.FalloffColor = System.Drawing.Color.Blue; + this.peakMeterCtrl1.GridColor = System.Drawing.Color.Gainsboro; + this.peakMeterCtrl1.LEDCount = 25; + this.peakMeterCtrl1.Location = new System.Drawing.Point(60, 9); + this.peakMeterCtrl1.Margin = new System.Windows.Forms.Padding(0); + this.peakMeterCtrl1.Name = "peakMeterCtrl1"; + this.peakMeterCtrl1.Size = new System.Drawing.Size(15, 109); + this.peakMeterCtrl1.TabIndex = 13; + this.peakMeterCtrl1.Text = "peakMeterCtrl1"; + // + // buttonPause + // + this.buttonPause.Image = global::CUEPlayer.Properties.Resources.control_pause_blue; + this.buttonPause.Location = new System.Drawing.Point(59, 130); + this.buttonPause.Name = "buttonPause"; + this.buttonPause.Size = new System.Drawing.Size(25, 25); + this.buttonPause.TabIndex = 12; + this.buttonPause.UseVisualStyleBackColor = true; + this.buttonPause.Click += new System.EventHandler(this.buttonPause_Click); + // + // buttonPlay + // + this.buttonPlay.BackColor = System.Drawing.Color.Transparent; + this.buttonPlay.BackgroundImage = global::CUEPlayer.Properties.Resources.control_play_blue; + this.buttonPlay.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.buttonPlay.FlatAppearance.BorderSize = 0; + this.buttonPlay.Location = new System.Drawing.Point(9, 130); + this.buttonPlay.Name = "buttonPlay"; + this.buttonPlay.Size = new System.Drawing.Size(25, 25); + this.buttonPlay.TabIndex = 10; + this.buttonPlay.UseVisualStyleBackColor = false; + this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click); + // + // buttonStop + // + this.buttonStop.Image = global::CUEPlayer.Properties.Resources.control_stop_blue; + this.buttonStop.Location = new System.Drawing.Point(34, 130); + this.buttonStop.Name = "buttonStop"; + this.buttonStop.Size = new System.Drawing.Size(25, 25); + this.buttonStop.TabIndex = 11; + this.buttonStop.UseVisualStyleBackColor = true; + this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click); + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Interval = 50; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // Output + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(96, 168); + this.ControlBox = false; + this.Controls.Add(this.mediaSliderVolume); + this.Controls.Add(this.peakMeterCtrl1); + this.Controls.Add(this.buttonPause); + this.Controls.Add(this.buttonPlay); + this.Controls.Add(this.buttonStop); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Output"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Output"; + this.Load += new System.EventHandler(this.Output_Load); + this.ResumeLayout(false); + + } + + #endregion + + private MediaSlider.MediaSlider mediaSliderVolume; + private Ernzo.WinForms.Controls.PeakMeterCtrl peakMeterCtrl1; + private System.Windows.Forms.Button buttonPause; + private System.Windows.Forms.Button buttonPlay; + private System.Windows.Forms.Button buttonStop; + private System.Windows.Forms.Timer timer1; + } +} \ No newline at end of file diff --git a/CUEPlayer/Output.cs b/CUEPlayer/Output.cs new file mode 100644 index 0000000..568ef47 --- /dev/null +++ b/CUEPlayer/Output.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.Diagnostics; +using NAudio.CoreAudioApi; +using CUETools.Codecs; +using CUETools.Codecs.CoreAudio; +using CUETools.Processor; + +namespace CUEPlayer +{ + public partial class Output : Form + { + private MMDevice _device; + + internal MMDevice Device + { + get + { + return _device; + } + + set + { + _device = value; + } + } + + public Output() + { + InitializeComponent(); + } + + public void Init(frmCUEPlayer parent) + { + MdiParent = parent; + _device = WasapiOut.GetDefaultAudioEndpoint(); + _device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification); + mediaSliderVolume.Value = (int)(_device.AudioEndpointVolume.MasterVolumeLevelScalar * 100); + Show(); + } + + void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data) + { + if (data.EventContext == Guid.Empty) + return; + if (this.InvokeRequired) + this.Invoke((MethodInvoker)delegate() { AudioEndpointVolume_OnVolumeNotification(data); }); + else + mediaSliderVolume.Value = (int)(data.MasterVolume * 100); + } + + private void mediaSliderVolume_Scrolled(object sender, EventArgs e) + { + try + { + _device.AudioEndpointVolume.MasterVolumeLevelScalar = mediaSliderVolume.Value / 100.0f; + } + catch (Exception ex) + { + Trace.WriteLine(ex.Message); + } + } + + private int[] peakValues = null; + + private void timer1_Tick(object sender, EventArgs e) + { + if (_device == null) + return; + if (peakValues == null || peakValues.Length != _device.AudioMeterInformation.PeakValues.Count) + { + peakValues = new int[_device.AudioMeterInformation.PeakValues.Count]; + peakMeterCtrl1.SetMeterBands(peakValues.Length, 25); + } + for (int i = 0; i < peakValues.Length; i++) + peakValues[i] = (int)(_device.AudioMeterInformation.PeakValues[i] * 100); + //peakValues[0] = (int)(_device.AudioMeterInformation.MasterPeakValue * 100); + peakMeterCtrl1.SetData(peakValues, 0, peakValues.Length); + } + + private void buttonPlay_Click(object sender, EventArgs e) + { + (MdiParent as frmCUEPlayer).buttonPlay_Click(sender, e); + } + + private void buttonStop_Click(object sender, EventArgs e) + { + (MdiParent as frmCUEPlayer).buttonStop_Click(sender, e); + } + + private void buttonPause_Click(object sender, EventArgs e) + { + (MdiParent as frmCUEPlayer).buttonPause_Click(sender, e); + } + + private void Output_Load(object sender, EventArgs e) + { + peakMeterCtrl1.Start(50); + } + } +} diff --git a/CUEPlayer/Output.resx b/CUEPlayer/Output.resx new file mode 100644 index 0000000..93f75a9 --- /dev/null +++ b/CUEPlayer/Output.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/CUEPlayer/Playlist.Designer.cs b/CUEPlayer/Playlist.Designer.cs new file mode 100644 index 0000000..ed85e7d --- /dev/null +++ b/CUEPlayer/Playlist.Designer.cs @@ -0,0 +1,121 @@ +namespace CUEPlayer +{ + partial class Playlist + { + /// + /// 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.components = new System.ComponentModel.Container(); + this.listViewTracks = new System.Windows.Forms.ListView(); + this.columnName = new System.Windows.Forms.ColumnHeader(); + this.columnLength = new System.Windows.Forms.ColumnHeader(); + this.contextMenuStripPlaylist = new System.Windows.Forms.ContextMenuStrip(this.components); + this.exploreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.contextMenuStripPlaylist.SuspendLayout(); + this.SuspendLayout(); + // + // listViewTracks + // + this.listViewTracks.AllowDrop = true; + this.listViewTracks.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listViewTracks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnName, + this.columnLength}); + this.listViewTracks.ContextMenuStrip = this.contextMenuStripPlaylist; + this.listViewTracks.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewTracks.FullRowSelect = true; + this.listViewTracks.GridLines = true; + this.listViewTracks.Location = new System.Drawing.Point(0, 0); + this.listViewTracks.Margin = new System.Windows.Forms.Padding(0); + this.listViewTracks.Name = "listViewTracks"; + this.listViewTracks.Size = new System.Drawing.Size(372, 279); + this.listViewTracks.TabIndex = 6; + this.listViewTracks.UseCompatibleStateImageBehavior = false; + this.listViewTracks.View = System.Windows.Forms.View.Details; + this.listViewTracks.DragDrop += new System.Windows.Forms.DragEventHandler(this.listViewTracks_DragDrop); + this.listViewTracks.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewTracks_KeyDown); + this.listViewTracks.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.listViewTracks_ItemDrag); + this.listViewTracks.DragOver += new System.Windows.Forms.DragEventHandler(this.listViewTracks_DragOver); + // + // columnName + // + this.columnName.Text = "Name"; + this.columnName.Width = 256; + // + // columnLength + // + this.columnLength.Text = "Length"; + this.columnLength.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnLength.Width = 80; + // + // contextMenuStripPlaylist + // + this.contextMenuStripPlaylist.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.exploreToolStripMenuItem, + this.removeToolStripMenuItem}); + this.contextMenuStripPlaylist.Name = "contextMenuStripPlaylist"; + this.contextMenuStripPlaylist.Size = new System.Drawing.Size(118, 48); + // + // exploreToolStripMenuItem + // + this.exploreToolStripMenuItem.Name = "exploreToolStripMenuItem"; + this.exploreToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.exploreToolStripMenuItem.Text = "Explore"; + this.exploreToolStripMenuItem.Click += new System.EventHandler(this.exploreToolStripMenuItem_Click); + // + // removeToolStripMenuItem + // + this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.removeToolStripMenuItem.Text = "Remove"; + this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); + // + // Playlist + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(372, 279); + this.ControlBox = false; + this.Controls.Add(this.listViewTracks); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.Name = "Playlist"; + this.Text = "Playlist"; + this.contextMenuStripPlaylist.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListView listViewTracks; + private System.Windows.Forms.ColumnHeader columnName; + private System.Windows.Forms.ColumnHeader columnLength; + private System.Windows.Forms.ContextMenuStrip contextMenuStripPlaylist; + private System.Windows.Forms.ToolStripMenuItem exploreToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem; + } +} \ No newline at end of file diff --git a/CUEPlayer/Playlist.cs b/CUEPlayer/Playlist.cs new file mode 100644 index 0000000..fe3b888 --- /dev/null +++ b/CUEPlayer/Playlist.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.IO; +using System.Diagnostics; +using System.Windows.Forms; +using CUEControls; +using CUETools.Codecs; +using CUETools.Processor; + +namespace CUEPlayer +{ + public partial class Playlist : Form + { + private CUEConfig _config; + private ShellIconMgr _icon_mgr; + private DataSet1 dataSet; + + public Playlist() + { + InitializeComponent(); + } + + public void Init(frmCUEPlayer parent) + { + _config = parent.Config; + dataSet = parent.DataSet; + MdiParent = parent; + Show(); + _icon_mgr = parent.IconMgr; + listViewTracks.SmallImageList = _icon_mgr.ImageList; + foreach (DataSet1.PlaylistRow row in dataSet.Playlist) + listViewTracks.Items.Add(ToItem(row)); + } + + public ListView List + { + get + { + return listViewTracks; + } + } + + public ListViewItem ToItem(DataSet1.PlaylistRow row) + { + ListViewGroup in_group = null; + string group_name = (row.artist ?? "") + " - " + (row.album ?? ""); + foreach (ListViewGroup group in listViewTracks.Groups) + { + if (group.Name == group_name) + { + in_group = group; + break; + } + } + if (in_group == null) + { + in_group = new ListViewGroup(group_name, group_name); + listViewTracks.Groups.Add(in_group); + } + int iconIndex = _icon_mgr.GetIconIndex(new FileInfo(row.path), true); + ListViewItem item = new ListViewItem(row.title, iconIndex); + TimeSpan Length = TimeSpan.FromSeconds(row.length); + string lenStr = string.Format("{0:d}.{1:d2}:{2:d2}:{3:d2}", Length.Days, Length.Hours, Length.Minutes, Length.Seconds).TrimStart('0', ':', '.'); + item.SubItems.Add(new ListViewItem.ListViewSubItem(item, lenStr)); + item.Group = in_group; + item.Tag = row; + return item; + } + + private void exploreToolStripMenuItem_Click(object sender, EventArgs e) + { + if (listViewTracks.SelectedIndices.Count == 1) + { + int index = listViewTracks.SelectedIndices[0]; + string path = (listViewTracks.Items[index].Tag as DataSet1.PlaylistRow).path; + (MdiParent as frmCUEPlayer).browser.TreeView.SelectedPath = path; + } + } + + private void removeToolStripMenuItem_Click(object sender, EventArgs e) + { + while (listViewTracks.SelectedIndices.Count > 0) + { + int index = listViewTracks.SelectedIndices[0]; + (listViewTracks.Items[index].Tag as DataSet1.PlaylistRow).Delete(); + listViewTracks.Items.RemoveAt(index); + } + } + + private void listViewTracks_DragDrop(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); + if (files.Length == 1) + { + string path = files[0]; + try + { + CUESheet cue = new CUESheet(_config); + cue.Open(path); + for (int iTrack = 0; iTrack < cue.TrackCount; iTrack++) + { + DataSet1.PlaylistRow row = dataSet.Playlist.AddPlaylistRow( + path, + cue.Artist, + cue.Tracks[iTrack].Title, + cue.Title, + (int)cue.TOC[cue.TOC.FirstAudio + iTrack].Length / 75, + iTrack + 1); + listViewTracks.Items.Add(ToItem(row)); + } + cue.Close(); + return; + } + catch (Exception ex) + { + Trace.WriteLine(ex.Message); + } + + FileInfo fi = new FileInfo(path); + if (fi.Extension != ".cue") + { + DataSet1.PlaylistRow row = dataSet.Playlist.AddPlaylistRow( + path, + null, // cue.Artist, + null, // cue.Tracks[iTrack].Title, + null, // cue.Title, + 0, // (int)cue.TOC[cue.TOC.FirstAudio + iTrack].Length / 75, + 0); + listViewTracks.Items.Add(ToItem(row)); + } + } + } + } + + private void listViewTracks_DragOver(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { + e.Effect = DragDropEffects.Copy; + } + } + + private void listViewTracks_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Delete) + removeToolStripMenuItem_Click(sender, EventArgs.Empty); + } + + private void listViewTracks_ItemDrag(object sender, ItemDragEventArgs e) + { + if (e.Item != null && e.Item is ListViewItem) + { + DataObject dobj = new DataObject(DataFormats.Serializable, listViewTracks.SelectedIndices); + DragDropEffects effects = DoDragDrop(dobj, DragDropEffects.All); + return; + } + } + } +} diff --git a/CUEPlayer/Playlist.resx b/CUEPlayer/Playlist.resx new file mode 100644 index 0000000..9c5fe4d --- /dev/null +++ b/CUEPlayer/Playlist.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/CUEPlayer/Program.cs b/CUEPlayer/Program.cs new file mode 100644 index 0000000..d9ce000 --- /dev/null +++ b/CUEPlayer/Program.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace CUEPlayer +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new frmCUEPlayer()); + } + } +} diff --git a/CUEPlayer/Properties/AssemblyInfo.cs b/CUEPlayer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4fe4bde --- /dev/null +++ b/CUEPlayer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CUEPlayer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("CUEPlayer")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("64db1f35-5084-4f32-adc5-7d5b4059c9bf")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CUEPlayer/Properties/DataSources/frmCUEPlayer.datasource b/CUEPlayer/Properties/DataSources/frmCUEPlayer.datasource new file mode 100644 index 0000000..a71c582 --- /dev/null +++ b/CUEPlayer/Properties/DataSources/frmCUEPlayer.datasource @@ -0,0 +1,10 @@ + + + + CUEPlayer.frmCUEPlayer, CUEPlayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/CUEPlayer/Properties/Resources.Designer.cs b/CUEPlayer/Properties/Resources.Designer.cs new file mode 100644 index 0000000..3f6c907 --- /dev/null +++ b/CUEPlayer/Properties/Resources.Designer.cs @@ -0,0 +1,147 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4200 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CUEPlayer.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CUEPlayer.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static System.Drawing.Bitmap control_eject { + get { + object obj = ResourceManager.GetObject("control_eject", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_eject_blue { + get { + object obj = ResourceManager.GetObject("control_eject_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_end_blue { + get { + object obj = ResourceManager.GetObject("control_end_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_equalizer_blue { + get { + object obj = ResourceManager.GetObject("control_equalizer_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_fastforward_blue { + get { + object obj = ResourceManager.GetObject("control_fastforward_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_pause_blue { + get { + object obj = ResourceManager.GetObject("control_pause_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_play_blue { + get { + object obj = ResourceManager.GetObject("control_play_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_repeat_blue { + get { + object obj = ResourceManager.GetObject("control_repeat_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_rewind_blue { + get { + object obj = ResourceManager.GetObject("control_rewind_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_start_blue { + get { + object obj = ResourceManager.GetObject("control_start_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap control_stop_blue { + get { + object obj = ResourceManager.GetObject("control_stop_blue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap ctdb { + get { + object obj = ResourceManager.GetObject("ctdb", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/CUEPlayer/Properties/Resources.resx b/CUEPlayer/Properties/Resources.resx new file mode 100644 index 0000000..ca47dd6 --- /dev/null +++ b/CUEPlayer/Properties/Resources.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + ..\Resources\control_eject_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_fastforward_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_start_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_eject.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_end_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_repeat_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_rewind_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_pause_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_stop_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_play_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control_equalizer_blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ctdb.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/CUEPlayer/Properties/Settings.Designer.cs b/CUEPlayer/Properties/Settings.Designer.cs new file mode 100644 index 0000000..adad87b --- /dev/null +++ b/CUEPlayer/Properties/Settings.Designer.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4200 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CUEPlayer.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=|DataDirectory|\\CUEPlayer.sdf")] + public string CUEPlayerConnectionString { + get { + return ((string)(this["CUEPlayerConnectionString"])); + } + } + } +} diff --git a/CUEPlayer/Properties/Settings.settings b/CUEPlayer/Properties/Settings.settings new file mode 100644 index 0000000..c35c471 --- /dev/null +++ b/CUEPlayer/Properties/Settings.settings @@ -0,0 +1,14 @@ + + + + + + <?xml version="1.0" encoding="utf-16"?> +<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <ConnectionString>Data Source=|DataDirectory|\CUEPlayer.sdf</ConnectionString> + <ProviderName>Microsoft.SqlServerCe.Client.3.5</ProviderName> +</SerializableConnectionString> + Data Source=|DataDirectory|\CUEPlayer.sdf + + + \ No newline at end of file diff --git a/CUEPlayer/Resources/control_eject.png b/CUEPlayer/Resources/control_eject.png new file mode 100644 index 0000000..924d817 Binary files /dev/null and b/CUEPlayer/Resources/control_eject.png differ diff --git a/CUEPlayer/Resources/control_eject_blue.png b/CUEPlayer/Resources/control_eject_blue.png new file mode 100644 index 0000000..2bd4963 Binary files /dev/null and b/CUEPlayer/Resources/control_eject_blue.png differ diff --git a/CUEPlayer/Resources/control_end_blue.png b/CUEPlayer/Resources/control_end_blue.png new file mode 100644 index 0000000..7207935 Binary files /dev/null and b/CUEPlayer/Resources/control_end_blue.png differ diff --git a/CUEPlayer/Resources/control_equalizer_blue.png b/CUEPlayer/Resources/control_equalizer_blue.png new file mode 100644 index 0000000..1b2e6a3 Binary files /dev/null and b/CUEPlayer/Resources/control_equalizer_blue.png differ diff --git a/CUEPlayer/Resources/control_fastforward_blue.png b/CUEPlayer/Resources/control_fastforward_blue.png new file mode 100644 index 0000000..4a2f9d4 Binary files /dev/null and b/CUEPlayer/Resources/control_fastforward_blue.png differ diff --git a/CUEPlayer/Resources/control_pause_blue.png b/CUEPlayer/Resources/control_pause_blue.png new file mode 100644 index 0000000..ec61099 Binary files /dev/null and b/CUEPlayer/Resources/control_pause_blue.png differ diff --git a/CUEPlayer/Resources/control_play_blue.png b/CUEPlayer/Resources/control_play_blue.png new file mode 100644 index 0000000..f8c8ec6 Binary files /dev/null and b/CUEPlayer/Resources/control_play_blue.png differ diff --git a/CUEPlayer/Resources/control_repeat_blue.png b/CUEPlayer/Resources/control_repeat_blue.png new file mode 100644 index 0000000..406ec33 Binary files /dev/null and b/CUEPlayer/Resources/control_repeat_blue.png differ diff --git a/CUEPlayer/Resources/control_rewind_blue.png b/CUEPlayer/Resources/control_rewind_blue.png new file mode 100644 index 0000000..15d1584 Binary files /dev/null and b/CUEPlayer/Resources/control_rewind_blue.png differ diff --git a/CUEPlayer/Resources/control_start_blue.png b/CUEPlayer/Resources/control_start_blue.png new file mode 100644 index 0000000..6f11fcb Binary files /dev/null and b/CUEPlayer/Resources/control_start_blue.png differ diff --git a/CUEPlayer/Resources/control_stop_blue.png b/CUEPlayer/Resources/control_stop_blue.png new file mode 100644 index 0000000..e6f75d2 Binary files /dev/null and b/CUEPlayer/Resources/control_stop_blue.png differ diff --git a/CUEPlayer/Resources/ctdb.png b/CUEPlayer/Resources/ctdb.png new file mode 100644 index 0000000..b5226ea Binary files /dev/null and b/CUEPlayer/Resources/ctdb.png differ diff --git a/CUEPlayer/app.config b/CUEPlayer/app.config new file mode 100644 index 0000000..b579cd0 --- /dev/null +++ b/CUEPlayer/app.config @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/CUEPlayer/frmCUEPlayer.Designer.cs b/CUEPlayer/frmCUEPlayer.Designer.cs new file mode 100644 index 0000000..dd6e041 --- /dev/null +++ b/CUEPlayer/frmCUEPlayer.Designer.cs @@ -0,0 +1,51 @@ +namespace CUEPlayer +{ + partial class frmCUEPlayer + { + /// + /// 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.SuspendLayout(); + // + // frmCUEPlayer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1200, 477); + this.IsMdiContainer = true; + this.Name = "frmCUEPlayer"; + this.Text = "CUEPlayer 2.0.7"; + this.Load += new System.EventHandler(this.frmCUEPlayer_Load); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmCUEPlayer_FormClosing); + this.ResumeLayout(false); + + } + + #endregion + + } +} + diff --git a/CUEPlayer/frmCUEPlayer.cs b/CUEPlayer/frmCUEPlayer.cs new file mode 100644 index 0000000..109497f --- /dev/null +++ b/CUEPlayer/frmCUEPlayer.cs @@ -0,0 +1,354 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.IO; +using System.Threading; +using System.Windows.Forms; +using System.Diagnostics; +using NAudio.CoreAudioApi; +using CUEControls; +using CUETools.Codecs; +using CUETools.Codecs.CoreAudio; +using CUETools.DSP.Mixer; +using CUETools.DSP.Resampler; +using CUETools.Processor; + +namespace CUEPlayer +{ + public partial class frmCUEPlayer : Form + { + private ShellIconMgr _icon_mgr; + private CUEConfig _config; + private IWavePlayer _player; + DataSet1TableAdapters.PlaylistTableAdapter adapterPlayList = new DataSet1TableAdapters.PlaylistTableAdapter(); + private DataSet1 dataSet = new DataSet1(); + private Thread mixThread; + private MixingSource _mixer; + private SOXResampler _resampler; + + internal Playlist wndPlaylist + { + get + { + return playlist; + } + } + + internal DataSet1 DataSet + { + get + { + return dataSet; + } + } + + internal CUEConfig Config + { + get + { + return _config; + } + } + + internal ShellIconMgr IconMgr + { + get + { + return _icon_mgr; + } + } + + public MixingSource Mixer + { + get + { + return _mixer; + } + } + + public frmCUEPlayer() + { + InitializeComponent(); + _icon_mgr = new ShellIconMgr(); + _config = new CUEConfig(); + _config.separateDecodingThread = false; + } + + internal Deck deckA = new Deck(0, "A"); + internal Deck deckB = new Deck(1, "B"); + internal Output outputA = new Output(); + internal Browser browser = new Browser(); + internal Playlist playlist = new Playlist(); + + private void frmCUEPlayer_Load(object sender, EventArgs e) + { + int delay = 100; + AudioPCMConfig mixerPCM = AudioPCMConfig.RedBook; + + //System.Data.SqlServerCe.SqlCeDataAdapter ad = new System.Data.SqlServerCe.SqlCeDataAdapter(); + //ad.SelectCommand = new System.Data.SqlServerCe.SqlCeCommand("SELECT * FROM Playlist WHERE track=1", adapterPlayList.Connection); + //ad.Fill(dataSet.Playlist); + adapterPlayList.Fill(dataSet.Playlist); + + _mixer = new MixingSource(mixerPCM, delay, 2); + + outputA.Init(this); + browser.Init(this); + playlist.Init(this); + deckB.Init(this, null); + deckA.Init(this, deckB); + //LayoutMdi(MdiLayout.TileHorizontal); + + browser.Location = new Point(0, 0); + browser.Height = ClientRectangle.Height - 5; + playlist.Location = new Point(browser.Location.X + browser.Width, 0); + playlist.Height = ClientRectangle.Height - 5; + deckA.Location = new Point(playlist.Location.X + playlist.Width, 0); + deckB.Location = new Point(playlist.Location.X + playlist.Width, deckA.Height); + outputA.Location = new Point(deckA.Location.X + deckA.Width, 0); + + try + { + _player = new WasapiOut(outputA.Device, NAudio.CoreAudioApi.AudioClientShareMode.Shared, true, delay, new AudioPCMConfig(32, 2, 44100)); + } + catch + { + _player = null; + } + if (_player == null) + { + try + { + _player = new WasapiOut(outputA.Device, NAudio.CoreAudioApi.AudioClientShareMode.Shared, true, delay, new AudioPCMConfig(32, 2, 48000)); + SOXResamplerConfig cfg; + cfg.quality = SOXResamplerQuality.Very; + cfg.phase = 50; + cfg.allow_aliasing = false; + cfg.bandwidth = 0; + _resampler = new SOXResampler(mixerPCM, _player.PCM, cfg); + } + catch(Exception ex) + { + _player = null; + Trace.WriteLine(ex.Message); + } + } + if (_player != null) + { + _player.Play(); + + mixThread = new Thread(MixThread); + mixThread.Priority = ThreadPriority.AboveNormal; + mixThread.IsBackground = true; + mixThread.Name = "Mixer"; + mixThread.Start(); + } + } + + Thread playThread; + + int playingRow; + + private void PlayThread() + { + AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 0x2000); + IAudioSource playingSource = null; + CUESheet playingCue = null; + long playingOffs = 0; + long playingFin = 0; + + try + { + do + { + // End of playlist entry or source file + if (playingSource != null && (playingOffs == playingFin || playingSource.Remaining == 0)) + { + this.Invoke((MethodInvoker)delegate() + { + playlist.List.Items[playingRow].BackColor = Color.White; + }); + playingRow++; + playingOffs = 0; + if (playingRow >= dataSet.Playlist.Rows.Count) + break; + string path = dataSet.Playlist[playingRow].path; + int track = dataSet.Playlist[playingRow].track; + + if (playingCue == null || + playingSource == null || + playingCue.InputPath != path || + playingSource.Position != (long)playingCue.TOC[track].Start * 588) + { + if (playingSource != null) + { + playingSource.Close(); + playingSource = null; + } + if (playingCue != null) + { + playingCue.Close(); + playingCue = null; + } + } + else + { + playingFin = (long)playingCue.TOC[track].Length * 588; + this.Invoke((MethodInvoker)delegate() + { + playlist.List.Items[playingRow].BackColor = Color.AliceBlue; + //deckA.UpdateDeck(dataSet, playingRow, playingCue, playingFin); + }); + } + } + // Open it + if (playingSource == null) + { + string path = dataSet.Playlist[playingRow].path; + int track = dataSet.Playlist[playingRow].track; + + try + { + playingCue = new CUESheet(_config); + playingCue.Open(path); + playingSource = new CUESheetAudio(playingCue); + playingSource.Position = (long)playingCue.TOC[track].Start * 588 + playingOffs; + playingSource = new AudioPipe(playingSource, 0x2000); + playingFin = (long)playingCue.TOC[track].Length * 588; + this.Invoke((MethodInvoker)delegate() + { + playlist.List.Items[playingRow].BackColor = Color.AliceBlue; + //deckA.UpdateDeck(dataSet, playingRow, playingCue, playingFin); + }); + } + catch (Exception ex) + { + // skip it + playingOffs = playingFin = 0; + continue; + } + } + playingSource.Read(buff, (int)(playingFin - playingOffs)); + + this.Invoke((MethodInvoker)delegate() + { + deckA.PlayingOffset = (int)playingOffs; + }); + + _player.Write(buff); + playingOffs += buff.Length; + } while (_player.PlaybackState != PlaybackState.Stopped); + } + catch (Exception ex) + { + // Can't invoke while joining + + //if (playingRow < dataSet.Playlist.Rows.Count) + // this.Invoke((MethodInvoker)delegate() + // { + // listViewTracks.Items[playingRow].BackColor = Color.White; + // }); + } + + if (playingCue != null) + { + playingCue.Close(); + playingCue = null; + } + if (playingSource != null) + { + playingSource.Close(); + playingSource = null; + } + } + + internal void buttonPlay_Click(object sender, EventArgs e) + { + try + { + _player.Stop(); + if (playThread != null) + { + playThread.Join(); + playThread = null; + } + + if (playlist.List.SelectedIndices.Count < 0) + return; + + playingRow = playlist.List.SelectedIndices[0]; + playlist.List.Items[playingRow].BackColor = Color.AliceBlue; + + _player.Play(); + + playThread = new Thread(new ThreadStart(PlayThread)); + playThread.Priority = ThreadPriority.AboveNormal; + playThread.IsBackground = true; + playThread.Start(); + } + catch (Exception ex) + { + Trace.WriteLine(ex.Message); + } + } + + internal void buttonStop_Click(object sender, EventArgs e) + { + try + { + _player.Stop(); + if (playThread != null) + { + playThread.Join(); + playThread = null; + } + } + catch (Exception ex) + { + Trace.WriteLine(ex.Message); + } + } + + internal void buttonPause_Click(object sender, EventArgs e) + { + _player.Pause(); + } + + private void frmCUEPlayer_FormClosing(object sender, FormClosingEventArgs e) + { + try + { + int rowsAffected = adapterPlayList.Update(dataSet.Playlist); + } + catch (Exception ex) + { + System.Diagnostics.Trace.WriteLine(ex.Message); + } + } + + private void MixThread() + { + AudioBuffer result = new AudioBuffer( + new AudioPCMConfig(_player.PCM.BitsPerSample, _player.PCM.ChannelCount, _mixer.PCM.SampleRate), _mixer.BufferSize); + AudioBuffer resampled = _resampler == null ? null : new AudioBuffer(_player.PCM, _mixer.BufferSize * 2 * _mixer.PCM.SampleRate / _player.PCM.SampleRate); + while (true) + { + //Trace.WriteLine(string.Format("Read")); + _mixer.Read(result, -1); + if (_resampler == null) + _player.Write(result); + else + { + //Trace.WriteLine(string.Format("Flow: {0}", result.Length)); + _resampler.Flow(result, resampled); + //Trace.WriteLine(string.Format("Play: {0}", resampled.Length)); + if (resampled.Length != 0) + _player.Write(resampled); + } + } + } + } +} diff --git a/CUEPlayer/frmCUEPlayer.resx b/CUEPlayer/frmCUEPlayer.resx new file mode 100644 index 0000000..e5c789f --- /dev/null +++ b/CUEPlayer/frmCUEPlayer.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 + + + 39 + + \ No newline at end of file diff --git a/CUERipper/Properties/Resources.ru-RU.resx b/CUERipper/Properties/Resources.ru-RU.resx new file mode 100644 index 0000000..c3a8a0e --- /dev/null +++ b/CUERipper/Properties/Resources.ru-RU.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Определение приводов + + + Извлечение завершено + + + Судя по всему, были ошибки + + + Можете попытаться исправить ошибки с помощью CUETools + + + Ошибка + + + Не удалось загрузить библиотеку + + + Поиск альбома в базе + + + Приводы не найдены + + + Пауза + + + повтор + + \ No newline at end of file diff --git a/CUERipper/frmCUERipper.ru-RU.resx b/CUERipper/frmCUERipper.ru-RU.resx new file mode 100644 index 0000000..7ae3baa --- /dev/null +++ b/CUERipper/frmCUERipper.ru-RU.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + Редактирование названий треков начинается двойным кликом мыши + + + Название + + + Начало + + + Длина + + + Поехали + + + Стоп + + + Пауза + + + 61, 13 + + + Смещение + + + 120, 17 + + + Отчет в стиле EAC + + + Для выбора шаблона выходной папки кликните мышкой + + \ No newline at end of file diff --git a/CUETools.Codecs.CoreAudio/WasapiOut.cs b/CUETools.Codecs.CoreAudio/WasapiOut.cs index 6ec1b51..cbc4d20 100644 --- a/CUETools.Codecs.CoreAudio/WasapiOut.cs +++ b/CUETools.Codecs.CoreAudio/WasapiOut.cs @@ -17,7 +17,8 @@ namespace CUETools.Codecs.CoreAudio AudioClient audioClient; AudioClientShareMode shareMode; AudioRenderClient renderClient; - int latencyMilliseconds; + bool audioClient_started = false; + int latencyMilliseconds; int bufferFrameCount; bool isUsingEventSync; EventWaitHandle frameEventWaitHandle; @@ -26,7 +27,8 @@ namespace CUETools.Codecs.CoreAudio Thread playThread; private long _sampleOffset; private AudioPCMConfig pcm; - private NAudio.Wave.WaveFormat outputFormat; + private NAudio.Wave.WaveFormatExtensible outputFormat; + WaitHandle[] waitHandles; /// /// Playback Stopped @@ -70,7 +72,7 @@ namespace CUETools.Codecs.CoreAudio this.isUsingEventSync = useEventSync; this.latencyMilliseconds = latency; this.pcm = pcm; - this.outputFormat = new NAudio.Wave.WaveFormat(pcm.SampleRate, pcm.BitsPerSample, pcm.ChannelCount); + this.outputFormat = new NAudio.Wave.WaveFormatExtensible(pcm.SampleRate, pcm.BitsPerSample, pcm.ChannelCount); NAudio.Wave.WaveFormatExtensible closestSampleRateFormat; if (!audioClient.IsFormatSupported(shareMode, outputFormat, out closestSampleRateFormat)) throw new NotSupportedException("PCM format mismatch"); @@ -142,7 +144,6 @@ namespace CUETools.Codecs.CoreAudio ReleaseBuffer(buff, false, 0); // Create WaitHandle for sync - WaitHandle[] waitHandles = new WaitHandle[] { frameEventWaitHandle }; if (frameEventWaitHandle != null) frameEventWaitHandle.Reset(); audioClient.Start(); @@ -263,11 +264,14 @@ namespace CUETools.Codecs.CoreAudio return; case PlaybackState.Stopped: playbackState = PlaybackState.Playing; - playThread = new Thread(new ThreadStart(PlayThread)); - playThread.Priority = ThreadPriority.Highest; - playThread.IsBackground = true; - playThread.Name = "Pro Audio"; - playThread.Start(); + if (shareMode == AudioClientShareMode.Exclusive) + { + playThread = new Thread(new ThreadStart(PlayThread)); + playThread.Priority = ThreadPriority.Highest; + playThread.IsBackground = true; + playThread.Name = "Pro Audio"; + playThread.Start(); + } return; } } @@ -282,8 +286,16 @@ namespace CUETools.Codecs.CoreAudio playbackState = PlaybackState.Stopped; if (frameEventWaitHandle != null) frameEventWaitHandle.Set(); - playThread.Join(); - playThread = null; + if (audioClient_started) + { + audioClient.Stop(); + audioClient_started = false; + } + if (playThread != null) + { + playThread.Join(); + playThread = null; + } ReleaseBuffer(readBuffers[0], false, 0); ReleaseBuffer(readBuffers[1], false, 0); active = null; @@ -325,11 +337,12 @@ namespace CUETools.Codecs.CoreAudio if (shareMode == AudioClientShareMode.Shared) { // With EventCallBack and Shared, both latencies must be set to 0 - audioClient.Initialize(shareMode, AudioClientStreamFlags.EventCallback, 0, 0, + audioClient.Initialize(shareMode, AudioClientStreamFlags.EventCallback, latencyRefTimes, 0, outputFormat, Guid.Empty); // Get back the effective latency from AudioClient - latencyMilliseconds = (int)(audioClient.StreamLatency / 10000); + // This is all wrong! it should be treated differently + // latencyMilliseconds = (int)(audioClient.StreamLatency / 10000); } else { @@ -349,6 +362,8 @@ namespace CUETools.Codecs.CoreAudio outputFormat, Guid.Empty); } + waitHandles = new WaitHandle[] { frameEventWaitHandle }; + // Get the RenderClient renderClient = audioClient.AudioRenderClient; inited = true; @@ -402,25 +417,59 @@ namespace CUETools.Codecs.CoreAudio Stop(); return; } - int src_offs = 0; - do + if (src.PCM.BitsPerSample != pcm.BitsPerSample || src.PCM.ChannelCount != pcm.ChannelCount) + throw new NotSupportedException(); + if (playThread != null) { - if (active == null) - active = GetBuffer(true); - if (active == null) - throw new Exception("done"); - int toCopy = Math.Min(active.Size - active_offset, src.Length - src_offs); - Array.Copy(src.Bytes, src_offs * pcm.BlockAlign, active.Bytes, active_offset * pcm.BlockAlign, toCopy * pcm.BlockAlign); - src_offs += toCopy; - active_offset += toCopy; - if (active_offset == active.Size) + int src_offs = 0; + do { - ReleaseBuffer(active, true, active.Size); - active = null; - active_offset = 0; + if (active == null) + active = GetBuffer(true); + if (active == null) + throw new Exception("done"); + int toCopy = Math.Min(active.Size - active_offset, src.Length - src_offs); + Buffer.BlockCopy(src.Bytes, src_offs * pcm.BlockAlign, active.Bytes, active_offset * pcm.BlockAlign, toCopy * pcm.BlockAlign); + src_offs += toCopy; + active_offset += toCopy; + if (active_offset == active.Size) + { + ReleaseBuffer(active, true, active.Size); + active = null; + active_offset = 0; + } } + while (src_offs < src.Length); + } + else + { + int src_offs = 0; + byte[] b = src.Bytes; + if (!audioClient_started) + { + audioClient.Reset(); + if (frameEventWaitHandle != null) + frameEventWaitHandle.Set(); + audioClient.Start(); + audioClient_started = true; + } + do + { + // If using Event Sync, Wait for notification from AudioClient or Sleep half latency + int indexHandle = WaitHandle.WaitAny(waitHandles, latencyMilliseconds / 2, false); + + // See how much buffer space is available. + int numFramesAvailable = Math.Min(bufferFrameCount - audioClient.CurrentPadding, src.Length - src_offs); + if (numFramesAvailable > 0) + { + //Trace.WriteLine(string.Format("Write {0}", numFramesAvailable)); + IntPtr buffer = renderClient.GetBuffer(numFramesAvailable); + Marshal.Copy(b, src_offs * pcm.BlockAlign, buffer, numFramesAvailable * pcm.BlockAlign); + renderClient.ReleaseBuffer(numFramesAvailable, AudioClientBufferFlags.None); + src_offs += numFramesAvailable; + } + } while (src_offs < src.Length); } - while (src_offs < src.Length); } #endregion diff --git a/CUETools.Codecs/Codecs.cs b/CUETools.Codecs/Codecs.cs index 5bdda5c..b7d4b5e 100644 --- a/CUETools.Codecs/Codecs.cs +++ b/CUETools.Codecs/Codecs.cs @@ -531,6 +531,8 @@ namespace CUETools.Codecs FloatToBytes_16(inSamples, inSampleOffset, outSamples, outByteOffset, sampleCount, channelCount); //else if (bitsPerSample > 16 && bitsPerSample <= 24) // FLACSamplesToBytes_24(inSamples, inSampleOffset, outSamples, outByteOffset, sampleCount, channelCount, 24 - bitsPerSample); + else if (bitsPerSample == 32) + Buffer.BlockCopy(inSamples, inSampleOffset * 4 * channelCount, outSamples, outByteOffset, sampleCount * 4 * channelCount); else throw new Exception("Unsupported bitsPerSample value"); } @@ -2016,6 +2018,7 @@ namespace CUETools.Codecs _workThread = new Thread(Decompress); _workThread.Priority = priority; _workThread.IsBackground = true; + _workThread.Name = "AudioPipe"; _workThread.Start(null); } diff --git a/CUETools.DSP.Mixer/Mixer.cs b/CUETools.DSP.Mixer/Mixer.cs index cee61a7..77acce1 100644 --- a/CUETools.DSP.Mixer/Mixer.cs +++ b/CUETools.DSP.Mixer/Mixer.cs @@ -10,8 +10,7 @@ namespace CUETools.DSP.Mixer public class MixingSource : IAudioSource { AudioPCMConfig pcm; - MixingBuffer buf0; - MixingBuffer buf1; + MixingBuffer[] buf; bool[] playing; float[] volume; long samplePos; @@ -21,8 +20,9 @@ namespace CUETools.DSP.Mixer { this.pcm = pcm; this.size = delay * pcm.SampleRate / 1000; - this.buf0 = new MixingBuffer(pcm, size, sources); - this.buf1 = new MixingBuffer(pcm, size, sources); + this.buf = new MixingBuffer[2]; + this.buf[0] = new MixingBuffer(pcm, size, sources); + this.buf[1] = new MixingBuffer(pcm, size, sources); this.playing = new bool[sources]; this.volume = new float[sources]; this.samplePos = 0; @@ -83,10 +83,10 @@ namespace CUETools.DSP.Mixer float sumVolume = 0.0f; for (int iSource = 0; iSource < mixbuff.source.Length; iSource++) - if (playing[iSource]) + if (mixbuff.filled[iSource]) sumVolume += mixbuff.volume[iSource]; for (int iSource = 0; iSource < mixbuff.source.Length; iSource++) - volume[iSource] = playing[iSource] ? mixbuff.volume[iSource] / Math.Max(1.0f, sumVolume) : 0.0f; + volume[iSource] = mixbuff.filled[iSource] ? mixbuff.volume[iSource] / Math.Max(1.0f, sumVolume) : 0.0f; for (int iSmp = 0; iSmp < result.Length; iSmp++) { for (int iChan = 0; iChan < result.PCM.ChannelCount; iChan++) @@ -114,7 +114,7 @@ namespace CUETools.DSP.Mixer { get { - return buf0.source[0].Size; + return buf[0].source[0].Size; } } @@ -126,6 +126,8 @@ namespace CUETools.DSP.Mixer return res; } + int current = 0; + internal MixingBuffer LockFilledBuffer() { lock (this) @@ -133,9 +135,11 @@ namespace CUETools.DSP.Mixer //Trace.WriteLine(string.Format("LockFilledBuffer: 0.0: {0} {1}; 0.1: {2} {3}; 1.0: {4} {5}; 1.1: {6} {7};", // buf0.playing[0], buf0.filled[0], buf0.playing[1], buf0.filled[1], // buf0.playing[0], buf0.filled[0], buf0.playing[1], buf0.filled[1])); - while (!IsFilled(buf0) && !IsFilled(buf1)) + int no = current; + while (!IsFilled(buf[no])) Monitor.Wait(this); - return IsFilled(buf0) ? buf0 : buf1; + current = 1 - no; + return buf[no]; } } @@ -179,10 +183,10 @@ namespace CUETools.DSP.Mixer // buf0.playing[0], buf0.filled[0], buf0.playing[1], buf0.filled[1], // buf0.playing[0], buf0.filled[0], buf0.playing[1], buf0.filled[1], iSource)); - while (!playing[iSource] || (buf0.filled[iSource] && buf1.filled[iSource])) + while (!playing[iSource] || buf[current].filled[iSource]) Monitor.Wait(this); - return !buf0.filled[iSource] ? buf0 : buf1; + return buf[current]; } } @@ -301,6 +305,17 @@ namespace CUETools.DSP.Mixer mixer.LockEmptyBuffer(iSource); } + public void Flush() + { + if (mixbuff != null) + { + if (mixbuff.source[iSource].Length < mixbuff.source[iSource].Size) + AudioSamples.MemSet(mixbuff.source[iSource].Bytes, 0, mixbuff.source[iSource].Length * PCM.BlockAlign, (mixbuff.source[iSource].Size - mixbuff.source[iSource].Length) * PCM.BlockAlign); + mixer.UnlockEmptyBuffer(mixbuff, iSource, volume); + mixbuff = null; + } + } + public void Write(AudioBuffer buff) { int bs = PCM.BlockAlign; diff --git a/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj b/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj index 7269a26..067deec 100644 --- a/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj +++ b/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj @@ -25,10 +25,11 @@ DEBUG;TRACE - false + true false ..\bin\Release\ DEBUG;TRACE + full @@ -43,6 +44,7 @@ + @@ -67,6 +69,10 @@ {6458A13A-30EF-45A9-9D58-E5031B17BEE2} CUETools.Codecs + + {A6303861-CA06-4C2C-A104-BA9291538F6F} + CUETools.DSP.Resampler + \ No newline at end of file diff --git a/CUETools/CUETools.TestCodecs/SOXResamplerTest.cs b/CUETools/CUETools.TestCodecs/SOXResamplerTest.cs new file mode 100644 index 0000000..27ec106 --- /dev/null +++ b/CUETools/CUETools.TestCodecs/SOXResamplerTest.cs @@ -0,0 +1,100 @@ +using CUETools.DSP.Resampler; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using CUETools.Codecs; +using System; + +namespace CUETools.TestCodecs +{ + + + /// + ///This is a test class for SOXResamplerTest and is intended + ///to contain all SOXResamplerTest Unit Tests + /// + [TestClass()] + public class SOXResamplerTest + { + + + private TestContext testContextInstance; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + public TestContext TestContext + { + get + { + return testContextInstance; + } + set + { + testContextInstance = value; + } + } + + #region Additional test attributes + // + //You can use the following additional attributes as you write your tests: + // + //Use ClassInitialize to run code before running the first test in the class + //[ClassInitialize()] + //public static void MyClassInitialize(TestContext testContext) + //{ + //} + // + //Use ClassCleanup to run code after all tests in a class have run + //[ClassCleanup()] + //public static void MyClassCleanup() + //{ + //} + // + //Use TestInitialize to run code before running each test + //[TestInitialize()] + //public void MyTestInitialize() + //{ + //} + // + //Use TestCleanup to run code after each test has run + //[TestCleanup()] + //public void MyTestCleanup() + //{ + //} + // + #endregion + + + /// + ///A test for SOXResampler Constructor + /// + [TestMethod()] + public void SOXResamplerConstructorTest() + { + AudioPCMConfig inputPCM = new AudioPCMConfig(32, 1, 44100); + AudioPCMConfig outputPCM = new AudioPCMConfig(32, 1, 48000); + SOXResamplerConfig cfg; + cfg.quality = SOXResamplerQuality.Very; + cfg.phase = 50; + cfg.allow_aliasing = false; + cfg.bandwidth = 0; + SOXResampler resampler = new SOXResampler(inputPCM, outputPCM, cfg); + AudioBuffer src = new AudioBuffer(inputPCM, 400 * inputPCM.SampleRate / 1000); + AudioBuffer dst = new AudioBuffer(outputPCM, src.Size * 3); + int offs = 0; + double delta = 0; + for (int i = 0; i < 100; i++) + { + src.Prepare(-1); + for (int j = 0; j < src.Size; j++) + src.Float[j, 0] = (float)Math.Sin((i * src.Size + j) * Math.PI / 44100); + src.Length = src.Size; + resampler.Flow(src, dst); + for (int j = 0; j < dst.Length; j++) + delta += dst.Float[j, 0] - Math.Sin((offs + j) * Math.PI / 48000); + offs += dst.Length; + } + Assert.IsTrue(Math.Abs(delta) < 0.00001, "Error too large"); + } + } +} diff --git a/CUETools/CUETools.sln b/CUETools/CUETools.sln index aaa5170..5b2e288 100644 --- a/CUETools/CUETools.sln +++ b/CUETools/CUETools.sln @@ -159,6 +159,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUEPlayer", "..\CUEPlayer\C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.Codecs.CoreAudio", "..\CUETools.Codecs.CoreAudio\CUETools.Codecs.CoreAudio.csproj", "{FAD09EE2-D6B2-4A8E-9F1C-2A9FB293661A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.Codecs.LAME", "..\CUETools.Codecs.LAME\CUETools.Codecs.LAME.csproj", "{1AF02E2C-2CB2-44B5-B417-37653071FEC6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.Codecs.DirectSound", "..\CUETools.Codecs.DirectSound\CUETools.Codecs.DirectSound.csproj", "{5A9FB016-6388-475D-AB33-6F86AD49FDAD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.DSP.Mixer", "..\CUETools.DSP.Mixer\CUETools.DSP.Mixer.csproj", "{AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUETools.DSP.Resampler", "..\CUETools.DSP.Resampler\CUETools.DSP.Resampler.csproj", "{A6303861-CA06-4C2C-A104-BA9291538F6F}" +EndProject Global GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = CUETools1.vsmdi @@ -590,6 +598,38 @@ Global {FAD09EE2-D6B2-4A8E-9F1C-2A9FB293661A}.Release|Any CPU.Build.0 = Release|Any CPU {FAD09EE2-D6B2-4A8E-9F1C-2A9FB293661A}.Release|Win32.ActiveCfg = Release|Any CPU {FAD09EE2-D6B2-4A8E-9F1C-2A9FB293661A}.Release|x64.ActiveCfg = Release|Any CPU + {1AF02E2C-2CB2-44B5-B417-37653071FEC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1AF02E2C-2CB2-44B5-B417-37653071FEC6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1AF02E2C-2CB2-44B5-B417-37653071FEC6}.Debug|Win32.ActiveCfg = Debug|Any CPU + {1AF02E2C-2CB2-44B5-B417-37653071FEC6}.Debug|x64.ActiveCfg = Debug|Any CPU + {1AF02E2C-2CB2-44B5-B417-37653071FEC6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1AF02E2C-2CB2-44B5-B417-37653071FEC6}.Release|Any CPU.Build.0 = Release|Any CPU + {1AF02E2C-2CB2-44B5-B417-37653071FEC6}.Release|Win32.ActiveCfg = Release|Any CPU + {1AF02E2C-2CB2-44B5-B417-37653071FEC6}.Release|x64.ActiveCfg = Release|Any CPU + {5A9FB016-6388-475D-AB33-6F86AD49FDAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A9FB016-6388-475D-AB33-6F86AD49FDAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A9FB016-6388-475D-AB33-6F86AD49FDAD}.Debug|Win32.ActiveCfg = Debug|Any CPU + {5A9FB016-6388-475D-AB33-6F86AD49FDAD}.Debug|x64.ActiveCfg = Debug|Any CPU + {5A9FB016-6388-475D-AB33-6F86AD49FDAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A9FB016-6388-475D-AB33-6F86AD49FDAD}.Release|Any CPU.Build.0 = Release|Any CPU + {5A9FB016-6388-475D-AB33-6F86AD49FDAD}.Release|Win32.ActiveCfg = Release|Any CPU + {5A9FB016-6388-475D-AB33-6F86AD49FDAD}.Release|x64.ActiveCfg = Release|Any CPU + {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2}.Debug|Win32.ActiveCfg = Debug|Any CPU + {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2}.Debug|x64.ActiveCfg = Debug|Any CPU + {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2}.Release|Any CPU.Build.0 = Release|Any CPU + {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2}.Release|Win32.ActiveCfg = Release|Any CPU + {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2}.Release|x64.ActiveCfg = Release|Any CPU + {A6303861-CA06-4C2C-A104-BA9291538F6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6303861-CA06-4C2C-A104-BA9291538F6F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6303861-CA06-4C2C-A104-BA9291538F6F}.Debug|Win32.ActiveCfg = Debug|Any CPU + {A6303861-CA06-4C2C-A104-BA9291538F6F}.Debug|x64.ActiveCfg = Debug|Any CPU + {A6303861-CA06-4C2C-A104-BA9291538F6F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6303861-CA06-4C2C-A104-BA9291538F6F}.Release|Any CPU.Build.0 = Release|Any CPU + {A6303861-CA06-4C2C-A104-BA9291538F6F}.Release|Win32.ActiveCfg = Release|Any CPU + {A6303861-CA06-4C2C-A104-BA9291538F6F}.Release|x64.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -624,6 +664,7 @@ Global {082D6B9E-326E-4D15-9798-EDAE9EDE70A6} = {93B7AE1D-DEF6-4A04-A222-5CDE09DF262D} {DFE50673-906C-4B8F-993B-A24CAD1CA17D} = {93B7AE1D-DEF6-4A04-A222-5CDE09DF262D} {DDE1EA77-637C-4D5F-96F3-1328BC45CE80} = {93B7AE1D-DEF6-4A04-A222-5CDE09DF262D} + {1AF02E2C-2CB2-44B5-B417-37653071FEC6} = {93B7AE1D-DEF6-4A04-A222-5CDE09DF262D} {04945FB2-8410-4F14-8262-2ED18DCDACD6} = {D9D97BB6-002F-4858-8EF2-49B4C4C4DDB4} {A430AD28-B76A-4ED0-AF7D-D13B8969297F} = {D9D97BB6-002F-4858-8EF2-49B4C4C4DDB4} {5C8B61C0-BC3D-4316-B8A7-419D55BB5796} = {D9D97BB6-002F-4858-8EF2-49B4C4C4DDB4} diff --git a/CUETools/CUETools1.vsmdi b/CUETools/CUETools1.vsmdi index 72f5653..bfa89ec 100644 --- a/CUETools/CUETools1.vsmdi +++ b/CUETools/CUETools1.vsmdi @@ -3,7 +3,7 @@ - +