diff --git a/.gitignore b/.gitignore index f1a6cfd..bcaef3a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,11 +3,12 @@ obj/ bin/ lib/ Release/ +Debug/ *.vcxproj.user *.csproj.user *.sdf *.suo *.opensdf -Win32/ -x64/ -ia32/ +a32/ +launchSettings.json +/CUETools/TestResults diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 7c4aafa..0000000 --- a/.hgignore +++ /dev/null @@ -1,22 +0,0 @@ -syntax: glob -CUETools.AVX/Release -CUETools.CLParity -*.vcxproj.user -CUETools.Codecs.DirectSound -obj -_UpgradeReport_Files -MAC_SDK/Source/MACLib/Release -MAC_SDK/Source/MACLib/x64 -ttalib-1.1/x64 -*.sdf -*.suo -*.opensdf -CUETools.AVX/Win32 -CUETools.AVX/x64 -CUETools/TestResults/ -*.csproj.user -bin/ -flac/src/libFLAC/ia32/*.obj -CUETools/ipch/ -flac/src/libFLAC/x64/ -flac/src/libFLAC/Release/ diff --git a/Bwg.Hardware/Bwg.Hardware.csproj b/Bwg.Hardware/Bwg.Hardware.csproj index 9b0031e..211dd43 100644 --- a/Bwg.Hardware/Bwg.Hardware.csproj +++ b/Bwg.Hardware/Bwg.Hardware.csproj @@ -1,117 +1,19 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {B75FA7AD-968E-4990-B342-1B4B17C850DF} - Library - Properties - Bwg.Hardware + net40;net20 + 0.0.7.1 Bwg.Hardware - - - - - - - - - - - 3.5 - - - v2.0 - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true + Bwg.Hardware + BwgBurn + CD-R/CD-RW/DVD-R/DVD-RW burning program for Windows XP: devices. + Copyright © 2006 by Jack W. Griffin, Jr. + Jack W. Griffin, Jr + true + ..\bin\$(Configuration)\plugins + https://svn.code.sf.net/p/bwgburn/code/ + svn + BwgSoftware - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Bwg.Hardware.XML - true - AllRules.ruleset - - - pdbonly - true - ..\bin\Release\plugins\ - TRACE - prompt - 4 - AllRules.ruleset - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - false - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - \ No newline at end of file + + diff --git a/Bwg.Hardware/Properties/AssemblyInfo.cs b/Bwg.Hardware/Properties/AssemblyInfo.cs deleted file mode 100644 index 4e44a4a..0000000 --- a/Bwg.Hardware/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -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("Bwg.Hardware")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("BwgSoftware")] -[assembly: AssemblyProduct("BwgBurn")] -[assembly: AssemblyCopyright("Copyright © 2006 by Jack W. Griffin, Jr.")] -[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("de5dc145-3520-47ee-8988-205a142c6177")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("0.0.7.1")] -[assembly: AssemblyFileVersion("0.0.7.1")] diff --git a/Bwg.Hardware/app.config b/Bwg.Hardware/app.config deleted file mode 100644 index 73859b0..0000000 --- a/Bwg.Hardware/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/Bwg.Logging/Bwg.Logging.csproj b/Bwg.Logging/Bwg.Logging.csproj index c9c96b7..1798d49 100644 --- a/Bwg.Logging/Bwg.Logging.csproj +++ b/Bwg.Logging/Bwg.Logging.csproj @@ -1,125 +1,19 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {F2DFEB00-BB35-4665-85EA-CB8C7729A6B7} - Library - Properties - Bwg.Logging + net40;net20 + 0.0.7.1 Bwg.Logging - - - - - - - - - - - 3.5 - - - v2.0 - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true + Bwg.Logging + BwgBurn + CD-R/CD-RW/DVD-R/DVD-RW burning program for Windows XP: logging. + Copyright © 2006 by Jack W. Griffin, Jr. + Jack W. Griffin, Jr + true + ..\bin\$(Configuration)\plugins + https://svn.code.sf.net/p/bwgburn/code/ + svn + BwgSoftware - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Bwg.Logging.XML - true - AllRules.ruleset - - - pdbonly - true - ..\bin\Release\plugins\ - TRACE - prompt - 4 - - - AllRules.ruleset - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - false - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - \ No newline at end of file + + diff --git a/Bwg.Logging/Properties/AssemblyInfo.cs b/Bwg.Logging/Properties/AssemblyInfo.cs deleted file mode 100644 index c21ddab..0000000 --- a/Bwg.Logging/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -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("Bwg.Logging")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("BwgSoftware")] -[assembly: AssemblyProduct("BwgBurn")] -[assembly: AssemblyCopyright("Copyright © 2006 by Jack W. Griffin, Jr.")] -[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("216f12e9-2978-457c-95d6-32b4b87a361d")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("0.0.7.1")] -[assembly: AssemblyFileVersion("0.0.7.1")] diff --git a/Bwg.Logging/app.config b/Bwg.Logging/app.config deleted file mode 100644 index 73859b0..0000000 --- a/Bwg.Logging/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/Bwg.Scsi/Bwg.Scsi.csproj b/Bwg.Scsi/Bwg.Scsi.csproj index f625170..05cd3e7 100644 --- a/Bwg.Scsi/Bwg.Scsi.csproj +++ b/Bwg.Scsi/Bwg.Scsi.csproj @@ -1,162 +1,29 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {A05B6AA6-0EC3-495D-BCC4-ECE1210071A8} - Library - Properties - Bwg.Scsi + net40;net20 + 0.0.7.1 Bwg.Scsi - - - - - - - - - - - 3.5 - - - v2.0 - 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 + Bwg.Scsi + BwgBurn + CD-R/CD-RW/DVD-R/DVD-RW burning program for Windows XP: Windows SCSI interface. + Copyright © 2006 by Jack W. Griffin, Jr. + Jack W. Griffin, Jr true - bin\Debug\Bwg.Scsi.XML - true - AllRules.ruleset + ..\bin\$(Configuration)\plugins + https://svn.code.sf.net/p/bwgburn/code/ + svn + BwgSoftware - - pdbonly - true - ..\bin\Release\plugins\ - TRACE - prompt - 4 - true - - - AllRules.ruleset - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {F2DFEB00-BB35-4665-85EA-CB8C7729A6B7} - Bwg.Logging + + + + False - + + - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - false - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - + - - - - - - - - \ No newline at end of file + + diff --git a/Bwg.Scsi/FileReader.cs b/Bwg.Scsi/FileReader.cs deleted file mode 100644 index 9f5594c..0000000 --- a/Bwg.Scsi/FileReader.cs +++ /dev/null @@ -1,142 +0,0 @@ -// -// BwgBurn - CD-R/CD-RW/DVD-R/DVD-RW burning program for Windows XP -// -// Copyright (C) 2006 by Jack W. Griffin (butchg@comcast.net) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the -// -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, -// Boston, MA 02111-1307 USA -// - -using System; -using System.Collections.Generic; -using System.Text; -using System.Runtime.InteropServices; -//using Bwg.Utils; - -namespace Bwg.Scsi -{ - /// - /// This class reads data from a file and sends this data to the buffered - /// write stream. - /// - public unsafe class FileReader - { - #region private member variables - /// - /// The OS file for reading data from a file into a memory buffer (IntPtr) - /// - private OsFileReader m_reader; - - /// - /// The buffer pool to receive the data - /// - private WriteBufferPool m_buffer_stream; - #endregion - - - /// - /// Create a new file reader that sends the data read to a buffer stream - /// object - /// - /// the buffer to receive the data - public FileReader(WriteBufferPool buffer) - { - m_buffer_stream = buffer; - m_reader = new OsFileReader(); - } - - /// - /// Open a file to read data from - /// - /// the name of the file - /// true if the file is opened, false otherwise - public bool Open(string filename) - { - return m_reader.Open(filename); - } - - /// - /// This method closes an open file. - /// - /// true if the file is closed sucessfully, false otherwise - public bool Close() - { - return m_reader.Close(); - } - - /// - /// This function reads data from the file and sends it to the - /// buffer stream to be sent to the burner. This function does not - /// return until all of the data from the file is read. - /// - /// - public bool ReadData(int sector_size, long lba) - { - bool shortbuf = false; - int NumberRead ; - int num_sectors ; - bool first = true; - - // This is the number of whole sectors that will fit into the buffer. - num_sectors = m_buffer_stream.PageSize / sector_size; - - while (true) - { - WriteBuffer buf ; - - buf = m_buffer_stream.GetFreeBuffer(); - if (!m_reader.ReadData(buf.BufferPtr, num_sectors * sector_size, out NumberRead)) - return false ; - - // If the read succeeded, but read zero bytes, we have reached the - // end of the file. - if (NumberRead == 0) - return true; - - if (shortbuf) - throw new Exception("read two short packets"); - - // Mark the buffer with the amount of data that has - // been read from the file - int sectors = NumberRead / sector_size ; - if ((NumberRead % sector_size) != 0) - { - shortbuf = true; - sectors++; - } - - if (first) - { - buf.SourceString = "First block from FileReader"; - buf.LogicalBlockAddress = lba; - first = false; - } - else - { - buf.SourceString = "Not first block from FileReader"; - buf.LogicalBlockAddress = long.MaxValue; - } - - buf.SectorSize = sector_size; - buf.DataSize = sectors; - - // Send the buffer to the device - m_buffer_stream.SendBufferToDevice(buf); - } - } - } -} diff --git a/Bwg.Scsi/Properties/AssemblyInfo.cs b/Bwg.Scsi/Properties/AssemblyInfo.cs deleted file mode 100644 index 40e7750..0000000 --- a/Bwg.Scsi/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -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("Bwg.Scsi")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("BwgSoftware")] -[assembly: AssemblyProduct("BwgBurn")] -[assembly: AssemblyCopyright("Copyright © 2006 by Jack W. Griffin, Jr.")] -[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("d8330703-34ac-4124-a059-ba011391cc2e")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("0.0.7.1")] -[assembly: AssemblyFileVersion("0.0.7.1")] diff --git a/Bwg.Scsi/app.config b/Bwg.Scsi/app.config deleted file mode 100644 index 73859b0..0000000 --- a/Bwg.Scsi/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/CUEControls/CUEControls.csproj b/CUEControls/CUEControls.csproj index f9d2ead..ca00377 100644 --- a/CUEControls/CUEControls.csproj +++ b/CUEControls/CUEControls.csproj @@ -1,131 +1,23 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {CA4D64E6-6544-4A29-8BA5-7DB08D50D072} - Library - Properties - CUEControls + net40;net20 + 2.1.6.0 CUEControls - - - 3.5 - - - v2.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - false - ..\bin\Debug\ - DEBUG;TRACE - prompt - 4 + CUEControls + CUETools + Library containing windows GUI controls for CUETools. + Copyright (c) 2008-2018 Grigory Chudov + Grigory Chudov true - AllRules.ruleset - - - pdbonly - true - ..\bin\Release\ - TRACE - prompt - 4 - true - AllRules.ruleset + ..\bin\$(Configuration)\ + https://github.com/gchudov/cuetools.net + git + + - - - - - - - Component - - - FileSystemTreeView.cs - - - - Component - - - UserControl - - - MediaSlider.cs - - - Component - - - PeakMeterCtrl.cs - - - - True - True - Resources.resx - - - - - - - Designer - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - \ No newline at end of file + + diff --git a/CUEPlayer/CUEPlayer.csproj b/CUEPlayer/CUEPlayer.csproj index d8d08ad..5e44b40 100644 --- a/CUEPlayer/CUEPlayer.csproj +++ b/CUEPlayer/CUEPlayer.csproj @@ -10,7 +10,7 @@ Properties CUEPlayer CUEPlayer - v2.0 + v4.0 512 false @@ -31,12 +31,13 @@ 1.0.0.%2a false true + true full false - ..\bin\Debug\ + ..\bin\Debug\net40\ DEBUG;TRACE prompt 4 @@ -45,7 +46,7 @@ pdbonly true - ..\bin\Release\ + ..\bin\Release\net40\ TRACE prompt 4 @@ -71,12 +72,6 @@ DataSet1.xsd - Component - - - True - True - DataSet1.xsd Form @@ -162,10 +157,12 @@ {CA4D64E6-6544-4A29-8BA5-7DB08D50D072} CUEControls + False {1DD41038-D885-46C5-8DDE-E0B82F066584} CUETools.CDImage + False {FAD09EE2-D6B2-4A8E-9F1C-2A9FB293661A} @@ -178,6 +175,7 @@ {6458A13A-30EF-45A9-9D58-E5031B17BEE2} CUETools.Codecs + False {AFF1AFF9-839D-4892-88CD-8BD09BAFC1D2} @@ -190,6 +188,7 @@ {4911BD82-49EF-4858-8B51-5394F86739A4} CUETools.Processor + False {8DD1E84B-0B03-4C0B-9B42-1E49F75E7CB1} @@ -234,7 +233,6 @@ Designer MSDataSetGenerator - DataSet1.Designer.cs DataSet1.xsd diff --git a/CUEPlayer/DataSet1.Designer.cs b/CUEPlayer/DataSet1.Designer.cs deleted file mode 100644 index 1608c3a..0000000 --- a/CUEPlayer/DataSet1.Designer.cs +++ /dev/null @@ -1,1643 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.239 -// -// 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.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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] - public new global::System.Data.DataRelationCollection Relations { - get { - return base.Relations; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - protected override void InitializeDerivedDataSet() { - this.BeginInit(); - this.InitClass(); - this.EndInit(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public override global::System.Data.DataSet Clone() { - DataSet1 cln = ((DataSet1)(base.Clone())); - cln.InitVars(); - cln.SchemaSerializationMode = this.SchemaSerializationMode; - return cln; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - protected override bool ShouldSerializeTables() { - return false; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - protected override bool ShouldSerializeRelations() { - return false; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - internal void InitVars() { - this.InitVars(true); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - private bool ShouldSerializePlaylist() { - return false; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) { - if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) { - this.InitVars(); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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; - } - - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public delegate void PlaylistRowChangeEventHandler(object sender, PlaylistRowChangeEvent e); - - /// - ///Represents the strongly named DataTable class. - /// - [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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public PlaylistDataTable() { - this.TableName = "Playlist"; - this.BeginInit(); - this.InitClass(); - this.EndInit(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - protected PlaylistDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : - base(info, context) { - this.InitVars(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public global::System.Data.DataColumn idColumn { - get { - return this.columnid; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public global::System.Data.DataColumn pathColumn { - get { - return this.columnpath; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public global::System.Data.DataColumn artistColumn { - get { - return this.columnartist; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public global::System.Data.DataColumn titleColumn { - get { - return this.columntitle; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public global::System.Data.DataColumn albumColumn { - get { - return this.columnalbum; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public global::System.Data.DataColumn lengthColumn { - get { - return this.columnlength; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public global::System.Data.DataColumn trackColumn { - get { - return this.columntrack; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [global::System.ComponentModel.Browsable(false)] - public int Count { - get { - return this.Rows.Count; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public PlaylistRow this[int index] { - get { - return ((PlaylistRow)(this.Rows[index])); - } - } - - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public event PlaylistRowChangeEventHandler PlaylistRowChanging; - - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public event PlaylistRowChangeEventHandler PlaylistRowChanged; - - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public event PlaylistRowChangeEventHandler PlaylistRowDeleting; - - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public event PlaylistRowChangeEventHandler PlaylistRowDeleted; - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public void AddPlaylistRow(PlaylistRow row) { - this.Rows.Add(row); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public PlaylistRow FindByid(int id) { - return ((PlaylistRow)(this.Rows.Find(new object[] { - id}))); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public virtual global::System.Collections.IEnumerator GetEnumerator() { - return this.Rows.GetEnumerator(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public override global::System.Data.DataTable Clone() { - PlaylistDataTable cln = ((PlaylistDataTable)(base.Clone())); - cln.InitVars(); - return cln; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - protected override global::System.Data.DataTable CreateInstance() { - return new PlaylistDataTable(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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 = 255; - this.columnartist.MaxLength = 255; - this.columntitle.MaxLength = 255; - this.columnalbum.MaxLength = 255; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public PlaylistRow NewPlaylistRow() { - return ((PlaylistRow)(this.NewRow())); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { - return new PlaylistRow(builder); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - protected override global::System.Type GetRowType() { - return typeof(PlaylistRow); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public void RemovePlaylistRow(PlaylistRow row) { - this.Rows.Remove(row); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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. - /// - public partial class PlaylistRow : global::System.Data.DataRow { - - private PlaylistDataTable tablePlaylist; - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - internal PlaylistRow(global::System.Data.DataRowBuilder rb) : - base(rb) { - this.tablePlaylist = ((PlaylistDataTable)(this.Table)); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public int id { - get { - return ((int)(this[this.tablePlaylist.idColumn])); - } - set { - this[this.tablePlaylist.idColumn] = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public string path { - get { - return ((string)(this[this.tablePlaylist.pathColumn])); - } - set { - this[this.tablePlaylist.pathColumn] = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public string artist { - get { - if (this.IsartistNull()) { - return string.Empty; - } - else { - return ((string)(this[this.tablePlaylist.artistColumn])); - } - } - set { - this[this.tablePlaylist.artistColumn] = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public string title { - get { - if (this.IstitleNull()) { - return string.Empty; - } - else { - return ((string)(this[this.tablePlaylist.titleColumn])); - } - } - set { - this[this.tablePlaylist.titleColumn] = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public string album { - get { - if (this.IsalbumNull()) { - return string.Empty; - } - else { - return ((string)(this[this.tablePlaylist.albumColumn])); - } - } - set { - this[this.tablePlaylist.albumColumn] = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public bool IsartistNull() { - return this.IsNull(this.tablePlaylist.artistColumn); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public void SetartistNull() { - this[this.tablePlaylist.artistColumn] = global::System.Convert.DBNull; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public bool IstitleNull() { - return this.IsNull(this.tablePlaylist.titleColumn); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public void SettitleNull() { - this[this.tablePlaylist.titleColumn] = global::System.Convert.DBNull; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public bool IsalbumNull() { - return this.IsNull(this.tablePlaylist.albumColumn); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public void SetalbumNull() { - this[this.tablePlaylist.albumColumn] = global::System.Convert.DBNull; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public bool IslengthNull() { - return this.IsNull(this.tablePlaylist.lengthColumn); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public void SetlengthNull() { - this[this.tablePlaylist.lengthColumn] = global::System.Convert.DBNull; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public bool IstrackNull() { - return this.IsNull(this.tablePlaylist.trackColumn); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public void SettrackNull() { - this[this.tablePlaylist.trackColumn] = global::System.Convert.DBNull; - } - } - - /// - ///Row event argument class - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public class PlaylistRowChangeEvent : global::System.EventArgs { - - private PlaylistRow eventRow; - - private global::System.Data.DataRowAction eventAction; - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public PlaylistRowChangeEvent(PlaylistRow row, global::System.Data.DataRowAction action) { - this.eventRow = row; - this.eventAction = action; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public PlaylistRow Row { - get { - return this.eventRow; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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.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=10.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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public PlaylistTableAdapter() { - this.ClearBeforeFill = true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - protected internal global::System.Data.SqlServerCe.SqlCeDataAdapter Adapter { - get { - if ((this._adapter == null)) { - this.InitAdapter(); - } - return this._adapter; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - protected global::System.Data.SqlServerCe.SqlCeCommand[] CommandCollection { - get { - if ((this._commandCollection == null)) { - this.InitCommandCollection(); - } - return this._commandCollection; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public bool ClearBeforeFill { - get { - return this._clearBeforeFill; - } - set { - this._clearBeforeFill = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - private void InitConnection() { - this._connection = new global::System.Data.SqlServerCe.SqlCeConnection(); - this._connection.ConnectionString = global::CUEPlayer.Properties.Settings.Default.CUEPlayerConnectionString; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.ComponentModel.DesignerCategoryAttribute("code")] - [global::System.ComponentModel.ToolboxItem(true)] - [global::System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerDesigner, Microsoft.VSD" + - "esigner, Version=10.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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public UpdateOrderOption UpdateOrder { - get { - return this._updateOrder; - } - set { - this._updateOrder = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" + - "ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + - "a", "System.Drawing.Design.UITypeEditor")] - public PlaylistTableAdapter PlaylistTableAdapter { - get { - return this._playlistTableAdapter; - } - set { - this._playlistTableAdapter = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - public bool BackupDataSetBeforeUpdate { - get { - return this._backupDataSetBeforeUpdate; - } - set { - this._backupDataSetBeforeUpdate = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - [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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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", "4.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", "4.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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - private global::System.Data.DataRow GetRoot(global::System.Data.DataRow row, out int distance) { - global::System.Diagnostics.Debug.Assert((row != null)); - global::System.Data.DataRow root = row; - distance = 0; - - global::System.Collections.Generic.IDictionary traversedRows = new global::System.Collections.Generic.Dictionary(); - traversedRows[row] = row; - - global::System.Data.DataRow parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); - for ( - ; ((parent != null) - && (traversedRows.ContainsKey(parent) == false)); - ) { - distance = (distance + 1); - root = parent; - traversedRows[parent] = parent; - parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Default); - } - - if ((distance == 0)) { - traversedRows.Clear(); - traversedRows[row] = row; - parent = row.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); - for ( - ; ((parent != null) - && (traversedRows.ContainsKey(parent) == false)); - ) { - distance = (distance + 1); - root = parent; - traversedRows[parent] = parent; - parent = parent.GetParentRow(this._relation, global::System.Data.DataRowVersion.Original); - } - } - - return root; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] - 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; - } - - int distance1 = 0; - global::System.Data.DataRow root1 = this.GetRoot(row1, out distance1); - - int distance2 = 0; - global::System.Data.DataRow root2 = this.GetRoot(row2, out distance2); - - if (object.ReferenceEquals(root1, root2)) { - return (this._childFirst * distance1.CompareTo(distance2)); - } - else { - global::System.Diagnostics.Debug.Assert(((root1.Table != null) - && (root2.Table != null))); - if ((root1.Table.Rows.IndexOf(root1) < root2.Table.Rows.IndexOf(root2))) { - return -1; - } - else { - return 1; - } - } - } - } - } -} - -#pragma warning restore 1591 \ No newline at end of file diff --git a/CUEPlayer/Output.cs b/CUEPlayer/Output.cs index 1143556..ac45b46 100644 --- a/CUEPlayer/Output.cs +++ b/CUEPlayer/Output.cs @@ -11,7 +11,7 @@ namespace CUEPlayer { public partial class Output : Form { - private IWavePlayer _player; + private CUETools.Codecs.CoreAudio.IWavePlayer _player; private AudioBuffer resampled; private SOXResampler _resampler; private MMDevice _device; diff --git a/CUEPlayer/Properties/Resources.Designer.cs b/CUEPlayer/Properties/Resources.Designer.cs index 129754a..5d5c3ef 100644 --- a/CUEPlayer/Properties/Resources.Designer.cs +++ b/CUEPlayer/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.239 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace CUEPlayer.Properties { // 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", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -60,6 +60,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap cog { get { object obj = ResourceManager.GetObject("cog", resourceCulture); @@ -67,6 +70,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_eject { get { object obj = ResourceManager.GetObject("control_eject", resourceCulture); @@ -74,6 +80,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_eject_blue { get { object obj = ResourceManager.GetObject("control_eject_blue", resourceCulture); @@ -81,6 +90,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_end_blue { get { object obj = ResourceManager.GetObject("control_end_blue", resourceCulture); @@ -88,6 +100,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_equalizer_blue { get { object obj = ResourceManager.GetObject("control_equalizer_blue", resourceCulture); @@ -95,6 +110,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_fastforward_blue { get { object obj = ResourceManager.GetObject("control_fastforward_blue", resourceCulture); @@ -102,6 +120,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_pause_blue { get { object obj = ResourceManager.GetObject("control_pause_blue", resourceCulture); @@ -109,6 +130,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_play_blue { get { object obj = ResourceManager.GetObject("control_play_blue", resourceCulture); @@ -116,6 +140,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_repeat_blue { get { object obj = ResourceManager.GetObject("control_repeat_blue", resourceCulture); @@ -123,6 +150,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_rewind_blue { get { object obj = ResourceManager.GetObject("control_rewind_blue", resourceCulture); @@ -130,6 +160,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_start_blue { get { object obj = ResourceManager.GetObject("control_start_blue", resourceCulture); @@ -137,6 +170,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap control_stop_blue { get { object obj = ResourceManager.GetObject("control_stop_blue", resourceCulture); @@ -144,6 +180,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap ctdb { get { object obj = ResourceManager.GetObject("ctdb", resourceCulture); @@ -151,6 +190,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap sound { get { object obj = ResourceManager.GetObject("sound", resourceCulture); @@ -158,6 +200,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap sound_mute { get { object obj = ResourceManager.GetObject("sound_mute", resourceCulture); @@ -165,6 +210,9 @@ namespace CUEPlayer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap transmit_blue { get { object obj = ResourceManager.GetObject("transmit_blue", resourceCulture); diff --git a/CUEPlayer/Properties/Settings.Designer.cs b/CUEPlayer/Properties/Settings.Designer.cs index 2cf71d7..ab84620 100644 --- a/CUEPlayer/Properties/Settings.Designer.cs +++ b/CUEPlayer/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.239 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace CUEPlayer.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/CUEPlayer/app.config b/CUEPlayer/app.config index d979376..ab7a041 100644 --- a/CUEPlayer/app.config +++ b/CUEPlayer/app.config @@ -1,15 +1,13 @@ - + - + - \ No newline at end of file + diff --git a/CUERipper.WPF/App.xaml b/CUERipper.WPF/App.xaml new file mode 100644 index 0000000..2d7edc7 --- /dev/null +++ b/CUERipper.WPF/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/CUERipper.WPF/App.xaml.cs b/CUERipper.WPF/App.xaml.cs new file mode 100644 index 0000000..81d9cd8 --- /dev/null +++ b/CUERipper.WPF/App.xaml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Windows; + +namespace CUERipper.WPF +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/CUERipper.WPF/CUERipper.WPF.csproj b/CUERipper.WPF/CUERipper.WPF.csproj new file mode 100644 index 0000000..08e3fcf --- /dev/null +++ b/CUERipper.WPF/CUERipper.WPF.csproj @@ -0,0 +1,158 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {2D8D7A03-DFFA-44EF-9299-8BB56D122245} + WinExe + Properties + CUERipper.WPF + CUERipper.WPF + v4.0 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + + + + 3.5 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + ..\bin\Debug\net40\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\Release\net40\ + TRACE + prompt + 4 + + + + 3.0 + + + 3.0 + + + + 3.5 + + + + + 3.5 + + + 3.5 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + Window1.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + {CA4D64E6-6544-4A29-8BA5-7DB08D50D072} + CUEControls + + + {1DD41038-D885-46C5-8DDE-E0B82F066584} + CUETools.CDImage + + + {4911BD82-49EF-4858-8B51-5394F86739A4} + CUETools.Processor + + + + + + + + + + + False + .NET Framework 3.5 SP1 + true + + + + + \ No newline at end of file diff --git a/CUETools.Codecs.CoreAudio/Properties/AssemblyInfo.cs b/CUERipper.WPF/Properties/AssemblyInfo.cs similarity index 53% rename from CUETools.Codecs.CoreAudio/Properties/AssemblyInfo.cs rename to CUERipper.WPF/Properties/AssemblyInfo.cs index d60860f..d4322cb 100644 --- a/CUETools.Codecs.CoreAudio/Properties/AssemblyInfo.cs +++ b/CUERipper.WPF/Properties/AssemblyInfo.cs @@ -1,36 +1,55 @@ -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("CUETools.Codecs.CoreAudio")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("CUETools.Codecs.CoreAudio")] -[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("f597837f-dd1c-4e0f-b915-0e929bf0dd35")] - -// 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")] +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 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("CUERipper.WPF")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("CUERipper.WPF")] +[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)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// 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/CUERipper.WPF/Properties/Resources.Designer.cs b/CUERipper.WPF/Properties/Resources.Designer.cs new file mode 100644 index 0000000..4fd0e16 --- /dev/null +++ b/CUERipper.WPF/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CUERipper.WPF.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", "15.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("CUERipper.WPF.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; + } + } + } +} diff --git a/CUERipper.WPF/Properties/Resources.resx b/CUERipper.WPF/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/CUERipper.WPF/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/CUERipper.WPF/Properties/Settings.Designer.cs b/CUERipper.WPF/Properties/Settings.Designer.cs new file mode 100644 index 0000000..6269b82 --- /dev/null +++ b/CUERipper.WPF/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CUERipper.WPF.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.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; + } + } + } +} diff --git a/CUERipper.WPF/Properties/Settings.settings b/CUERipper.WPF/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/CUERipper.WPF/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/CUERipper.WPF/Window1.xaml b/CUERipper.WPF/Window1.xaml new file mode 100644 index 0000000..c4e5949 --- /dev/null +++ b/CUERipper.WPF/Window1.xaml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + Track + Title + Artist + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lossless + lossy + + + image + tracks + + + + + + EAC log + + + + + + + + + + + + + + diff --git a/CUERipper.WPF/Window1.xaml.cs b/CUERipper.WPF/Window1.xaml.cs new file mode 100644 index 0000000..800845a --- /dev/null +++ b/CUERipper.WPF/Window1.xaml.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Collections.ObjectModel; +using CUETools.CDImage; +using CUETools.Processor; + +namespace CUERipper.WPF +{ + public class DriveInfo + { + public string Name { get; set; } + public string Icon { get; set; } + } + + /// + /// Interaction logic for Window1.xaml + /// + public partial class Window1 : Window + { + private CUEControls.ShellIconMgr m_icon_mgr; + + public Window1() + { + InitializeComponent(); + m_icon_mgr = new CUEControls.ShellIconMgr(); + } + + ObservableCollection _Releases = new ObservableCollection(); + ObservableCollection _Drives = new ObservableCollection(); + public ObservableCollection Drives { get { return _Drives; } } + public ObservableCollection Releases { get { return _Releases; } } + + public static DependencyProperty SelectedDriveProperty = DependencyProperty.Register("SelectedDrive", typeof(DriveInfo), typeof(Window1)); + public DriveInfo SelectedDrive + { + get { return ((DriveInfo)(base.GetValue(SelectedDriveProperty))); } + set { base.SetValue(SelectedDriveProperty, value); } + } + + public static DependencyProperty SelectedReleaseProperty = DependencyProperty.Register("SelectedRelease", typeof(CUEMetadataEntry), typeof(Window1)); + public CUEMetadataEntry SelectedRelease + { + get { return ((CUEMetadataEntry)(base.GetValue(SelectedReleaseProperty))); } + set { base.SetValue(SelectedReleaseProperty, value); } + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + Drives.Add(new DriveInfo { Name = "aa", Icon = "/CUERipper.WPF;component/musicbrainz.ico" }); + Drives.Add(new DriveInfo { Name = "cc", Icon = "/CUERipper.WPF;component/freedb16.png" }); + Drives.Add(new DriveInfo { Name = "ee", Icon = "ff" }); + SelectedDrive = Drives[0]; + + CDImageLayout toc = new CDImageLayout(2, 2, 1, "0 10000 20000"); + Releases.Add(new CUEMetadataEntry(toc, "/CUERipper.WPF;component/musicbrainz.ico")); + Releases[0].metadata.Artist = "Mike Oldfield"; + Releases[0].metadata.Title = "Amarok"; + Releases[0].metadata.Tracks[0].Artist = "Mike Oldfield"; + Releases[0].metadata.Tracks[0].Title = "Amarok 01"; + Releases[0].metadata.Tracks[1].Artist = "Mike Oldfield"; + Releases[0].metadata.Tracks[1].Title = "Amarok 02"; + Releases.Add(new CUEMetadataEntry(toc, "/CUERipper.WPF;component/freedb16.png")); + SelectedRelease = Releases[0]; + } + } +} diff --git a/CUERipper.WPF/app.config b/CUERipper.WPF/app.config new file mode 100644 index 0000000..f6387ff --- /dev/null +++ b/CUERipper.WPF/app.config @@ -0,0 +1,4 @@ + + + + diff --git a/CUERipper.WPF/depprop.txt b/CUERipper.WPF/depprop.txt new file mode 100644 index 0000000..1fe7d89 --- /dev/null +++ b/CUERipper.WPF/depprop.txt @@ -0,0 +1,17 @@ + //public static global::System.Workflow.ComponentModel.DependencyProperty MyPropertyProperty = DependencyProperty.Register("MyProperty", typeof(string), typeof(Window1)); + + //[System.ComponentModel.DescriptionAttribute("MyProperty")] + //[System.ComponentModel.CategoryAttribute("MyProperty Category")] + //[System.ComponentModel.BrowsableAttribute(true)] + //[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)] + //public string MyProperty + //{ + // get + // { + // return ((string)(base.GetValue(Window1.MyPropertyProperty))); + // } + // set + // { + // base.SetValue(Window1.MyPropertyProperty, value); + // } + //} diff --git a/CUERipper.WPF/freedb16.png b/CUERipper.WPF/freedb16.png new file mode 100644 index 0000000..a7ba138 Binary files /dev/null and b/CUERipper.WPF/freedb16.png differ diff --git a/CUERipper.WPF/musicbrainz.ico b/CUERipper.WPF/musicbrainz.ico new file mode 100644 index 0000000..7942139 Binary files /dev/null and b/CUERipper.WPF/musicbrainz.ico differ diff --git a/CUERipper/CUERipper.csproj b/CUERipper/CUERipper.csproj index aa3f592..5f98ddf 100644 --- a/CUERipper/CUERipper.csproj +++ b/CUERipper/CUERipper.csproj @@ -26,7 +26,7 @@ LocalIntranet Properties\app.manifest - v2.0 + v4.0 publish\ true Web @@ -48,12 +48,13 @@ false true true + true full false - ..\bin\Debug\ + ..\bin\Debug\net40\ DEBUG;TRACE prompt 4 @@ -63,7 +64,7 @@ pdbonly true - ..\bin\Release\ + ..\bin\Release\net40\ TRACE prompt 4 @@ -156,6 +157,10 @@ {6458A13A-30EF-45A9-9D58-E5031B17BEE2} CUETools.Codecs + + {c36efaa5-4f81-4a29-800d-ba866ff13bc8} + CUETools.CTDB.Types + {AA2A9A7E-45FB-4632-AD85-85B0E556F818} CUETools.CTDB diff --git a/CUERipper/Properties/Resources.Designer.cs b/CUERipper/Properties/Resources.Designer.cs index 900841a..c9a722e 100644 --- a/CUERipper/Properties/Resources.Designer.cs +++ b/CUERipper/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18033 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace CUERipper.Properties { // 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", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/CUERipper/Properties/Settings.Designer.cs b/CUERipper/Properties/Settings.Designer.cs index ffa7057..3f5be14 100644 --- a/CUERipper/Properties/Settings.Designer.cs +++ b/CUERipper/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.239 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace CUERipper.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/CUERipper/app.config b/CUERipper/app.config index 1c41d78..50b8ed3 100644 --- a/CUERipper/app.config +++ b/CUERipper/app.config @@ -1,8 +1,8 @@ - + - -
+ +
@@ -17,4 +17,4 @@ - \ No newline at end of file + diff --git a/CUETools.ALACEnc/App.config b/CUETools.ALACEnc/App.config index 220cf55..f6267ab 100644 --- a/CUETools.ALACEnc/App.config +++ b/CUETools.ALACEnc/App.config @@ -1,8 +1,8 @@ - + - \ No newline at end of file + diff --git a/CUETools.ALACEnc/CUETools.ALACEnc.csproj b/CUETools.ALACEnc/CUETools.ALACEnc.csproj index a28aba5..634b79e 100644 --- a/CUETools.ALACEnc/CUETools.ALACEnc.csproj +++ b/CUETools.ALACEnc/CUETools.ALACEnc.csproj @@ -1,102 +1,31 @@ - - + + - Debug - AnyCPU - 8.0.50727 - 2.0 - {8E6E1763-39AE-491D-A10F-44C8844ABA5B} - Exe - Properties - CUETools.ALACEnc + net40;net20;netcoreapp2.0 + 2.1.6.0 CUETools.ALACEnc - - - 3.5 - - - v2.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true + CUETools.ALACEnc + CUETools + Exe + A tool for encoding and decoding ALAC. + Copyright (c) 2008-2018 Grigory Chudov + Grigory Chudov + true + ..\bin\$(Configuration)\ + https://github.com/gchudov/cuetools.net + git + - - true - full - false - ..\bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - ..\bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - - - - - - - - - - {F2EC7193-D5E5-4252-9803-5CEB407E910F} - CUETools.Codecs.ALAC + + + False - - {6458A13A-30EF-45A9-9D58-E5031B17BEE2} - CUETools.Codecs - - + + - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - + + - - - - - - \ No newline at end of file + + diff --git a/CUETools.ALACEnc/Properties/AssemblyInfo.cs b/CUETools.ALACEnc/Properties/AssemblyInfo.cs deleted file mode 100644 index 5b7c58a..0000000 --- a/CUETools.ALACEnc/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -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("CUETools.ALACEnc")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("CUETools.ALACEnc")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] -[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("24fa1fb9-e01a-48cf-b478-f560496d1ed3")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CUETools.ARCUE/CUETools.ARCUE.csproj b/CUETools.ARCUE/CUETools.ARCUE.csproj index 4ec8c2e..41e4ccb 100644 --- a/CUETools.ARCUE/CUETools.ARCUE.csproj +++ b/CUETools.ARCUE/CUETools.ARCUE.csproj @@ -1,102 +1,33 @@ - - + + - Debug - AnyCPU - 8.0.50727 - 2.0 - {A5A8D8FA-9E32-4010-8AAF-AE580C5AF728} + net40;netcoreapp2.0 + 2.1.6.0 + CUETools.ARCUE + CUETools.ARCUE + CUETools Exe - Properties - ArCueDotNet - ArCueDotNet - - - 3.5 - - - v2.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true + A tool for CD image verification against AccurateRip. + Copyright (c) 2008-2018 Grigory Chudov + Grigory Chudov + true + ..\bin\$(Configuration)\ + https://github.com/gchudov/cuetools.net + git + - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - ..\bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - - - - - - - - - - {6458A13A-30EF-45A9-9D58-E5031B17BEE2} - CUETools.Codecs + + + + False - - {AA2A9A7E-45FB-4632-AD85-85B0E556F818} - CUETools.CTDB - - - {4911BD82-49EF-4858-8B51-5394F86739A4} - CUETools.Processor - - + + - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - + + + + - - - \ No newline at end of file + + diff --git a/CUETools.ARCUE/Properties/AssemblyInfo.cs b/CUETools.ARCUE/Properties/AssemblyInfo.cs deleted file mode 100644 index 151d269..0000000 --- a/CUETools.ARCUE/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -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("CUETools.ARCUE")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CUETools.ARCUE")] -[assembly: AssemblyCopyright("Copyright © 2008-2010 Grigory Chudov")] -[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("2da81ac9-8929-42c8-ae27-9431b4f71508")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("2.1.6.0")] -[assembly: AssemblyFileVersion("2.1.6.0")] diff --git a/CUETools.AccurateRip/CUETools.AccurateRip.csproj b/CUETools.AccurateRip/CUETools.AccurateRip.csproj index 51065c7..a62f4f0 100644 --- a/CUETools.AccurateRip/CUETools.AccurateRip.csproj +++ b/CUETools.AccurateRip/CUETools.AccurateRip.csproj @@ -1,109 +1,31 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {5802C7E9-157E-4124-946D-70B5AE48A5A1} - Library - Properties - CUETools.AccurateRip + net40;net20;netstandard2.0 + 2.1.6.0 CUETools.AccurateRip - - - 3.5 - - - false - - - v2.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - false - ..\bin\Debug\ - DEBUG;TRACE - prompt - 4 + CUETools.AccurateRip + CUETools + A library for calculating AccurateRip checksums, CRC32 and Reed-solomon codes of CD audio. + Copyright (c) 2008-2018 Grigory Chudov + Grigory Chudov true - AllRules.ruleset + ..\bin\$(Configuration)\ + https://github.com/gchudov/cuetools.net + git + - - pdbonly - true - ..\bin\Release\ - TRACE - prompt - 4 - true - AllRules.ruleset - - - - - - - - - - - - - - - {6458A13A-30EF-45A9-9D58-E5031B17BEE2} - CUETools.Codecs + + + + False - - {1DD41038-D885-46C5-8DDE-E0B82F066584} - CUETools.CDImage - - - {ECEB839C-171B-4535-958F-9899310A0342} - CUETools.Parity - - + + - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - + + + - - - \ No newline at end of file + + diff --git a/CUETools.AccurateRip/Properties/AssemblyInfo.cs b/CUETools.AccurateRip/Properties/AssemblyInfo.cs deleted file mode 100644 index e6a706c..0000000 --- a/CUETools.AccurateRip/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -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("CUETools.AccurateRip")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CUETools.AccurateRip")] -[assembly: AssemblyCopyright("Copyright © 2008-2010 Grigory Chudov")] -[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("080b79f6-6b19-417e-a1d1-afcb6e469112")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("2.1.6.0")] -[assembly: AssemblyFileVersion("2.1.6.0")] diff --git a/CUETools.CDImage/CUETools.CDImage.csproj b/CUETools.CDImage/CUETools.CDImage.csproj index eda8258..af3defb 100644 --- a/CUETools.CDImage/CUETools.CDImage.csproj +++ b/CUETools.CDImage/CUETools.CDImage.csproj @@ -1,91 +1,19 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {1DD41038-D885-46C5-8DDE-E0B82F066584} - Library - Properties - CUETools.CDImage + net40;net20;netstandard2.0 + 2.1.6.0 CUETools.CDImage - - - 3.5 - - - false - - - v2.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true + CUETools.CDImage + CUETools + A library for working with CD TOC. + Copyright (c) 2008-2018 Grigory Chudov + Grigory Chudov + true + ..\bin\$(Configuration)\ + https://github.com/gchudov/cuetools.net + git + - - true - full - false - ..\bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - ..\bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - \ No newline at end of file + + diff --git a/CUETools.CDImage/Properties/AssemblyInfo.cs b/CUETools.CDImage/Properties/AssemblyInfo.cs deleted file mode 100644 index 108d34b..0000000 --- a/CUETools.CDImage/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -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("CUETools.CDImage")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CUETools.CDImage")] -[assembly: AssemblyCopyright("Copyright © 2008-2010 Grigory Chudov")] -[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("3db8bfa6-d3ba-4875-b02f-ef81119eab98")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("2.1.6.0")] -[assembly: AssemblyFileVersion("2.1.6.0")] diff --git a/CUETools.CDRepair/CUETools.CDRepair.csproj b/CUETools.CDRepair/CUETools.CDRepair.csproj index 7f0ab30..c945320 100644 --- a/CUETools.CDRepair/CUETools.CDRepair.csproj +++ b/CUETools.CDRepair/CUETools.CDRepair.csproj @@ -10,7 +10,7 @@ Properties CUETools.CDRepair CUETools.CDRepair - v2.0 + v4.0 512 diff --git a/CUETools.CLParity/CLParity.cs b/CUETools.CLParity/CLParity.cs new file mode 100644 index 0000000..2c12892 --- /dev/null +++ b/CUETools.CLParity/CLParity.cs @@ -0,0 +1,664 @@ +/** + * CUETools.CLParity: Reed-Solomon (32 bit) using OpenCL + * Copyright (c) 2009 Gregory S. Chudov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +using System; +using System.ComponentModel; +using System.Collections.Generic; +using System.IO; +using System.Security.Cryptography; +using System.Threading; +using System.Text; +using System.Runtime.InteropServices; +using CUETools.Codecs; +using OpenCLNet; + +namespace CUETools.CLParity +{ + public class CLParitySettings + { + public CLParitySettings() + { + this.MappedMemory = false; + this.GroupSize = 128; + this.DeviceType = OpenCLDeviceType.GPU; + } + + [DefaultValue(false)] + [SRDescription(typeof(Properties.Resources), "DescriptionMappedMemory")] + public bool MappedMemory { get; set; } + + [TypeConverter(typeof(CLParitySettingsGroupSizeConverter))] + [DefaultValue(128)] + [SRDescription(typeof(Properties.Resources), "DescriptionGroupSize")] + public int GroupSize { get; set; } + + [SRDescription(typeof(Properties.Resources), "DescriptionDefines")] + public string Defines { get; set; } + + [TypeConverter(typeof(CLParitySettingsPlatformConverter))] + [SRDescription(typeof(Properties.Resources), "DescriptionPlatform")] + public string Platform { get; set; } + + [DefaultValue(OpenCLDeviceType.GPU)] + [SRDescription(typeof(Properties.Resources), "DescriptionDeviceType")] + public OpenCLDeviceType DeviceType { get; set; } + } + + public class CLParitySettingsPlatformConverter : TypeConverter + { + public override bool GetStandardValuesSupported(ITypeDescriptorContext context) + { + return true; + } + + public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + { + var res = new List(); + foreach (var p in OpenCL.GetPlatforms()) + res.Add(p.Name); + return new StandardValuesCollection(res); + } + } + + public class CLParitySettingsGroupSizeConverter : TypeConverter + { + public override bool GetStandardValuesSupported(ITypeDescriptorContext context) + { + return true; + } + + public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + { + return new StandardValuesCollection(new int[] { 64, 128, 256 }); + } + } + + public enum OpenCLDeviceType : ulong + { + CPU = DeviceType.CPU, + GPU = DeviceType.GPU + } + + //[AudioEncoderClass("CLParity", typeof(CLParitySettings))] + public class CLParityWriter : IAudioDest + { + long _position; + + // total stream samples + // if 0, stream length is unknown + int sample_count = -1; + + TimeSpan _userProcessorTime; + + int samplesInBuffer = 0; + + bool inited = false; + + OpenCLManager OCLMan; + Program openCLProgram; + + CLParityTask task1; + CLParityTask task2; + + int npar, stride, stridesPerTask; + + AudioPCMConfig _pcm; + + public CLParityWriter(string path, Stream IO, AudioPCMConfig pcm) + { + _pcm = pcm; + if (pcm.BitsPerSample != 16) + throw new Exception("Bits per sample must be 16."); + if (pcm.ChannelCount != 2) + throw new Exception("ChannelCount must be 2."); + npar = 256; + stride = 1; + } + + public CLParityWriter(string path, AudioPCMConfig pcm) + : this(path, null, pcm) + { + } + + internal CLParitySettings _settings = new CLParitySettings(); + + public object Settings + { + get + { + return _settings; + } + set + { + if (value as CLParitySettings == null) + throw new Exception("Unsupported options " + value); + _settings = value as CLParitySettings; + } + } + + //[DllImport("kernel32.dll")] + //static extern bool GetThreadTimes(IntPtr hThread, out long lpCreationTime, out long lpExitTime, out long lpKernelTime, out long lpUserTime); + //[DllImport("kernel32.dll")] + //static extern IntPtr GetCurrentThread(); + + void DoClose() + { + if (inited) + { + int strideCount = samplesInBuffer / stride; + if (strideCount > 0) + do_output_frames(strideCount); + if (samplesInBuffer > 0) + throw new Exception(string.Format("samplesInBuffer % stride != 0")); + if (task2.strideCount > 0) + { + task2.openCLCQ.Finish(); // cuda.SynchronizeStream(task2.stream); + task2.strideCount = 0; + } + + task1.Dispose(); + task2.Dispose(); + openCLProgram.Dispose(); + OCLMan.Dispose(); + inited = false; + } + } + + public void Close() + { + DoClose(); + if (sample_count > 0 && _position != sample_count) + throw new Exception(string.Format("Samples written differs from the expected sample count. Expected {0}, got {1}.", sample_count, _position)); + } + + public void Delete() + { + if (inited) + { + task1.Dispose(); + task2.Dispose(); + openCLProgram.Dispose(); + OCLMan.Dispose(); + inited = false; + } + } + + public long Position + { + get + { + return _position; + } + } + + public long FinalSampleCount + { + set { sample_count = (int)value; } + } + + public TimeSpan UserProcessorTime + { + get { return _userProcessorTime; } + } + + public AudioPCMConfig PCM + { + get { return _pcm; } + } + + public unsafe void InitTasks() + { + if (!inited) + { + if (OpenCL.NumberOfPlatforms < 1) + throw new Exception("no opencl platforms found"); + + int groupSize = _settings.DeviceType == OpenCLDeviceType.CPU ? 1 : _settings.GroupSize; + OCLMan = new OpenCLManager(); + // Attempt to save binaries after compilation, as well as load precompiled binaries + // to avoid compilation. Usually you'll want this to be true. + OCLMan.AttemptUseBinaries = true; // true; + // Attempt to compile sources. This should probably be true for almost all projects. + // Setting it to false means that when you attempt to compile "mysource.cl", it will + // only scan the precompiled binary directory for a binary corresponding to a source + // with that name. There's a further restriction that the compiled binary also has to + // use the same Defines and BuildOptions + OCLMan.AttemptUseSource = true; + // Binary and source paths + // This is where we store our sources and where compiled binaries are placed + //OCLMan.BinaryPath = @"OpenCL\bin"; + //OCLMan.SourcePath = @"OpenCL\src"; + // If true, RequireImageSupport will filter out any devices without image support + // In this project we don't need image support though, so we set it to false + OCLMan.RequireImageSupport = false; + // The BuildOptions string is passed directly to clBuild and can be used to do debug builds etc + OCLMan.BuildOptions = ""; + OCLMan.SourcePath = System.IO.Path.GetDirectoryName(GetType().Assembly.Location); + OCLMan.BinaryPath = System.IO.Path.Combine(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CUE Tools"), "OpenCL"); + int platformId = 0; + if (_settings.Platform != null) + { + platformId = -1; + string platforms = ""; + for (int i = 0; i < OpenCL.NumberOfPlatforms; i++) + { + var platform = OpenCL.GetPlatform(i); + platforms += " \"" + platform.Name + "\""; + if (platform.Name.Equals(_settings.Platform, StringComparison.InvariantCultureIgnoreCase)) + { + platformId = i; + break; + } + } + if (platformId < 0) + throw new Exception("unknown platform \"" + _settings.Platform + "\". Platforms available:" + platforms); + } + OCLMan.CreateDefaultContext(platformId, (DeviceType)_settings.DeviceType); + + this.stridesPerTask = (int)OCLMan.Context.Devices[0].MaxComputeUnits * npar * 8; + + // The Defines string gets prepended to any and all sources that are compiled + // and serve as a convenient way to pass configuration information to the compilation process + OCLMan.Defines = + "#define GROUP_SIZE " + groupSize.ToString() + "\n" + + "#define CLPARITY_VERSION \"" + vendor_string + "\"\n" + +#if DEBUG + "#define DEBUG\n" + +#endif + (_settings.DeviceType == OpenCLDeviceType.CPU ? "#define CLPARITY_CPU\n" : "") + + _settings.Defines + "\n"; + + var exts = new string[] { "cl_khr_local_int32_base_atomics", "cl_khr_local_int32_extended_atomics", "cl_khr_fp64", "cl_amd_fp64" }; + foreach (string extension in exts) + if (OCLMan.Context.Devices[0].Extensions.Contains(extension)) + { + OCLMan.Defines += "#pragma OPENCL EXTENSION " + extension + ": enable\n"; + OCLMan.Defines += "#define HAVE_" + extension + "\n"; + } + + try + { + openCLProgram = OCLMan.CompileFile("parity.cl"); + } + catch (OpenCLBuildException ex) + { + string buildLog = ex.BuildLogs[0]; + throw ex; + } + //using (Stream kernel = GetType().Assembly.GetManifestResourceStream(GetType(), "parity.cl")) + //using (StreamReader sr = new StreamReader(kernel)) + //{ + // try + // { + // openCLProgram = OCLMan.CompileSource(sr.ReadToEnd()); ; + // } + // catch (OpenCLBuildException ex) + // { + // string buildLog = ex.BuildLogs[0]; + // throw ex; + // } + //} +#if TTTTKJHSKJH + var openCLPlatform = OpenCL.GetPlatform(0); + openCLContext = openCLPlatform.CreateDefaultContext(); + using (Stream kernel = GetType().Assembly.GetManifestResourceStream(GetType(), "parity.cl")) + using (StreamReader sr = new StreamReader(kernel)) + openCLProgram = openCLContext.CreateProgramWithSource(sr.ReadToEnd()); + try + { + openCLProgram.Build(); + } + catch (OpenCLException) + { + string buildLog = openCLProgram.GetBuildLog(openCLProgram.Devices[0]); + throw; + } +#endif + + task1 = new CLParityTask(openCLProgram, this, groupSize, this.npar, this.stride, this.stridesPerTask); + task2 = new CLParityTask(openCLProgram, this, groupSize, this.npar, this.stride, this.stridesPerTask); + inited = true; + } + } + + public unsafe void Write(AudioBuffer buff) + { + InitTasks(); + buff.Prepare(this); + int pos = 0; + while (pos < buff.Length) + { + int block = Math.Min(buff.Length - pos, stride * stridesPerTask - samplesInBuffer); + + fixed (byte* buf = buff.Bytes) + AudioSamples.MemCpy(((byte*)task1.clSamplesBytesPtr) + samplesInBuffer * _pcm.BlockAlign, buf + pos * _pcm.BlockAlign, block * _pcm.BlockAlign); + + samplesInBuffer += block; + pos += block; + + int strideCount = samplesInBuffer / stride; + if (strideCount >= stridesPerTask) + do_output_frames(strideCount); + } + } + + public unsafe void do_output_frames(int strideCount) + { + task1.strideCount = strideCount; + if (!task1.UseMappedMemory) + task1.openCLCQ.EnqueueWriteBuffer(task1.clSamplesBytes, false, 0, sizeof(int) * stride * strideCount, task1.clSamplesBytesPtr); + //task.openCLCQ.EnqueueUnmapMemObject(task.clSamplesBytes, task.clSamplesBytes.HostPtr); + //task.openCLCQ.EnqueueMapBuffer(task.clSamplesBytes, true, MapFlags.WRITE, 0, task.samplesBufferLen / 2); + task1.EnqueueKernels(); + if (task2.strideCount > 0) + task2.openCLCQ.Finish(); + int bs = stride * strideCount; + samplesInBuffer -= bs; + if (samplesInBuffer > 0) + AudioSamples.MemCpy( + ((byte*)task2.clSamplesBytesPtr), + ((byte*)task1.clSamplesBytesPtr) + bs * _pcm.BlockAlign, + samplesInBuffer * _pcm.BlockAlign); + CLParityTask tmp = task1; + task1 = task2; + task2 = tmp; + task1.strideCount = 0; + } + + public string Path { get { return null; } } + + public static readonly string vendor_string = "CLParity#2.1.6"; + } + + internal class CLParityTask + { + Program openCLProgram; + public CommandQueue openCLCQ; + public Kernel reedSolomonInit; + public Kernel reedSolomonInitGx; + public Kernel reedSolomonA; + public Kernel reedSolomonB; + public Kernel reedSolomon; + public Kernel reedSolomonDecodeInit; + public Kernel reedSolomonDecode; + public Kernel chienSearch; + public Mem clSamplesBytes; + public Mem clExp; + public Mem clEncodeGx0; + public Mem clEncodeGx1; + public Mem clParity0; + public Mem clParity1; + public Mem clSigma; + public Mem clWkOut; + + public Mem clSamplesBytesPinned; + public Mem clExpPinned; + public Mem clParity0Pinned; + public Mem clParity1Pinned; + + public IntPtr clSamplesBytesPtr; + public IntPtr clExpPtr; + public IntPtr clParity0Ptr; + public IntPtr clParity1Ptr; + + public int[] samplesBuffer; + public int strideCount = 0; + public int npar; + public int stride; + public int maxStridesCount; + + public Thread workThread = null; + public Exception exception = null; + public bool done = false; + public bool exit = false; + + public int groupSize = 128; + public CLParityWriter writer; + public bool UseMappedMemory = false; + + unsafe public CLParityTask(Program _openCLProgram, CLParityWriter writer, int groupSize, int npar, int stride, int maxStridesCount) + { + this.UseMappedMemory = writer._settings.MappedMemory || writer._settings.DeviceType == OpenCLDeviceType.CPU; + this.groupSize = groupSize; + this.writer = writer; + openCLProgram = _openCLProgram; +#if DEBUG + var prop = CommandQueueProperties.PROFILING_ENABLE; +#else + var prop = CommandQueueProperties.NONE; +#endif + openCLCQ = openCLProgram.Context.CreateCommandQueue(openCLProgram.Context.Devices[0], prop); + + this.npar = npar; + this.stride = stride; + this.maxStridesCount = maxStridesCount; + + int samplesBufferLen = this.maxStridesCount * this.stride * sizeof(int); + int parityLength = (this.npar + 1) * sizeof(int); + int encodeGxLength = (this.npar + this.groupSize) * sizeof(int); + int expLength = this.npar * sizeof(int); + int sigmaLength = this.npar * sizeof(int); + //int wkOutLength = this.npar * sizeof(int); + + if (!this.UseMappedMemory) + { + clSamplesBytes = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE, samplesBufferLen); + clParity0 = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE, parityLength); + clParity1 = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE, parityLength); + clExp = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE, expLength); + + clSamplesBytesPinned = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE | MemFlags.ALLOC_HOST_PTR, samplesBufferLen); + clParity0Pinned = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE | MemFlags.ALLOC_HOST_PTR, parityLength); + clParity1Pinned = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE | MemFlags.ALLOC_HOST_PTR, parityLength); + clExpPinned = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE | MemFlags.ALLOC_HOST_PTR, expLength); + + clSamplesBytesPtr = openCLCQ.EnqueueMapBuffer(clSamplesBytesPinned, true, MapFlags.READ_WRITE, 0, samplesBufferLen); + clParity0Ptr = openCLCQ.EnqueueMapBuffer(clParity0Pinned, true, MapFlags.READ_WRITE, 0, parityLength); + clParity1Ptr = openCLCQ.EnqueueMapBuffer(clParity1Pinned, true, MapFlags.READ_WRITE, 0, parityLength); + clExpPtr = openCLCQ.EnqueueMapBuffer(clExpPinned, true, MapFlags.READ_WRITE, 0, expLength); + } + else + { + clSamplesBytes = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE | MemFlags.ALLOC_HOST_PTR, samplesBufferLen); + clParity0 = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE | MemFlags.ALLOC_HOST_PTR, parityLength); + clParity1 = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE | MemFlags.ALLOC_HOST_PTR, parityLength); + clExp = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE | MemFlags.ALLOC_HOST_PTR, expLength); + + clSamplesBytesPtr = openCLCQ.EnqueueMapBuffer(clSamplesBytes, true, MapFlags.READ_WRITE, 0, samplesBufferLen); + clParity0Ptr = openCLCQ.EnqueueMapBuffer(clParity0, true, MapFlags.READ_WRITE, 0, parityLength); + clParity1Ptr = openCLCQ.EnqueueMapBuffer(clParity1, true, MapFlags.READ_WRITE, 0, parityLength); + clExpPtr = openCLCQ.EnqueueMapBuffer(clExp, true, MapFlags.READ_WRITE, 0, expLength); + + //clSamplesBytesPtr = clSamplesBytes.HostPtr; + //clResidualPtr = clResidual.HostPtr; + //clBestRiceParamsPtr = clBestRiceParams.HostPtr; + //clResidualTasksPtr = clResidualTasks.HostPtr; + //clWindowFunctionsPtr = clWindowFunctions.HostPtr; + } + + clEncodeGx0 = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE, encodeGxLength); + clEncodeGx1 = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE, encodeGxLength); + + //clSamples = openCLProgram.Context.CreateBuffer(MemFlags.READ_WRITE, samplesBufferLen); + //openCLCQ.EnqueueMapBuffer(clSamplesBytes, true, MapFlags.WRITE, 0, samplesBufferLen / 2); + + reedSolomonInit = openCLProgram.CreateKernel("reedSolomonInit"); + reedSolomonInitGx = openCLProgram.CreateKernel("reedSolomonInitGx"); + reedSolomonA = openCLProgram.CreateKernel("reedSolomonA"); + reedSolomonB = openCLProgram.CreateKernel("reedSolomonB"); + reedSolomon = openCLProgram.CreateKernel("reedSolomon"); + reedSolomonDecodeInit = openCLProgram.CreateKernel("reedSolomonDecodeInit"); + reedSolomonDecode = openCLProgram.CreateKernel("reedSolomonDecode"); + chienSearch = openCLProgram.CreateKernel("chienSearch"); + + samplesBuffer = new int[this.maxStridesCount * this.stride]; + + InitData(); + } + + public void Dispose() + { + if (workThread != null) + { + lock (this) + { + exit = true; + Monitor.Pulse(this); + } + workThread.Join(); + workThread = null; + } + + openCLCQ.Finish(); + + reedSolomonInit.Dispose(); + reedSolomonInitGx.Dispose(); + reedSolomonA.Dispose(); + reedSolomonB.Dispose(); + reedSolomon.Dispose(); + reedSolomonDecodeInit.Dispose(); + reedSolomonDecode.Dispose(); + chienSearch.Dispose(); + + if (!this.UseMappedMemory) + { + if (clSamplesBytesPtr != IntPtr.Zero) + openCLCQ.EnqueueUnmapMemObject(clSamplesBytesPinned, clSamplesBytesPtr); + clSamplesBytesPtr = IntPtr.Zero; + if (clParity0Ptr != IntPtr.Zero) + openCLCQ.EnqueueUnmapMemObject(clParity0Pinned, clParity0Ptr); + clParity0Ptr = IntPtr.Zero; + if (clParity1Ptr != IntPtr.Zero) + openCLCQ.EnqueueUnmapMemObject(clParity1Pinned, clParity1Ptr); + clParity1Ptr = IntPtr.Zero; + if (clExpPtr != IntPtr.Zero) + openCLCQ.EnqueueUnmapMemObject(clExpPinned, clExpPtr); + clExpPtr = IntPtr.Zero; + + clSamplesBytesPinned.Dispose(); + clParity0Pinned.Dispose(); + clParity1Pinned.Dispose(); + clExpPinned.Dispose(); + } + else + { + openCLCQ.EnqueueUnmapMemObject(clSamplesBytes, clSamplesBytesPtr); + openCLCQ.EnqueueUnmapMemObject(clParity0, clParity0Ptr); + openCLCQ.EnqueueUnmapMemObject(clParity1, clParity1Ptr); + openCLCQ.EnqueueUnmapMemObject(clExp, clExpPtr); + } + + clSamplesBytes.Dispose(); + clParity0.Dispose(); + clParity1.Dispose(); + clEncodeGx0.Dispose(); + clEncodeGx1.Dispose(); + clExp.Dispose(); + + //clSamples.Dispose(); + + openCLCQ.Dispose(); + + GC.SuppressFinalize(this); + } + + private unsafe void InitData() + { + reedSolomonInit.SetArgs( + clEncodeGx0, + clEncodeGx1, + clParity0, + clParity1, + npar); + + openCLCQ.EnqueueNDRangeKernel( + reedSolomonInit, + groupSize, npar / groupSize); + + for (int i = 0; i < npar / (groupSize / 2); i++) + { + reedSolomonInitGx.SetArgs( + clExp, + clEncodeGx0, + clEncodeGx1, + npar, + i); + + openCLCQ.EnqueueNDRangeKernel( + reedSolomonInitGx, + groupSize, npar / (groupSize / 2)); + + var temp = clEncodeGx0; clEncodeGx0 = clEncodeGx1; clEncodeGx1 = temp; + } + } + + internal unsafe void EnqueueKernels() + { + int blocks = strideCount / groupSize; + for (int i = 0; i < blocks; i++) + { + reedSolomonA.SetArgs(clSamplesBytes, clEncodeGx0, clParity0, this.npar, i * groupSize); + openCLCQ.EnqueueNDRangeKernel(reedSolomonA, groupSize, 1); + reedSolomonB.SetArgs(clSamplesBytes, clEncodeGx0, clParity0, this.npar, i * groupSize); + openCLCQ.EnqueueNDRangeKernel(reedSolomonB, groupSize, npar / groupSize); + } + for (int i = blocks * groupSize; i < strideCount; i++) + { + reedSolomon.SetArgs(clSamplesBytes, clEncodeGx0, clParity0, clParity1, this.npar, i); + openCLCQ.EnqueueNDRangeKernel(reedSolomon, groupSize, npar / groupSize); + var temp = clParity0; clParity0 = clParity1; clParity1 = temp; + } + + //openCLCQ.EnqueueReadBuffer(clRiceOutput, false, 0, (channels * frameSize * (writer.PCM.BitsPerSample + 1) + 256) / 8 * frameCount, clRiceOutputPtr); + } + } + +#if LKJLKJLJK + public static class OpenCLExtensions + { + public static void SetArgs(this Kernel kernel, params object[] args) + { + int i = 0; + foreach (object arg in args) + { + if (arg is int) + kernel.SetArg(i, (int)arg); + else if (arg is Mem) + kernel.SetArg(i, (Mem)arg); + else + throw new ArgumentException("Invalid argument type", arg.GetType().ToString()); + i++; + } + } + + public static void EnqueueNDRangeKernel(this CommandQueue queue, Kernel kernel, long localSize, long globalSize) + { + if (localSize == 0) + queue.EnqueueNDRangeKernel(kernel, 1, null, new long[] { globalSize }, null); + else + queue.EnqueueNDRangeKernel(kernel, 1, null, new long[] { localSize * globalSize }, new long[] { localSize }); + } + + public static void EnqueueNDRangeKernel(this CommandQueue queue, Kernel kernel, long localSizeX, long localSizeY, long globalSizeX, long globalSizeY) + { + queue.EnqueueNDRangeKernel(kernel, 2, null, new long[] { localSizeX * globalSizeX, localSizeY * globalSizeY }, new long[] { localSizeX, localSizeY }); + } + } +#endif +} diff --git a/CUETools.CLParity/CUETools.CLParity.csproj b/CUETools.CLParity/CUETools.CLParity.csproj new file mode 100644 index 0000000..cb8ab92 --- /dev/null +++ b/CUETools.CLParity/CUETools.CLParity.csproj @@ -0,0 +1,127 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {D41FEFF9-9D43-4049-BF9B-B13D9AC7E192} + Library + Properties + CUETools.CLParity + CUETools.CLParity + + + 3.5 + + + v4.0 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + ..\bin\Debug\plugins\net40\ + DEBUG;TRACE + prompt + 4 + true + AllRules.ruleset + + + pdbonly + true + ..\bin\Release\plugins\net40\ + TRACE + prompt + 4 + true + AllRules.ruleset + + + + False + ..\ThirdParty\OpenCLNet.dll + + + + + + + + + + True + True + Resources.resx + + + + + {082D6B9E-326E-4D15-9798-EDAE9EDE70A6} + CUETools.Codecs.FLAKE + False + + + {6458A13A-30EF-45A9-9D58-E5031B17BEE2} + CUETools.Codecs + False + + + + + PreserveNewest + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + + \ No newline at end of file diff --git a/CUEControls/Properties/AssemblyInfo.cs b/CUETools.CLParity/Properties/AssemblyInfo.cs similarity index 82% rename from CUEControls/Properties/AssemblyInfo.cs rename to CUETools.CLParity/Properties/AssemblyInfo.cs index c4c1133..3aad582 100644 --- a/CUEControls/Properties/AssemblyInfo.cs +++ b/CUETools.CLParity/Properties/AssemblyInfo.cs @@ -1,35 +1,35 @@ -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("CUEControls")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CUEControls")] -[assembly: AssemblyCopyright("Copyright © 2008-2010 Grigory Chudov")] -[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("3c6acc24-0c31-4ad1-8856-218877a987fd")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("2.1.6.0")] -[assembly: AssemblyFileVersion("2.1.6.0")] +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("CUETools.CLParity")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CUETools.CLParity")] +[assembly: AssemblyCopyright("Copyright © 2011 Gregory S. Chudov")] +[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("b28ffece-6c89-426b-b227-e647b435cc3d")] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("2.1.6.0")] +[assembly: AssemblyFileVersion("2.1.6.0")] diff --git a/CUETools.CLParity/Properties/Resources.Designer.cs b/CUETools.CLParity/Properties/Resources.Designer.cs new file mode 100644 index 0000000..39b66af --- /dev/null +++ b/CUETools.CLParity/Properties/Resources.Designer.cs @@ -0,0 +1,180 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18033 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CUETools.CLParity.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", "4.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("CUETools.CLParity.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; + } + } + + /// + /// Looks up a localized string similar to Use additional CPU threads. + /// + internal static string DescriptionCPUThreads { + get { + return ResourceManager.GetString("DescriptionCPUThreads", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Additional preprocessor definitions for OpenCL kernel. + /// + internal static string DescriptionDefines { + get { + return ResourceManager.GetString("DescriptionDefines", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Use CPU or GPU device. + /// + internal static string DescriptionDeviceType { + get { + return ResourceManager.GetString("DescriptionDeviceType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Do final encoding stages on GPU (experimental). + /// + internal static string DescriptionDoRice { + get { + return ResourceManager.GetString("DescriptionDoRice", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Use GPU on all stages. + /// + internal static string DescriptionGPUOnly { + get { + return ResourceManager.GetString("DescriptionGPUOnly", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to GPU thread block size (64, 128, 256). + /// + internal static string DescriptionGroupSize { + get { + return ResourceManager.GetString("DescriptionGroupSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Device uses host memory (Don't use). + /// + internal static string DescriptionMappedMemory { + get { + return ResourceManager.GetString("DescriptionMappedMemory", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to OpenCL platform to use. + /// + internal static string DescriptionPlatform { + get { + return ResourceManager.GetString("DescriptionPlatform", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Number of frames processed per one multiprocessor. + /// + internal static string DescriptionTaskSize { + get { + return ResourceManager.GetString("DescriptionTaskSize", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Calculate MD5 hash for audio stream. + /// + internal static string DoMD5Description { + get { + return ResourceManager.GetString("DoMD5Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Decode each frame and compare with original. + /// + internal static string DoVerifyDescription { + get { + return ResourceManager.GetString("DoVerifyDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Samples written differs from the expected sample count. + /// + internal static string ExceptionSampleCount { + get { + return ResourceManager.GetString("ExceptionSampleCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Validation failed. + /// + internal static string ExceptionValidationFailed { + get { + return ResourceManager.GetString("ExceptionValidationFailed", resourceCulture); + } + } + } +} diff --git a/CUETools.CLParity/Properties/Resources.resx b/CUETools.CLParity/Properties/Resources.resx new file mode 100644 index 0000000..54702b4 --- /dev/null +++ b/CUETools.CLParity/Properties/Resources.resx @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Use additional CPU threads + + + Additional preprocessor definitions for OpenCL kernel + + + Use CPU or GPU device + + + Do final encoding stages on GPU (experimental) + + + Use GPU on all stages + + + GPU thread block size (64, 128, 256) + + + Device uses host memory (Don't use) + + + OpenCL platform to use + + + Number of frames processed per one multiprocessor + + + Calculate MD5 hash for audio stream + + + Decode each frame and compare with original + + + Samples written differs from the expected sample count + + + Validation failed + + \ No newline at end of file diff --git a/CUETools.CLParity/Properties/Resources.ru-RU.resx b/CUETools.CLParity/Properties/Resources.ru-RU.resx new file mode 100644 index 0000000..250cb03 --- /dev/null +++ b/CUETools.CLParity/Properties/Resources.ru-RU.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Использовать дополнительные потоки + + + Использовать GPU на всех стадиях + + + Вычислять MD5-хеш аудиопотока + + + Декодировать каждый блок и сравнивать с оригиналом + + + Количество записанных сэмплов отличается от ожидавшегося + + + Ошибка верификации + + \ No newline at end of file diff --git a/CUETools.CLParity/fastdecode/0901.1886v1.pdf b/CUETools.CLParity/fastdecode/0901.1886v1.pdf new file mode 100644 index 0000000..a6ccd01 Binary files /dev/null and b/CUETools.CLParity/fastdecode/0901.1886v1.pdf differ diff --git a/CUETools.CLParity/fastdecode/0901.1886v1.txt b/CUETools.CLParity/fastdecode/0901.1886v1.txt new file mode 100644 index 0000000..477292a --- /dev/null +++ b/CUETools.CLParity/fastdecode/0901.1886v1.txt @@ -0,0 +1,3 @@ +q = 2^m = 65536, m = 16 +k == npar? +n < q diff --git a/CUETools.CLParity/fastdecode/VERSION b/CUETools.CLParity/fastdecode/VERSION new file mode 100644 index 0000000..ac5330c --- /dev/null +++ b/CUETools.CLParity/fastdecode/VERSION @@ -0,0 +1 @@ +Mon Jul 13 12:03:07 CEST 2009 diff --git a/CUETools.CLParity/fastdecode/fastdecode.sln b/CUETools.CLParity/fastdecode/fastdecode.sln new file mode 100644 index 0000000..48ff604 --- /dev/null +++ b/CUETools.CLParity/fastdecode/fastdecode.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastdecode", "fastdecode.vcproj", "{32B8B6B7-FAED-4D9D-B90D-7E5C1E392DD8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {32B8B6B7-FAED-4D9D-B90D-7E5C1E392DD8}.Debug|Win32.ActiveCfg = Debug|Win32 + {32B8B6B7-FAED-4D9D-B90D-7E5C1E392DD8}.Debug|Win32.Build.0 = Debug|Win32 + {32B8B6B7-FAED-4D9D-B90D-7E5C1E392DD8}.Release|Win32.ActiveCfg = Release|Win32 + {32B8B6B7-FAED-4D9D-B90D-7E5C1E392DD8}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/flac/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj b/CUETools.CLParity/fastdecode/fastdecode.vcproj similarity index 77% rename from flac/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj rename to CUETools.CLParity/fastdecode/fastdecode.vcproj index 5fc7cbc..63f7aa2 100644 --- a/flac/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj +++ b/CUETools.CLParity/fastdecode/fastdecode.vcproj @@ -1,194 +1,204 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CUETools.CLParity/fastdecode/fastdecode.vcproj.fandrahomevs.chudov.user b/CUETools.CLParity/fastdecode/fastdecode.vcproj.fandrahomevs.chudov.user new file mode 100644 index 0000000..e59cbe7 --- /dev/null +++ b/CUETools.CLParity/fastdecode/fastdecode.vcproj.fandrahomevs.chudov.user @@ -0,0 +1,65 @@ + + + + + + + + + + + diff --git a/CUETools.CLParity/fastdecode/fastdecode.vcproj.user b/CUETools.CLParity/fastdecode/fastdecode.vcproj.user new file mode 100644 index 0000000..0ce2ced --- /dev/null +++ b/CUETools.CLParity/fastdecode/fastdecode.vcproj.user @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/CUETools.CLParity/fastdecode/inttypes.h b/CUETools.CLParity/fastdecode/inttypes.h new file mode 100644 index 0000000..4b3828a --- /dev/null +++ b/CUETools.CLParity/fastdecode/inttypes.h @@ -0,0 +1,305 @@ +// ISO C9x compliant inttypes.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_INTTYPES_H_ // [ +#define _MSC_INTTYPES_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include "stdint.h" + +// 7.8 Format conversion of integer types + +typedef struct { + intmax_t quot; + intmax_t rem; +} imaxdiv_t; + +// 7.8.1 Macros for format specifiers + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 + +// The fprintf macros for signed integers are: +#define PRId8 "d" +#define PRIi8 "i" +#define PRIdLEAST8 "d" +#define PRIiLEAST8 "i" +#define PRIdFAST8 "d" +#define PRIiFAST8 "i" + +#define PRId16 "hd" +#define PRIi16 "hi" +#define PRIdLEAST16 "hd" +#define PRIiLEAST16 "hi" +#define PRIdFAST16 "hd" +#define PRIiFAST16 "hi" + +#define PRId32 "I32d" +#define PRIi32 "I32i" +#define PRIdLEAST32 "I32d" +#define PRIiLEAST32 "I32i" +#define PRIdFAST32 "I32d" +#define PRIiFAST32 "I32i" + +#define PRId64 "I64d" +#define PRIi64 "I64i" +#define PRIdLEAST64 "I64d" +#define PRIiLEAST64 "I64i" +#define PRIdFAST64 "I64d" +#define PRIiFAST64 "I64i" + +#define PRIdMAX "I64d" +#define PRIiMAX "I64i" + +#define PRIdPTR "Id" +#define PRIiPTR "Ii" + +// The fprintf macros for unsigned integers are: +#define PRIo8 "o" +#define PRIu8 "u" +#define PRIx8 "x" +#define PRIX8 "X" +#define PRIoLEAST8 "o" +#define PRIuLEAST8 "u" +#define PRIxLEAST8 "x" +#define PRIXLEAST8 "X" +#define PRIoFAST8 "o" +#define PRIuFAST8 "u" +#define PRIxFAST8 "x" +#define PRIXFAST8 "X" + +#define PRIo16 "ho" +#define PRIu16 "hu" +#define PRIx16 "hx" +#define PRIX16 "hX" +#define PRIoLEAST16 "ho" +#define PRIuLEAST16 "hu" +#define PRIxLEAST16 "hx" +#define PRIXLEAST16 "hX" +#define PRIoFAST16 "ho" +#define PRIuFAST16 "hu" +#define PRIxFAST16 "hx" +#define PRIXFAST16 "hX" + +#define PRIo32 "I32o" +#define PRIu32 "I32u" +#define PRIx32 "I32x" +#define PRIX32 "I32X" +#define PRIoLEAST32 "I32o" +#define PRIuLEAST32 "I32u" +#define PRIxLEAST32 "I32x" +#define PRIXLEAST32 "I32X" +#define PRIoFAST32 "I32o" +#define PRIuFAST32 "I32u" +#define PRIxFAST32 "I32x" +#define PRIXFAST32 "I32X" + +#define PRIo64 "I64o" +#define PRIu64 "I64u" +#define PRIx64 "I64x" +#define PRIX64 "I64X" +#define PRIoLEAST64 "I64o" +#define PRIuLEAST64 "I64u" +#define PRIxLEAST64 "I64x" +#define PRIXLEAST64 "I64X" +#define PRIoFAST64 "I64o" +#define PRIuFAST64 "I64u" +#define PRIxFAST64 "I64x" +#define PRIXFAST64 "I64X" + +#define PRIoMAX "I64o" +#define PRIuMAX "I64u" +#define PRIxMAX "I64x" +#define PRIXMAX "I64X" + +#define PRIoPTR "Io" +#define PRIuPTR "Iu" +#define PRIxPTR "Ix" +#define PRIXPTR "IX" + +// The fscanf macros for signed integers are: +#define SCNd8 "d" +#define SCNi8 "i" +#define SCNdLEAST8 "d" +#define SCNiLEAST8 "i" +#define SCNdFAST8 "d" +#define SCNiFAST8 "i" + +#define SCNd16 "hd" +#define SCNi16 "hi" +#define SCNdLEAST16 "hd" +#define SCNiLEAST16 "hi" +#define SCNdFAST16 "hd" +#define SCNiFAST16 "hi" + +#define SCNd32 "ld" +#define SCNi32 "li" +#define SCNdLEAST32 "ld" +#define SCNiLEAST32 "li" +#define SCNdFAST32 "ld" +#define SCNiFAST32 "li" + +#define SCNd64 "I64d" +#define SCNi64 "I64i" +#define SCNdLEAST64 "I64d" +#define SCNiLEAST64 "I64i" +#define SCNdFAST64 "I64d" +#define SCNiFAST64 "I64i" + +#define SCNdMAX "I64d" +#define SCNiMAX "I64i" + +#ifdef _WIN64 // [ +# define SCNdPTR "I64d" +# define SCNiPTR "I64i" +#else // _WIN64 ][ +# define SCNdPTR "ld" +# define SCNiPTR "li" +#endif // _WIN64 ] + +// The fscanf macros for unsigned integers are: +#define SCNo8 "o" +#define SCNu8 "u" +#define SCNx8 "x" +#define SCNX8 "X" +#define SCNoLEAST8 "o" +#define SCNuLEAST8 "u" +#define SCNxLEAST8 "x" +#define SCNXLEAST8 "X" +#define SCNoFAST8 "o" +#define SCNuFAST8 "u" +#define SCNxFAST8 "x" +#define SCNXFAST8 "X" + +#define SCNo16 "ho" +#define SCNu16 "hu" +#define SCNx16 "hx" +#define SCNX16 "hX" +#define SCNoLEAST16 "ho" +#define SCNuLEAST16 "hu" +#define SCNxLEAST16 "hx" +#define SCNXLEAST16 "hX" +#define SCNoFAST16 "ho" +#define SCNuFAST16 "hu" +#define SCNxFAST16 "hx" +#define SCNXFAST16 "hX" + +#define SCNo32 "lo" +#define SCNu32 "lu" +#define SCNx32 "lx" +#define SCNX32 "lX" +#define SCNoLEAST32 "lo" +#define SCNuLEAST32 "lu" +#define SCNxLEAST32 "lx" +#define SCNXLEAST32 "lX" +#define SCNoFAST32 "lo" +#define SCNuFAST32 "lu" +#define SCNxFAST32 "lx" +#define SCNXFAST32 "lX" + +#define SCNo64 "I64o" +#define SCNu64 "I64u" +#define SCNx64 "I64x" +#define SCNX64 "I64X" +#define SCNoLEAST64 "I64o" +#define SCNuLEAST64 "I64u" +#define SCNxLEAST64 "I64x" +#define SCNXLEAST64 "I64X" +#define SCNoFAST64 "I64o" +#define SCNuFAST64 "I64u" +#define SCNxFAST64 "I64x" +#define SCNXFAST64 "I64X" + +#define SCNoMAX "I64o" +#define SCNuMAX "I64u" +#define SCNxMAX "I64x" +#define SCNXMAX "I64X" + +#ifdef _WIN64 // [ +# define SCNoPTR "I64o" +# define SCNuPTR "I64u" +# define SCNxPTR "I64x" +# define SCNXPTR "I64X" +#else // _WIN64 ][ +# define SCNoPTR "lo" +# define SCNuPTR "lu" +# define SCNxPTR "lx" +# define SCNXPTR "lX" +#endif // _WIN64 ] + +#endif // __STDC_FORMAT_MACROS ] + +// 7.8.2 Functions for greatest-width integer types + +// 7.8.2.1 The imaxabs function +#define imaxabs _abs64 + +// 7.8.2.2 The imaxdiv function + +// This is modified version of div() function from Microsoft's div.c found +// in %MSVC.NET%\crt\src\div.c +#ifdef STATIC_IMAXDIV // [ +static +#else // STATIC_IMAXDIV ][ +_inline +#endif // STATIC_IMAXDIV ] +imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) +{ + imaxdiv_t result; + + result.quot = numer / denom; + result.rem = numer % denom; + + if (numer < 0 && result.rem > 0) { + // did division wrong; must fix up + ++result.quot; + result.rem -= denom; + } + + return result; +} + +// 7.8.2.3 The strtoimax and strtoumax functions +#define strtoimax _strtoi64 +#define strtoumax _strtoui64 + +// 7.8.2.4 The wcstoimax and wcstoumax functions +#define wcstoimax _wcstoi64 +#define wcstoumax _wcstoui64 + + +#endif // _MSC_INTTYPES_H_ ] diff --git a/CUETools.CLParity/fastdecode/main.c b/CUETools.CLParity/fastdecode/main.c new file mode 100644 index 0000000..0d0d036 --- /dev/null +++ b/CUETools.CLParity/fastdecode/main.c @@ -0,0 +1,422 @@ +// ************************************************ +// ************************************************ + +// Sample program to use reed_solomon.c +// (c) 2009 Frederic Didier. + +#include "reed_solomon.h" +#include "stdio.h" +#include "stdlib.h" +#include "time.h" + +/************************************************/ +/** Random number generator -> 32bits **/ +/** Mersenne twister code **/ +/************************************************/ + +/* A C-program for MT19937: Integer version */ +/* genrand() generates one pseudorandom unsigned integer (32bit) */ +/* which is uniformly distributed among 0 to 2^32-1 for each */ +/* call. sgenrand(seed) set initial values to the working area */ +/* of 624 words. Before genrand(), sgenrand(seed) must be */ +/* called once. (seed is any 32-bit integer except for 0). */ +/* Coded by Takuji Nishimura, considering the suggestions by */ +/* Topher Cooper and Marc Rieffel in July-Aug. 1997. */ + +/* This library is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public */ +/* License as published by the Free Software Foundation; either */ +/* version 2 of the License, or (at your option) any later */ +/* version. */ +/* This library is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +/* See the GNU Library General Public License for more details. */ +/* You should have received a copy of the GNU Library General */ +/* Public License along with this library; if not, write to the */ +/* Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ + +/* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. */ +/* Any feedback is very welcome. For any question, comments, */ +/* see http://www.math.keio.ac.jp/matumoto/emt.html or email */ +/* matumoto@math.keio.ac.jp */ + +/* Period parameters */ +#define MT_N 624 +#define MT_M 397 +#define MATRIX_A 0x9908b0df /* constant vector a */ +#define UPPER_MASK 0x80000000 /* most significant w-r bits */ +#define LOWER_MASK 0x7fffffff /* least significant r bits */ + +/* Tempering parameters */ +#define TEMPERING_MASK_B 0x9d2c5680 +#define TEMPERING_MASK_C 0xefc60000 +#define TEMPERING_SHIFT_U(y) (y >> 11) +#define TEMPERING_SHIFT_S(y) (y << 7) +#define TEMPERING_SHIFT_T(y) (y << 15) +#define TEMPERING_SHIFT_L(y) (y >> 18) + +static unsigned long mt[MT_N]; /* the table for the state vector */ +static int mti=MT_N+1; /* mti==MT_N+1 means mt[MT_N] is not initialized */ + +/* initializing the table with a NONZERO seed */ +void sgenrand(unsigned long seed) +{ + /* setting initial seeds to mt[MT_N] using */ + /* the generator Line 25 of Table 1 in */ + /* [KNUTH 1981, The Art of Computer Programming */ + /* Vol. 2 (2nd Ed.), pp102] */ + mt[0]= seed & 0xffffffff; + for (mti=1; mti= MT_N) { /* generate MT_N words at one time */ + int kk; + + if (mti == MT_N+1) /* if sgenrand() has not been called, */ + sgenrand(4357); /* a default initial seed is used */ + + for (kk=0;kk> 1) ^ mag01[y & 0x1]; + } + for (;kk> 1) ^ mag01[y & 0x1]; + } + y = (mt[MT_N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK); + mt[MT_N-1] = mt[MT_M-1] ^ (y >> 1) ^ mag01[y & 0x1]; + + mti = 0; + } + + y = mt[mti++]; + y ^= TEMPERING_SHIFT_U(y); + y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B; + y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C; + y ^= TEMPERING_SHIFT_L(y); + + return y; +} + +double double_genrand() { + return genrand() * (1.0/4294967295.0); +} + +// ******************************************************* + +// The Art of Computer programming - Knuth +// vol 2 - section 3.4.2 page 137 +// Algorithm S (Selection sampling technique) + +void generate_positions(int N, int K, int *pos) +{ + int size=N; + int w=K; + do { + if (double_genrand()*size <= w) { + pos[K-w] = N-size; + w--; + } + size--; + } while (size); +} + +//void generate_message(byte *data, int size) +//{ +// int *p = (int *)data; +// size >>=2; +// int i; +// for (i=0; i>=2; + for (i=0; i>=1; + for (i=0; i>=2; + for (i=0; i5) S = atoi(argv[5]); + if (argc>6) m_size = atoi(argv[6]) << 20; + + // modify packet size + // always divisible by [4], + // if xor code used, divisible by [4*n_field] + inc = 4 * n_field; + while (temp < S) temp +=inc; + S = temp; + + // number of field elements per packets. + nb_elt = (S * 8) / n_field; + + // compute number of blocs + nb_bloc = m_size / (K*S); + if (nb_bloc==0) nb_bloc=1; + + // power of two just greater than N + while ((1< +using namespace std; + +#include "stdio.h" +#include "stdlib.h" +#include "time.h" + +typedef unsigned char byte; + +/************************************************/ +/** Random number generator -> 32bits **/ +/** Mersenne twister code **/ +/************************************************/ + +/* A C-program for MT19937: Integer version */ +/* genrand() generates one pseudorandom unsigned integer (32bit) */ +/* which is uniformly distributed among 0 to 2^32-1 for each */ +/* call. sgenrand(seed) set initial values to the working area */ +/* of 624 words. Before genrand(), sgenrand(seed) must be */ +/* called once. (seed is any 32-bit integer except for 0). */ +/* Coded by Takuji Nishimura, considering the suggestions by */ +/* Topher Cooper and Marc Rieffel in July-Aug. 1997. */ + +/* This library is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public */ +/* License as published by the Free Software Foundation; either */ +/* version 2 of the License, or (at your option) any later */ +/* version. */ +/* This library is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +/* See the GNU Library General Public License for more details. */ +/* You should have received a copy of the GNU Library General */ +/* Public License along with this library; if not, write to the */ +/* Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ + +/* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. */ +/* Any feedback is very welcome. For any question, comments, */ +/* see http://www.math.keio.ac.jp/matumoto/emt.html or email */ +/* matumoto@math.keio.ac.jp */ + +/* Period parameters */ +#define MT_N 624 +#define MT_M 397 +#define MATRIX_A 0x9908b0df /* constant vector a */ +#define UPPER_MASK 0x80000000 /* most significant w-r bits */ +#define LOWER_MASK 0x7fffffff /* least significant r bits */ + +/* Tempering parameters */ +#define TEMPERING_MASK_B 0x9d2c5680 +#define TEMPERING_MASK_C 0xefc60000 +#define TEMPERING_SHIFT_U(y) (y >> 11) +#define TEMPERING_SHIFT_S(y) (y << 7) +#define TEMPERING_SHIFT_T(y) (y << 15) +#define TEMPERING_SHIFT_L(y) (y >> 18) + +static unsigned long mt[MT_N]; /* the table for the state vector */ +static int mti=MT_N+1; /* mti==MT_N+1 means mt[MT_N] is not initialized */ + +/* initializing the table with a NONZERO seed */ +void sgenrand(unsigned long seed) +{ + /* setting initial seeds to mt[MT_N] using */ + /* the generator Line 25 of Table 1 in */ + /* [KNUTH 1981, The Art of Computer Programming */ + /* Vol. 2 (2nd Ed.), pp102] */ + mt[0]= seed & 0xffffffff; + for (mti=1; mti= MT_N) { /* generate MT_N words at one time */ + int kk; + + if (mti == MT_N+1) /* if sgenrand() has not been called, */ + sgenrand(4357); /* a default initial seed is used */ + + for (kk=0;kk> 1) ^ mag01[y & 0x1]; + } + for (;kk> 1) ^ mag01[y & 0x1]; + } + y = (mt[MT_N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK); + mt[MT_N-1] = mt[MT_M-1] ^ (y >> 1) ^ mag01[y & 0x1]; + + mti = 0; + } + + y = mt[mti++]; + y ^= TEMPERING_SHIFT_U(y); + y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B; + y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C; + y ^= TEMPERING_SHIFT_L(y); + + return y; +} + +double double_genrand() { + return genrand() * (1.0/4294967295.0); +} + +// ******************************************************* + +// The Art of Computer programming - Knuth +// vol 2 - section 3.4.2 page 137 +// Algorithm S (Selection sampling technique) + +void generate_positions(int N, int K, int *pos) +{ + int size=N; + int w=K; + do { + if (double_genrand()*size <= w) { + pos[K-w] = N-size; + w--; + } + size--; + } while (size); +} + +void generate_message(byte *data, int size) +{ + int *p = (int *)data; + size >>=2; + int i; + for (i=0; i>=2; + int res=0; + int i; + for (i=0; i>16); + a += (((int)a)>>31) & GF; + return a; +} + +int inline field_mult(unsigned int a, unsigned int b) +{ + if (a==(1<<16)) return -(int)b + (((-(int)b)>>31) & GF); + return reduce(a*b); +} + +// this one work if not both a and b are (1<<16) that is -1. +int inline field_mult_no(unsigned int a, unsigned int b) +{ + return reduce(a*b); +} + +int inline field_diff(unsigned int a, unsigned int b) +{ + a -= b; + return a + ((((int)a)>>31)&GF); +} + +int inline field_sum(unsigned int a, unsigned int b) +{ + a -= GF-b; + return a + ((((int)a)>>31)&GF); +} + + +void init_field() +{ + GF_log = (int *) malloc(sizeof(int) * GF); + GF_exp = (int *) malloc(sizeof(int) * GF); + inv = (int *) malloc(sizeof(int) * GF); + + int p = 1; + int i; + for (i=0; i+1>(i+1)) + i++; + return i; +} + +void reverse(int *vect, int n) +{ + int i,j; + + j=n >> 1; + for (i=1; i i) { + int temp=vect[i]; + vect[i]=vect[j]; + vect[j]=temp; + } + + int m = n >> 1; + while (m >= 1 && (j & m)) { + j ^= m; + m >>= 1; + } + j += m; + } +} + +void fft_dit(int *vect, int n) +{ + reverse(vect, n); + + int i,j; + + int step=1; + int number=n/2; + int mult=15; + while (number>0) + { + int *p=vect; + int *q=vect+step; + for (i=0; i>=1; + mult--; + } +} + +void ifft_dit(int *vect, int n) +{ + reverse(vect, n); + + int i,j; + + int step=1; + int number=n/2; + int mult=15; + while (number>0) + { + int *p=vect; + int *q=vect+step; + for (i=0; istep; j--) { + int a = *p; + int b = field_mult_no(*q, GF_exp[j<>=1; + mult--; + } +} + + +void fft2(int *vect, int n) +{ + int i=n/2; + while (i--) { + int a = *vect; + int b = *(vect+1); + *(vect++) = field_sum(a,b); + *(vect++) = field_diff(a,b); + } +} + + +// decimation in frequency +void fft_inc(int *vect, int n) +{ + int i,j; + + int number=1; + int step=n/2; + int mult = 16 - get_log(n); + + while (step>0) + { + int *p=vect; + int *q=vect+step; + for (i=0; i>=1; + number<<=1; + mult++; + } +} + +// decimation in time +void ifft_inc(int *vect, int n) +{ + int i,j; + int number=n/2; + + int step=1; + int mult=15; + + int *root=GF_exp + (1<<16); + while (number>0) + { + int *p=vect; + int *q=vect+step; + for (i=0; i>=1; + mult--; + } +} + +void fft_rec(int *vect, int n) +{ + if (n == 1<<11) return fft_inc(vect, n); +/* if (n==2) { + int a = vect[0]; + int b = vect[1]; + vect[0] = field_sum(a,b); + vect[1] = field_diff(a,b); + return; + } +*/ + int i; + int mult = 16 - get_log(n); + + n/=2; + int *l = vect; + int *h = vect + n; + for (i=0; i* X, int n) +{ + if (n==1) return; + for (int i=0; i a = X[i]; + complex b = X[n/2 + i]; + X[i] = a + b; + X[n/2 + i] = (a - b) * polar(1.0, -2*Pi*i/double(n)); + } + complex_fft_rec(X, n/2); + complex_fft_rec(X + n/2, n/2); +} + +// decimation in time +// input is bit reversed. +void complex_ifft_rec(complex* X, int n) +{ + if (n==1) return; + complex_ifft_rec(X, n/2); + complex_ifft_rec(X + n/2, n/2); + for (int i=0; i a = X[i]; + complex b = X[n/2 + i] * polar(1.0, 2*Pi*i/double(n)); + X[i] = a + b; + X[n/2 + i] = (a - b); + } +} + +// The memory can be allocated only once if many call to this +// function are expected. the fft of the log can be precomputed. +void compute_prod_fast(int *prod, int *pos, int k, int n) +{ + const int NN = 2*n; + complex* R = (complex *)malloc(NN * sizeof(complex)); + complex* L = (complex *)malloc(NN * sizeof(complex)); + for (int i=0; i0) { + L[NN - i] = GF_log[GF - i]; + } + } + + // convolution + complex_fft_rec(R, NN); + complex_fft_rec(L, NN); + for (int i=0; i < NN; ++i) { + R[i] *= L[i]; + } + complex_ifft_rec(R, NN); + + // now we have the GF_log(prod[i]) in Re(R[i]) + // we take the result mod 2^16 since we are in the multiplicative + // field of GF(2^16+1) + for (int x=0; x < n; ++x) { + prod[x] = GF_exp[((long long) (real(R[x])/double(NN) + 0.5)) % (1<<16)]; + } + + free(R); + free(L); +} + +//********************************************************************* +//********************************************************************* + +int *high; +int *low; +int *prod; +int *enc_fft; +int *rev_fft; +int *mid_fft; +int *prod_enc; + +void init_code(int n) +{ + low = (int *) malloc(sizeof(int) * n); + high = (int *) malloc(sizeof(int) * n); + prod = (int *) malloc(sizeof(int) * n); + prod_enc = (int *) malloc(sizeof(int) * n); + + enc_fft = (int *) malloc(sizeof(int) * n); + rev_fft = (int *) malloc(sizeof(int) * n); + mid_fft = (int *) malloc(sizeof(int) * n); + + int x; + for (x=0; x=n/2 and we don't need the fist half of the output + fft(dst, n); + for (x=0; x n/2 + if (k > n/2) { + for (i=0; i 32bits **/ +/** Mersenne twister code **/ +/************************************************/ + +/* A C-program for MT19937: Integer version */ +/* genrand() generates one pseudorandom unsigned integer (32bit) */ +/* which is uniformly distributed among 0 to 2^32-1 for each */ +/* call. sgenrand(seed) set initial values to the working area */ +/* of 624 words. Before genrand(), sgenrand(seed) must be */ +/* called once. (seed is any 32-bit integer except for 0). */ +/* Coded by Takuji Nishimura, considering the suggestions by */ +/* Topher Cooper and Marc Rieffel in July-Aug. 1997. */ + +/* This library is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public */ +/* License as published by the Free Software Foundation; either */ +/* version 2 of the License, or (at your option) any later */ +/* version. */ +/* This library is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +/* See the GNU Library General Public License for more details. */ +/* You should have received a copy of the GNU Library General */ +/* Public License along with this library; if not, write to the */ +/* Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ + +/* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. */ +/* Any feedback is very welcome. For any question, comments, */ +/* see http://www.math.keio.ac.jp/matumoto/emt.html or email */ +/* matumoto@math.keio.ac.jp */ + +/* Period parameters */ +#define MT_N 624 +#define MT_M 397 +#define MATRIX_A 0x9908b0df /* constant vector a */ +#define UPPER_MASK 0x80000000 /* most significant w-r bits */ +#define LOWER_MASK 0x7fffffff /* least significant r bits */ + +/* Tempering parameters */ +#define TEMPERING_MASK_B 0x9d2c5680 +#define TEMPERING_MASK_C 0xefc60000 +#define TEMPERING_SHIFT_U(y) (y >> 11) +#define TEMPERING_SHIFT_S(y) (y << 7) +#define TEMPERING_SHIFT_T(y) (y << 15) +#define TEMPERING_SHIFT_L(y) (y >> 18) + +static unsigned long mt[MT_N]; /* the table for the state vector */ +static int mti=MT_N+1; /* mti==MT_N+1 means mt[MT_N] is not initialized */ + +/* initializing the table with a NONZERO seed */ +void sgenrand(unsigned long seed) +{ + /* setting initial seeds to mt[MT_N] using */ + /* the generator Line 25 of Table 1 in */ + /* [KNUTH 1981, The Art of Computer Programming */ + /* Vol. 2 (2nd Ed.), pp102] */ + mt[0]= seed & 0xffffffff; + for (mti=1; mti= MT_N) { /* generate MT_N words at one time */ + int kk; + + if (mti == MT_N+1) /* if sgenrand() has not been called, */ + sgenrand(4357); /* a default initial seed is used */ + + for (kk=0;kk> 1) ^ mag01[y & 0x1]; + } + for (;kk> 1) ^ mag01[y & 0x1]; + } + y = (mt[MT_N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK); + mt[MT_N-1] = mt[MT_M-1] ^ (y >> 1) ^ mag01[y & 0x1]; + + mti = 0; + } + + y = mt[mti++]; + y ^= TEMPERING_SHIFT_U(y); + y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B; + y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C; + y ^= TEMPERING_SHIFT_L(y); + + return y; +} + +double double_genrand() { + return genrand() * (1.0/4294967295.0); +} + +// ******************************************************* + +// The Art of Computer programming - Knuth +// vol 2 - section 3.4.2 page 137 +// Algorithm S (Selection sampling technique) + +void generate_positions(int N, int K, int *pos) +{ + int size=N; + int w=K; + do { + if (double_genrand()*size <= w) { + pos[K-w] = N-size; + w--; + } + size--; + } while (size); +} + +void generate_message(byte *data, int size) +{ + int *p = (int *)data; + size >>=2; + int i; + for (i=0; i>=2; + int res=0; + int i; + for (i=0; i3) S = atoi(argv[3]); + if (argc>4) m_size = atoi(argv[4]) << 20; + + // number of field elements per packets. + int nb_elt = (S * 8) / n_field; + + // compute number of blocs + int nb_bloc = m_size / (K*S); + if (nb_bloc==0) nb_bloc=1; + + // power of two just greater than N + int n_walsh=1; + while ((1<=n_field) break; + index++; + } + + // used for the fast version only + poly = &primitive[temp]; + weight = index-temp; + + if (primitive[index]!=n_field) { + printf("primitive poly for GF %d not found !\n", n_field); + } + + // clock the lfsr (multiply by X) + // fill the table + int state=1; + for (i=0; i>n_field) state^=mask; + if (state>>n_field!=0) exit(0); + } + + // small change so we have bijection + log_table[0]=0; + log_table[1]=modulo; + exp_table[2*modulo]=1; +} + +// ************************************************ +// ************************************************ + +void walsh_mod(symbol *vect, int size); +void compute_product(); +void walsh_field(symbol *vect); + +// ************************************************ +// ************************************************ + +void log_walsh_init() +{ + int i; + for (i=0; i>j)&1; + } + + // precompute the Walsh transforms of the inverse + walsh_field(inverse); + + // everything is even if n_walsh=16 + // divide by two so computation fit on 16 bits! + // otherwise, multiply by power of two, so + // shift factor is always 15. + if (n_walsh==16) + for (i=0; i>= 1; + else { + for (i=0; i31 || nw > nf) { + printf("incorrect field parameters\n"); + exit(0); + } + + n_field = nf; + n_walsh = nw; + N_field = 1<>n_field); +// b = (b & modulo) + (b>>n_field); + + // on GF 2^16 + a = a + (a>>16); + b = b + (b>>16); + + vect[i]=a; + vect[i+step]=b; + + i++; + } + i+=step; + } + step<<=1; + } +} + +// ************************************************ +// ************************************************ + +// compute the product (3) of the paper +// return in product the logarithm of the product +void compute_product() +{ + int i; + // initialisation + for (i=0; i 16 + // otherwise int is ok. + for (i=0; imodulo) t-= modulo; + product[j] = t; + } + } +} + +// ******************************************************* +// ******************************************************* + +// Perform a Walsh transform +// Nothing special this time, except that we do not +// have to worry about any overflow since in our use, +// only the bit n_walsh will be important +// +// special version that do n_field transforms at once. +// one of the limiting part in the complexity + +void walsh_field_generic(symbol *vect) +{ + int i,j; + int step=n_field; + int size=n_field * N_walsh; + while (step (A+B, A-B) +// where sizeof A = sizeof B = s*32 bits +void walsh_step(symbol *p, symbol *q, int s) { + while (s--) { + __asm__ __volatile__ ( + "movdqa (%%esi), %%xmm0\n" + "movdqa 16(%%esi), %%xmm1\n" + "movdqa 32(%%esi), %%xmm2\n" + "movdqa 48(%%esi), %%xmm3\n" + + "movdqa (%%edi), %%xmm4\n" + "movdqa 16(%%edi), %%xmm5\n" + "movdqa 32(%%edi), %%xmm6\n" + "movdqa 48(%%edi), %%xmm7\n" + + "psubw %%xmm4, %%xmm0\n" + "psubw %%xmm5, %%xmm1\n" + "psubw %%xmm6, %%xmm2\n" + "psubw %%xmm7, %%xmm3\n" + + "psllw $1,%%xmm4\n" + "psllw $1,%%xmm5\n" + "psllw $1,%%xmm6\n" + "psllw $1,%%xmm7\n" + + "paddw %%xmm0, %%xmm4\n" + "paddw %%xmm1, %%xmm5\n" + "paddw %%xmm2, %%xmm6\n" + "paddw %%xmm3, %%xmm7\n" + + "movdqa %%xmm4, (%%esi)\n" + "movdqa %%xmm5, 16(%%esi)\n" + "movdqa %%xmm6, 32(%%esi)\n" + "movdqa %%xmm7, 48(%%esi)\n" + + "movdqa %%xmm0, (%%edi)\n" + "movdqa %%xmm1, 16(%%edi)\n" + "movdqa %%xmm2, 32(%%edi)\n" + "movdqa %%xmm3, 48(%%edi)\n" + : : "S"(p), "D"(q) : "memory"); + + p += 32; + q += 32; + } +} + +// Perform a Walsh step (A,B) -> (A+B, A-B) +// where sizeof A = sizeof B = s*16 bits +void walsh_step_simple(symbol *p, symbol *q, int s) { + while (s--) { + __asm__ __volatile__ ( + "movdqa (%%esi), %%xmm0\n" + "movdqa 16(%%esi), %%xmm1\n" + + "movdqa (%%edi), %%xmm4\n" + "movdqa 16(%%edi), %%xmm5\n" + + "psubw %%xmm4, %%xmm0\n" + "psubw %%xmm5, %%xmm1\n" + + "psllw $1,%%xmm4\n" + "psllw $1,%%xmm5\n" + + "paddw %%xmm0, %%xmm4\n" + "paddw %%xmm1, %%xmm5\n" + + "movdqa %%xmm4, (%%esi)\n" + "movdqa %%xmm5, 16(%%esi)\n" + + "movdqa %%xmm0, (%%edi)\n" + "movdqa %%xmm1, 16(%%edi)\n" + : : "S"(p), "D"(q) : "memory"); + + p += 16; + q += 16; + } +} + +// iterative DFS +void walsh_field_iter(symbol *p, int size) +{ + int i; + size/=4; + for (i=0; i>= 1; + }; + // next bloc + p += 4*NFIELD; + } +} + +// Recursive version +void walsh_field_rec(symbol *p, int size) +{ +// if (size==2) return walsh_step_simple(p,p+n_field,1); + if (size==4) return walsh_end(p); + + size /= 2; + symbol *q = p + size*NFIELD; + walsh_field_rec(p,size); + walsh_field_rec(q,size); + +// walsh_step_simple(p,q,size); + walsh_step(p,q,size/2); +} + +void walsh_field(symbol *vect) +{ + return walsh_field_iter(vect, N_walsh); + return walsh_field_rec(vect, N_walsh); + int i,j; + int step=n_field; + int size=n_field * N_walsh; + while (step>=1; + // we are interested only in the parity + // so no need to add &1; + } + } + + // compute the Walsh transforms of the coefficient + walsh_field(coeff); + + // multiply with precomputed Walsh transform of the inverse + field_product(); + + // walsh transform again + walsh_field(coeff); + + // put decoded symbol in place + // final multiplication by the product + temp = coeff + K*n_field; + for (i=0; i>= 1; + t ^= *(temp++); + } + + if (t) t = exp_table[log_table[t] + product_enc[K+i]]; + parity[i*S + j] = t; + } + } +} + +void fast_decode(int K, int S, int *positions, symbol *data, symbol *packets) +{ + int i,j,k; + + // copy the systematic pieces in place + for (i=0; i>=1; + // we are interested only in the parity + // so no need to add &1; + } + } + + // compute the Walsh transforms of the coefficient + walsh_field(coeff); + + // multiply with precomputed Walsh transform of the inverse + field_product(); + + // walsh transform again + walsh_field(coeff); + + // put decoded symbol in place + // final multiplication by the product + for (i=0; i>= 1; + t ^= *(temp++); + } + + if (t) t = exp_table[log_table[t] + product[i]]; + packets[i*S + j] = t; + } + } +} + diff --git a/CUETools.CLParity/fastdecode/new/reed_solomon.h b/CUETools.CLParity/fastdecode/new/reed_solomon.h new file mode 100644 index 0000000..103154d --- /dev/null +++ b/CUETools.CLParity/fastdecode/new/reed_solomon.h @@ -0,0 +1,49 @@ +// Reed-Solomon encoding/erasure decoding + +// Implementation of the algorithms described in +// Efficient erasure decoding of Reed-Solomon codes +// http://arxiv.org/abs/0901.1886v1 + +// (c) 2009 Frederic didier. +// Any feedback is very welcome. For any question, comments, +// see http://algo.epfl.ch/~didier/reed_solomon.html or email +// frederic.didier@epfl.ch + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +// TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +// OF SUCH DAMAGE. + +// type used to store one field symbol +// With short int, we can work up to GF(16) +// If one wants to work on bigger fied, replace this by int. +typedef unsigned short symbol; +typedef unsigned char byte; + +// Common initialisation functions +extern void code_init(int n_field, int n_walsh); +extern void code_clear(); + +extern void encode_init(int K); +extern void fast_encode(int N, int K, int S, symbol *data, symbol *packets); +extern void fast_decode(int K, int S, int *positions, symbol *data, symbol *packets); + diff --git a/CUETools.CLParity/fastdecode/reed_solomon.c b/CUETools.CLParity/fastdecode/reed_solomon.c new file mode 100644 index 0000000..a95764e --- /dev/null +++ b/CUETools.CLParity/fastdecode/reed_solomon.c @@ -0,0 +1,1073 @@ +// Reed-Solomon encoding/erasure decoding + +// Implementation of the algorithms described in +// Efficient erasure decoding of Reed-Solomon codes +// http://arxiv.org/abs/0901.1886v1 + +// (c) 2009 Frederic didier. +// Any feedback is very welcome. For any question, comments, +// see http://algo.epfl.ch/~didier/reed_solomon.html or email +// frederic.didier@epfl.ch + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +// TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +// OF SUCH DAMAGE. +// + +// ************************************************ +// ************************************************ + +#include "reed_solomon.h" + +// ************************************************ +// ************************************************ +int n_field; +int N_field; +int modulo; + +symbol *log_table; +symbol *exp_table; + + +uint8_t *mult_table; + +// ************************************************ +// ************************************************ + +// compute the tables for the finite field operations +// exp_table is twice the needed size so we do not need to +// perform a modulo each time. + +// list of some primitive polynomials +int primitive[] = { + 0,1,6, + 0,3,7, + 0,2,3,4,8, + 0,4,9, + 0,3,10, + 0,2,11, + 0,1,4,6,12, + 0,1,3,4,13, + 0,1,11,12,14, + 0,1,15, + 0,1,3,12,16, + 0,3,17, + 0,3,20, + 0,3,25, + 100 // fallback +}; + +// will be set to the primitive poly of the field +// used only by the fast algorithm version +int *poly; +int weight; + +// contain the primitive poly in binary form +// used in xor type field multiplication +int field_mask; + +// init field. +void fill_table(int nf) +{ + n_field = nf; + N_field = 1<=n_field) break; + pos++; + } + + // used for the fast version only + poly = &primitive[temp]; + weight = pos-temp; + + if (primitive[pos]!=n_field) { + printf("primitive poly for GF %d not found !\n", n_field); + } + + // clock the lfsr (multiply by X) + int state=1; + int i; + for (i=0; i>n_field) state^=field_mask; + if (state>>n_field!=0) exit(0); + } + + // usefull since later + // since log_table[0]=0 + // we set log_table[1]=modulo + // so log_table is a bijection... + log_table[0]=0; + log_table[1]=modulo; + exp_table[2*modulo]=1; + + // for GF(2^8) + if (n_field==8) { + int i,j; + mult_table = (uint8_t *) malloc(256*256); + for (i=0; i<256; i++) + for (j=0; j<256; j++) { + if (j==0) mult_table[i*256+j]=0; + else mult_table[i*256+j]=exp_table[i+log_table[j]]; + } + } +} + +// ******************************************************* +// ******************************************************* + +void packet_clear(void *p, int S) +{ + memset(p, 0, S); +} + +void packet_log(void *p, int S) +{ + int i; + uint8_t *pt = (uint8_t *)p; + for (i=0; i> j)&1) { + uint32_t *src = (uint32_t *) (p_src + i*seg_size); + uint32_t *dst = (uint32_t *) (p_dst + j*seg_size); + + for (k=0; k>n_field) + cte^=field_mask; + } +} + +// less efficient even with inline ?? +void process_packet_xor2(int log_cte, void *p_dst, void *p_src, int S) +{ + int i,j; + + int seg_size = S / n_field; + int cte = exp_table[log_cte]; + + for (i=0; i> j)&1) { + memxor(p_dst+j*seg_size, p_src+i*seg_size, seg_size); + } + } + + // multiply cte by X + cte <<=1; + if (cte>>n_field) + cte^=field_mask; + } +} + +void process_packet_xor_eq(int log_cte, void *p_dst, void *p_src, int S) +{ + memset(p_dst, 0, S); + process_packet_xor(log_cte, p_dst, p_src, S); +} + +// ******************************************************* +// ******************************************************* + +int multiply(int a, int b) +{ + int i; + int res=0; + for (i=0; i> n_field) + a^=field_mask; + b >>=1; + } + return res; +} + +void process_packet_direct_simple(int log_cte, void *p_dst, void *p_src, int S) +{ + int i; + int cte = exp_table[log_cte]; + + uint16_t *src = (uint16_t *)p_src; + uint16_t *dst = (uint16_t *)p_dst; + for (i=0; i> n_field) + cte^=field_mask; + } + + uint16_t *src = (uint16_t *)p_src; + uint16_t *dst = (uint16_t *)p_dst; + for (i=0; i>0)&1)) & table[0]; + res ^= (-((a>>1)&1)) & table[1]; + res ^= (-((a>>2)&1)) & table[2]; + res ^= (-((a>>3)&1)) & table[3]; + res ^= (-((a>>4)&1)) & table[4]; + res ^= (-((a>>5)&1)) & table[5]; + res ^= (-((a>>6)&1)) & table[6]; + res ^= (-((a>>7)&1)) & table[7]; + res ^= (-((a>>8)&1)) & table[8]; + res ^= (-((a>>9)&1)) & table[9]; + res ^= (-((a>>10)&1)) & table[10]; + res ^= (-((a>>11)&1)) & table[11]; + res ^= (-((a>>12)&1)) & table[12]; + res ^= (-((a>>13)&1)) & table[13]; + res ^= (-((a>>14)&1)) & table[14]; + res ^= (-((a>>15)&1)) & table[15]; + *dst++ ^= res; + } +} + +void process_packet_direct_eq16(int log_cte, void *p_dst, void *p_src, int S) { + memset(p_dst, 0, S); + process_packet_direct16(log_cte, p_dst, p_src, S); +} + + +void process_packet_direct8(int log_cte, void *p_dst, void *p_src, int S) +{ + int i; + int cte = exp_table[log_cte]; + int table[8]; + for (i=0;i> n_field) + cte^=field_mask; + } + + uint8_t *src = (uint8_t *)p_src; + uint8_t *dst = (uint8_t *)p_dst; + for (i=0; i>0)&1)) & table[0]; + res ^= (-((a>>1)&1)) & table[1]; + res ^= (-((a>>2)&1)) & table[2]; + res ^= (-((a>>3)&1)) & table[3]; + res ^= (-((a>>4)&1)) & table[4]; + res ^= (-((a>>5)&1)) & table[5]; + res ^= (-((a>>6)&1)) & table[6]; + res ^= (-(a>>7)) & table[7]; + *dst++ ^= res; + } +} + +void process_packet_direct_eq8(int log_cte, void *p_dst, void *p_src, int S) { + memset(p_dst, 0, S); + process_packet_direct8(log_cte, p_dst, p_src, S); +} + + +// ******************************************************* +// ******************************************************* + +// these functions need the src packet +// to be in log form + +void process_packet_table(int log_cte, void *p_dst, void *p_src, int S) +{ + symbol *table = &exp_table[log_cte]; + int t = table[0]; + table[0]=0; + + int i; + uint8_t *src = (uint8_t *)p_src; + uint8_t *dst = (uint8_t *)p_dst; + for (i=0; i>n_field); + b = (b & modulo) + (b>>n_field); + + vect[i]=a; + vect[i+step]=b; + + i++; + } + i+=step; + } + step<<=1; + } +} + +void code_init(int nw) +{ + n_walsh = nw; + if (n_field>31 || n_walsh > n_field) { + printf("incorrect field parameters\n"); + exit(0); + } + + N_field = 1< 16 + // otherwise int is ok. + for (i=0; imodulo) t-= modulo; + product[j] = t; + } + } +} + +// ******************************************************* +// ******************************************************* + +// for encoding, we can precompute the product once +void encode_init(int N, int K) +{ + int i; + + // fill pos + for (i=0; i 32bits **/ +/** Mersenne twister code **/ +/************************************************/ + +/* A C-program for MT19937: Integer version */ +/* genrand() generates one pseudorandom unsigned integer (32bit) */ +/* which is uniformly distributed among 0 to 2^32-1 for each */ +/* call. sgenrand(seed) set initial values to the working area */ +/* of 624 words. Before genrand(), sgenrand(seed) must be */ +/* called once. (seed is any 32-bit integer except for 0). */ +/* Coded by Takuji Nishimura, considering the suggestions by */ +/* Topher Cooper and Marc Rieffel in July-Aug. 1997. */ + +/* This library is free software; you can redistribute it and/or */ +/* modify it under the terms of the GNU Library General Public */ +/* License as published by the Free Software Foundation; either */ +/* version 2 of the License, or (at your option) any later */ +/* version. */ +/* This library is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +/* See the GNU Library General Public License for more details. */ +/* You should have received a copy of the GNU Library General */ +/* Public License along with this library; if not, write to the */ +/* Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */ +/* 02111-1307 USA */ + +/* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. */ +/* Any feedback is very welcome. For any question, comments, */ +/* see http://www.math.keio.ac.jp/matumoto/emt.html or email */ +/* matumoto@math.keio.ac.jp */ + +/* Period parameters */ +#define MT_N 624 +#define MT_M 397 +#define MATRIX_A 0x9908b0df /* constant vector a */ +#define UPPER_MASK 0x80000000 /* most significant w-r bits */ +#define LOWER_MASK 0x7fffffff /* least significant r bits */ + +/* Tempering parameters */ +#define TEMPERING_MASK_B 0x9d2c5680 +#define TEMPERING_MASK_C 0xefc60000 +#define TEMPERING_SHIFT_U(y) (y >> 11) +#define TEMPERING_SHIFT_S(y) (y << 7) +#define TEMPERING_SHIFT_T(y) (y << 15) +#define TEMPERING_SHIFT_L(y) (y >> 18) + +static unsigned long mt[MT_N]; /* the table for the state vector */ +static int mti=MT_N+1; /* mti==MT_N+1 means mt[MT_N] is not initialized */ + +/* initializing the table with a NONZERO seed */ +void sgenrand(unsigned long seed) +{ + /* setting initial seeds to mt[MT_N] using */ + /* the generator Line 25 of Table 1 in */ + /* [KNUTH 1981, The Art of Computer Programming */ + /* Vol. 2 (2nd Ed.), pp102] */ + mt[0]= seed & 0xffffffff; + for (mti=1; mti= MT_N) { /* generate MT_N words at one time */ + int kk; + + if (mti == MT_N+1) /* if sgenrand() has not been called, */ + sgenrand(4357); /* a default initial seed is used */ + + for (kk=0;kk> 1) ^ mag01[y & 0x1]; + } + for (;kk> 1) ^ mag01[y & 0x1]; + } + y = (mt[MT_N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK); + mt[MT_N-1] = mt[MT_M-1] ^ (y >> 1) ^ mag01[y & 0x1]; + + mti = 0; + } + + y = mt[mti++]; + y ^= TEMPERING_SHIFT_U(y); + y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B; + y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C; + y ^= TEMPERING_SHIFT_L(y); + + return y; +} + +double double_genrand() { + return genrand() * (1.0/4294967295.0); +} + +// ******************************************************* + +void generate_message(void *data, int size, int n_field) +{ + if (n_field==8 || n_field==16) { + int *p = (int *)data; + size >>=2; + int i; + for (i=0; i>=1; + int i; + for (i=0; i>=2; + int res=0; + int i; + for (i=0; i2) S = atoi(argv[2])*n_field*4; + if (argc>3) nb_bloc = atoi(argv[3]); + if (argc>4) nb_time = atoi(argv[4]); + + // print parameters + printf("[parameters]\n"); + printf("GF 2^%d\n", n_field); + + printf("packet size = %d Byte\n", S); + printf("number of packets = %d (%f KB)\n", nb_bloc, get_KB(nb_bloc * S)); + printf("number of time = %d\n", nb_time); + printf("\n"); + + // **************************************** + // **************************************** + printf("[initialisation (memory + randomness)]\n"); + tick = clock(); + + // init field + fill_table(n_field); + + // this is the memory for the packet and their positions + void *source; + void *destination; + int *coeff; + + source = malloc(S*nb_bloc); + destination = malloc(S*nb_bloc); + coeff = malloc(nb_bloc*sizeof(int)); + + // init random number generator + // sgenrand(time(NULL)); + sgenrand(123); + + // Generate the random message + generate_message(source, S*nb_bloc, n_field); + for (i=0; i 1000 +#pragma once +#endif + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we should wrap include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#ifdef __cplusplus +extern "C" { +#endif +# include +#ifdef __cplusplus +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS ] + + +#endif // _MSC_STDINT_H_ ] diff --git a/CUETools.CLParity/fastdecode/test_rs.c b/CUETools.CLParity/fastdecode/test_rs.c new file mode 100644 index 0000000..96ca4e8 --- /dev/null +++ b/CUETools.CLParity/fastdecode/test_rs.c @@ -0,0 +1,1228 @@ +// Reed-Solomon encoding/erasure decoding + +// Implementation of the algorithms described in +// Efficient erasure decoding of Reed-Solomon codes +// http://arxiv.org/abs/0901.1886v1 + +// (c) 2009 Frederic didier. +// Any feedback is very welcome. For any question, comments, +// see http://algo.epfl.ch/~didier/reed_solomon.html or email +// frederic.didier@epfl.ch + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS +// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +// TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +// OF SUCH DAMAGE. +// + +// ************************************************ +// ************************************************ + +#include "reed_solomon.h" +#include "stdlib.h" +#include "stdio.h" + +int n_field; +int n_walsh; +int N_field; +int N_walsh; +int modulo; + +symbol *log_table; +symbol *exp_table; + +symbol *product; +symbol *lagrange; +symbol *product_enc; + +symbol *log_walsh; +symbol *pos; +symbol *upos; + +// ************************************************ +// ************************************************ + +// compute the tables for the finite field operations +// exp_table is twice the needed size so we do not need to +// perform a modulo each time. + +// list of some primitive polynomials +int primitive[] = { + 0,1,6, + 0,3,7, + 0,2,3,4,8, + 0,4,9, + 0,3,10, + 0,2,11, + 0,1,4,6,12, + 0,1,3,4,13, + 0,1,11,12,14, + 0,1,15, + 0,1,3,12,16, + 0,3,17, + 0,3,20, + 0,3,25, + 100 // fallback +}; + +// will be set to the primitive poly of the field +// used only by the fast algorithm version +int *poly; +int weight; + +void fill_table() +{ + int i; + for (i=0; i=n_field) break; + pos++; + } + + // used for the fast version only + poly = &primitive[temp]; + weight = pos-temp; + + if (primitive[pos]!=n_field) { + printf("primitive poly for GF %d not found !\n", n_field); + } + + // clock the lfsr (multiply by X) + int state=1; + for (i=0; i>n_field) state^=mask; + if (state>>n_field!=0) exit(0); + } + + // usefull since later + // log_table[1] = modulo + exp_table[2*modulo]=1; +} + +// ************************************************ +// ************************************************ + +// Perform a Walsh transform and keep the coeffs mod (modulo) +// The transformation is involutive if N_walsh = N_field. +void walsh_mod(symbol *vect) +{ + int i,j,step; + step=1; + while (step>n_field); + b = (b & modulo) + (b>>n_field); + + vect[i]=a; + vect[i+step]=b; + + i++; + } + i+=step; + } + step<<=1; + } +} + +void code_init(int nf, int nw) +{ + int i; + + n_field = nf; + n_walsh = nw; + if (n_field>31 || n_walsh > n_field) { + printf("incorrect field parameters\n"); + exit(0); + } + + N_field = 1< 16 + // otherwise int is ok. + for (i=0; imodulo) t-= modulo; + product[j] = t; + } + } +} + +// ******************************************************* +// ******************************************************* + +// compute one redundancy piece +// this is the heart of the encoding/decoding complexity + +// [data] contain the [K] known pieces and the log of the coefficients +// [positions] contain their positions in the codeword +// [x] is the index of the piece we want to compute +// [output] is where we will write the result + +// both functions are almost identical +// but it is usefull to have two for profiling + +void quadratic_enc(int K, int S, symbol *data, symbol *output, int x) +{ + int i,j; + int m = product_enc[x]; + + // first time we overwrite output + { + // the second substraction can also + // go into quadratic_init + int t = m - log_table[x] - product_enc[0]; + if (t<0) t+= modulo; + if (t<0) t+= modulo; + + // we set table[0] = 0 + // because 0 correspond to a null coefficient + // and not to a logarithm of 0. + symbol *table = &exp_table[t]; + t = table[0]; + table[0]=0; + + symbol *o = output; + + for (j=0; j=K) + lagrange[i] = exp_table[modulo - log_table[p ^ upos[i]] + log_table[p ^ x]]; + } + lagrange[x-K]=p^x; + } else { + // we want a 0 at old_pos (we have a 1 now) + // we want a 1 at x + + // put the 0 + for (i=0; i=K) + lagrange[i] ^= exp_table[modulo - log_table[p ^ upos[i]] + log_table[p ^ old_pos]]; + } + + // rescale to get the one + int c = lagrange[x-K]; + upos[x-K]=p; + lagrange[x-K]=p ^ old_pos; + + for (i=0; i>j)&1; + } + + // precompute the Walsh transforms of the inverse + walsh_field(inverse); +} + +void fast_clear() +{ + free(codeword); + free(coeff); + free(inverse); +} + +// ******************************************************* +// ******************************************************* + +// compute field product of the vector coeff and inverse +// for each [n_field] consecutive int of [inverse] and [coeff] +// multiply them as if they were element of the field in the +// standard basis. +// +// the difference is instead of coefficients in GF_2, +// the coefficients are in Z ... +// +// The other limiting part in the complexity (with walsh_field). +// The multiplication is quadratic in n_field +// and is performed N_walsh time. + +void field_product() +{ + int i,j,k; + symbol s[64]; + + symbol *inv = inverse; + + for (k=0; k>j)&1; + } + } + + // compute the Walsh transforms of the coefficient + walsh_field(coeff); + + // multiply with precomputed Walsh transform of the inverse + field_product(); + + // walsh transform again + walsh_field(coeff); + + // final multiplication by the product + for (i=0; i> n_walsh) &1 ) << j; + } + + if (t) { + res[i] = exp_table[log_table[t] + product[i]]; + } + } + } +} + +// ******************************************************* +// ******************************************************* + +void fast_encode(int N, int K, int S, symbol *data, symbol *packets) +{ + int i,j; + + // fill pos + for (i=0; i the number of symbols transmitted +% k = the number of code symbols that is going to be codes to a n symbol message +% t = the number of errors that can be found + corrected + +%Tripple-error-correcting Reed-Solomon code with symbols from GF(2^4) +% Lin & Costello p.175 and article: Reed_Solomon Codes by Joel Sylvester + +%generator polynomial + +%field = gftuple([-1:2^m-2]', m, 2); + +%p = 2; m = 4; +%primpoly = [0 0 -Inf -Inf 0]; +%field = gftuple([-1:p^m-2]',primpoly,p); + + +%Lin + Costello, p.171 + + +%Encoder (Article) +%shift codeword by X^(n-k) +for ii = 1:n-k + shiftpol(ii) = -Inf; +end +shiftpol(n-k+1) = 0; +shiftcode = gfconv(code,shiftpol,field); + + +%divide shifted codeword by g(x) +[Q, R] = GFDECONV(shiftcode, g, field); + +while length(R) < n-k + R = [R -inf]; +end + +%for ii = 1:n-k +% CON(ii) = -Inf; +% if length(R) >= ii +% CON(ii) = gfadd(R(ii),CON(ii),field); +% end +%end + +%%concatenate the parity to the data +%message = [CON code]; diff --git a/CUETools.CLParity/matlab/RS_E_E_DEC.m b/CUETools.CLParity/matlab/RS_E_E_DEC.m new file mode 100644 index 0000000..28c66d4 --- /dev/null +++ b/CUETools.CLParity/matlab/RS_E_E_DEC.m @@ -0,0 +1,229 @@ +%h = n - k = npar +%t = h / 2 + +function DECODED = RS_E_E_DEC(received, erasures,n,k,t,h,g,field); + +%Check for decoding failures +%Previous decoder RS_E_E_DEC4 + +%**************** +%*** Decoding *** +%**************** + +%syndrome calculation +S = []; +%Subtitute alpha^i in received polynomial - Lin + Costello p.152 eq. 6.13 +for ii = 1:2*t + S(ii)= -Inf; + for cc = 1:n + S(ii) = gfadd(S(ii),gfmul(received(cc),gfpow(ii,cc-1,n),field),field); %Sum all the terms + end +end +%S + +%Test if syndrome = 0, if syndrome equals 0, assume that no errors occured +for i = 1:2*t + test_pol(i) = -Inf; +end + +if all (S == test_pol) + + message = received; + + for i = 1:n + if message(i) < 0 + message(i) = -Inf; + end + end + +else + + + %Compute the erasure locator polynomial: + erasures_pos = erasures - 1; + num_erasures = length(erasures); + + %Compute the erasure-locator polynomial + erasure_loc_pol = 0; + for i = 1:length(erasures_pos) + erasure_loc_pol = gfconv(erasure_loc_pol, [0 erasures_pos(i)],field); + end + + %Compute modified syndrome polynomial: + S_pol = [-inf S]; + dividend = gfconv(erasure_loc_pol,gfadd(0,S_pol,field),field); + dividend = gfadd(dividend,0,field); + + + divisor = []; + for i = 1:2*t+2 + divisor(i) = -Inf; + end + divisor(2*t+2) = 0; + + [q,mod_syn] = gfdeconv(dividend,divisor,field); + + while length(mod_syn) < h+1 + mod_syn = [mod_syn -Inf]; + end + + S_M = []; + for i = 1:h - num_erasures + S_M(i) = mod_syn(i + num_erasures + 1); + end + + flag = 0; + if isempty(S_M) == 1 + flag = 0; + else + for i = 1:length(S_M) + if (S_M(i) ~= -Inf) + flag = 1; %Other errors occured in conjunction with erasures + end + end + end + + + + %Find error-location polynomial sigma (Berlekamp's iterative algorithm - + %sigma = [0 7 4 6] + if (flag == 1) + %sigma = M_B2(n,k,length(S_M) - 1,S_M,field); + + + num_iter = t - num_erasures/2; + + + sigma = massey_berlekamp_M3(n,k,num_iter,S_M,field); + + %Chien search + %step 3 from Lin + Costello p.175 + %the error locating polynomial have a maximum of t entries + error_loc = []; + kk = 0; + + for ii = 0:n-1 + error_r = -Inf; + for cc = 1:length(sigma) + error_r = gfadd(error_r,gfmul(sigma(cc),gfpow(ii,cc-1,n),field),field); %Sum all the terms + end + if error_r == -Inf + kk = kk + 1; + error_loc(kk) = ii; + end + end + + + % Test if the roots are distinct + % Form a test polynomial by multiplying the roots of error_loc with each other + % Divide the error_loc pol by test pol + % if the degree of the quotient exceeds a constant, then the roots are + % not distinct + + test_pol = 0; + for ii = 1:length(error_loc) + test_pol = gfconv(test_pol,[error_loc(ii) 0],field); + end + + %test_pol + %error_loc + %sigma + + [QQ,RR] = gfdeconv(sigma,test_pol,field); + if length(QQ) > 1 + DECODED = received; + return + end + + + + + + comp_error_locs = []; + %Take reciprocals of elements in error_loc - error location numbers + for ii = 1:length(error_loc) + comp_error_locs(ii) = gfdiv(0,error_loc(ii),field); + end + %error_loc_p %places where errors occur + else + sigma = 0; + comp_error_locs = []; + end + + + + + + + + %Calculate error magnitudes - Forney algorithm? + %Step 4. Lin and Costello - This program uses another algorithm from: + % drake.ee.washington.edu/~adina/rsc/slide/node9.html + % http://www.ee.ucla.edu/~matache/rsc/slide.html + %Compute the error magnitude polynomial: + %1. Form the function [1 + S(x)] + + SS(1) = 0; + for ii = 1: 2*t + SS(ii+1) = S(ii); + end + + %SS + + + %2. form the product of SS and the KEY Equation + %OMEGA = gfconv(SS,sigma,field); + OMEGA = gfconv(sigma,gfadd(0,mod_syn,field),field); + + + + %3. OMEGA = (SS * sigma)mod(x^(2t+1)) + %3.1. Form a function := x^(2t+1) + for ii = 1: (2*t) + DIV(ii)= -Inf; + end + DIV(2*t+1) = 0; + + + %3.2. OMEGA = (SS * sigma)mod(x^(2t+1)) + [DUMMY, OMEGA] = gfdeconv(OMEGA,DIV,field); + %OMEGA + + %4. Differentiate the key equation with respect to x + %sigma_diff = gfdiff(sigma); + tsi = gfconv(sigma,erasure_loc_pol,field); + tsi_diff = gfdiff(tsi); + + e_e_places = [erasures_pos comp_error_locs]; + + %Calculate the error magnitudes + %Substitute the inverse into sigma_diff + for ii = 1:length(e_e_places) + %error_loc_p(ii) + ERR_DEN = gfsubstitute(tsi_diff,gfdiv(0,e_e_places(ii),field),length(tsi_diff),n,field); + ERR_NUM = gfsubstitute(OMEGA,gfdiv(0,e_e_places(ii),field),length(OMEGA),n,field); + ERR_NUM = gfmul(ERR_NUM,e_e_places(ii),field); + ERR(ii) = gfmul(ERR_NUM,gfdiv(0,ERR_DEN,field),field); + end + + %error_loc_p + %ERR + + %Determine introduced error + for ii = 1:n + ERR_p(ii) = -Inf; + end + + %Error - t must be substituted by amount of errors + for ii = 1:length(e_e_places) + pp = e_e_places(ii); + ERR_p(pp+1) = ERR(ii); + end + + %ERR_p + + message = gfadd(received,ERR_p,field); + +end + +DECODED = message; \ No newline at end of file diff --git a/CUETools.CLParity/matlab/gfdiff.m b/CUETools.CLParity/matlab/gfdiff.m new file mode 100644 index 0000000..b4863bc --- /dev/null +++ b/CUETools.CLParity/matlab/gfdiff.m @@ -0,0 +1,14 @@ +function diff = gfdiff(polynomial) + +%use: diff = gfdiff(polynomial) +%Differentiate polynomial with respect to x +l = length(polynomial); + +for cc = 2:l + %cc-1 represents the power of x + if mod(cc-1,2) == 0 %all the even powers are zero because of GF(2) + diff(cc-1) = -Inf; + else + diff(cc-1) = polynomial(cc); + end +end \ No newline at end of file diff --git a/CUETools.CLParity/matlab/gfpow.m b/CUETools.CLParity/matlab/gfpow.m new file mode 100644 index 0000000..510aff7 --- /dev/null +++ b/CUETools.CLParity/matlab/gfpow.m @@ -0,0 +1,4 @@ +function a = gfpow(value,p,n) +%a = gfpow(alpha,p,n) +%alpha^value, (alpha^value)^p and n = 2^m- in Galois field +a = mod(value*p,n); \ No newline at end of file diff --git a/CUETools.CLParity/matlab/gfsubstitute.m b/CUETools.CLParity/matlab/gfsubstitute.m new file mode 100644 index 0000000..943a5d2 --- /dev/null +++ b/CUETools.CLParity/matlab/gfsubstitute.m @@ -0,0 +1,11 @@ +function sum = gfsubstitute(polynomial,value,terms,n,field) + +%use: gfsubstitute(polynomial,value,terms,n,field) +%Subtitute i^value in polynomial +%the number of terms in polynomial +%n = n of the decoder + +sum = polynomial(1); +for cc = 2:terms + sum = gfadd(sum,gfmul(polynomial(cc),gfpow(value,cc-1,n),field),field); %Sum all the terms +end diff --git a/CUETools.CLParity/matlab/massey_berlekamp_M3.m b/CUETools.CLParity/matlab/massey_berlekamp_M3.m new file mode 100644 index 0000000..66132e3 --- /dev/null +++ b/CUETools.CLParity/matlab/massey_berlekamp_M3.m @@ -0,0 +1,106 @@ +function sigma = massey_berlekamp_M2(n,k,t,S,field) + +%http://www.ee.ucla.edu/~matache/rsc/node8.html#SECTION00051000000000000000 + +%Step 2: Initialize variables +kk = 0; + + + +for i = 1:n + Kappa(1,i) = -Inf; +end +Kappa(1,1) = 0; + +%Kappa + + + +LAMBDA = 0; +Tau = [-inf 0]; + +done = 0; + +%Step 3: +while (done ~= 1) + %disp('K'); + + kk = kk + 1; + + %disp('S(kk)'); + %S(kk) + + %disp('LAMBDA') + %LAMBDA + + sum = -Inf; + for i = 1:LAMBDA + %Kappa(kk,i+1) + %S(kk-i) + sum = gfadd(sum,gfmul(Kappa(kk,i+1),S(kk-i),field),field); + end + + %disp('Delta - sum') + %sum + + delta(kk) = gfadd(S(kk),sum,field); + + %disp('delta'); + %delta + + %Step 4: + if (delta(kk) == -Inf) + for i = 1:n + Kappa(kk+1,i) = Kappa(kk,i); + end + end + + + if (delta(kk) ~= -Inf) + + for i = 1:n + Kappa_i(i) = Kappa(kk-1+1,i); + end + + Kappa_k = gfadd(Kappa_i,gfconv(delta(kk),Tau,field),field); + + while length(Kappa_k) < n + Kappa_k = [Kappa_k -Inf]; + end + + for i = 1:length(Kappa_k) + Kappa(kk+1,i) = Kappa_k(i); + end + + + %Step 7: + if (2*LAMBDA < kk) + LAMBDA = kk - LAMBDA; + + for i = 1:n + Kappa_k(i) = Kappa(kk+1-1,i); + end + + Tau = gfconv(Kappa_k,gfdiv(0,delta(kk),field),field); + end + end + + %Step 8: + Tau = gfconv([-Inf 0],Tau,field); + + %step 9: + if kk >= 2*t + done = 1; + end + + %Kappa + %LAMBDA + %Tau + + +end + + +for i = 1:n + sigma(i) = Kappa(kk+1,i); +end \ No newline at end of file diff --git a/CUETools.CLParity/parity.cl b/CUETools.CLParity/parity.cl new file mode 100644 index 0000000..7b1308d --- /dev/null +++ b/CUETools.CLParity/parity.cl @@ -0,0 +1,199 @@ +/** + * CUETools.CLParity: Reed-Solomon (32 bit) using OpenCL + * Copyright (c) 2010 Gregory S. Chudov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define WARP_SIZE 32 + +int +galois_mul(int x, int y) +{ + const int poly = 00020000007; + int prod = 0; + +//#pragma unroll 0 + for (int i = 0; i < 4; i++) + { + if (x & 1) prod ^= y; + y = (y << 1) ^ ((y >> 31) ? poly : 0); + if (x & 2) prod ^= y; + y = (y << 1) ^ ((y >> 31) ? poly : 0); + if (x & 4) prod ^= y; + y = (y << 1) ^ ((y >> 31) ? poly : 0); + if (x & 8) prod ^= y; + y = (y << 1) ^ ((y >> 31) ? poly : 0); + if (x & 16) prod ^= y; + y = (y << 1) ^ ((y >> 31) ? poly : 0); + if (x & 32) prod ^= y; + y = (y << 1) ^ ((y >> 31) ? poly : 0); + if (x & 64) prod ^= y; + y = (y << 1) ^ ((y >> 31) ? poly : 0); + if (x & 128) prod ^= y; + y = (y << 1) ^ ((y >> 31) ? poly : 0); + x >>= 8; + } + return prod; +} + +__kernel __attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) +void reedSolomonInit(__global int *encodeGx0, __global int *encodeGx1, __global int *parity0, __global int *parity1, int npar) +{ + int i = get_group_id(0) * GROUP_SIZE + get_local_id(0); + parity0[i] = parity1[i] = 0; + encodeGx0[i] = encodeGx1[i] = (i == npar - 1 ? 1 : 0); + if (i < GROUP_SIZE) encodeGx0[npar + i] = encodeGx1[npar + i] = 0; + if (i == 0) parity0[npar] = parity1[npar] = 0; +} + +__kernel __attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) +void reedSolomonInitGx(__global int *exp, __global int *old_encodeGx, __global int *new_encodeGx, int npar, int step) +{ + int tid = get_local_id(0); + int i = get_group_id(0) * (GROUP_SIZE / 2) + tid; + __local int gx[GROUP_SIZE]; + __local int ex[GROUP_SIZE / 2]; + + gx[tid] = old_encodeGx[i]; + if (tid < GROUP_SIZE / 2) ex[tid] = exp[step * (GROUP_SIZE / 2) + tid]; + barrier(CLK_LOCAL_MEM_FENCE); + for (int s = 0; s < GROUP_SIZE / 2; s++) + { + int p = tid + s < (GROUP_SIZE - 1) ? galois_mul(gx[tid], ex[s]) ^ gx[tid + 1] : 0; + barrier(CLK_LOCAL_MEM_FENCE); + gx[tid] = p; + barrier(CLK_LOCAL_MEM_FENCE); + } + barrier(CLK_LOCAL_MEM_FENCE); + if (tid < GROUP_SIZE / 2) new_encodeGx[i] = gx[tid]; +} + +__kernel __attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) +void reedSolomonA(__global int* data, __global int*encodeGx, __global int*old_parity, int npar, int offset) +{ + int tid = get_local_id(0); + __local int ib[GROUP_SIZE]; + __local int gx[GROUP_SIZE]; + + ib[tid] = data[offset + tid] ^ old_parity[tid]; + gx[tid] = encodeGx[tid]; + barrier(CLK_LOCAL_MEM_FENCE); + + for (int s = 0; s < GROUP_SIZE; s++) + { + if (tid > s) + ib[tid] ^= galois_mul(ib[s], gx[tid - 1 - s]); + barrier(CLK_LOCAL_MEM_FENCE); + } + + data[offset + tid] = ib[tid]; +} + +__kernel __attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) +void reedSolomonB(__global int* data, __global int* encodeGx, __global int* parity, int npar, int offset) +{ + __local int ib[GROUP_SIZE]; + __local int gx[GROUP_SIZE * 2]; + int tid = get_local_id(0); + int i = (get_group_id(0) * GROUP_SIZE) + get_local_id(0); + ib[tid] = data[offset + tid]; + gx[tid] = encodeGx[i]; + gx[tid + GROUP_SIZE] = i + GROUP_SIZE >= npar ? 0 : encodeGx[i + GROUP_SIZE]; + barrier(CLK_LOCAL_MEM_FENCE); + + int p = i + GROUP_SIZE >= npar ? 0 : parity[i + GROUP_SIZE]; + for (int s = 0; s < GROUP_SIZE; s++) + p ^= galois_mul(ib[s], gx[tid + GROUP_SIZE - 1 - s]); + parity[i] = p; +} + +__kernel __attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) +void reedSolomon(__global int*data, __global int*encodeGx, __global int*old_parity, __global int *new_parity, int npar, int offset) +{ + int tid = get_local_id(0); + int i = (get_group_id(0) * GROUP_SIZE) + get_local_id(0); + __local int old[GROUP_SIZE]; + __local int ib; + if (tid == 0) + ib = old_parity[0] ^ data[offset]; + if (tid == 0) + old[GROUP_SIZE - 1] = old_parity[i + GROUP_SIZE]; + else + old[tid - 1] = old_parity[i]; + barrier(CLK_LOCAL_MEM_FENCE); + new_parity[i] = old[tid] ^ galois_mul(ib, encodeGx[i]); + //new_parity[i] = old_parity[i + 1] ^ galois_mul(ib, encodeGx[i]); +} + +__kernel __attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) +void reedSolomonDecodeInit(__global int* data, int dataLen, __global int*expTbl, __global int*syn, int npar) +{ + int i = (get_group_id(0) * GROUP_SIZE) + get_local_id(0); + syn[i] = 0; +} + +__kernel __attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) +void reedSolomonDecode(__global int* data, int dataLen, __global int*expTbl, __global int*syn, int npar) +{ + int tid = get_local_id(0); + int i = (get_group_id(0) * GROUP_SIZE) + get_local_id(0); + __local int ds[GROUP_SIZE]; + + ds[tid] = data[tid]; + barrier(CLK_LOCAL_MEM_FENCE); + + int wk = syn[i]; + int ai = expTbl[i]; + + for (int s = 0; s < GROUP_SIZE; s++) + wk = ds[s] ^ galois_mul(wk, ai); + + syn[i] = wk; +} + +int galois_exp(int t, int n) +{ + int e = 1; + for (int i = 0; i < 32; i++) + { + if ((n >> i) & 1) e = galois_mul(e, t); + t = galois_mul(t, t); + } + return e; +} + +__kernel __attribute__((reqd_work_group_size(GROUP_SIZE, 1, 1))) +void chienSearch(__global int *wk_out, int pos, __global int *sigma, int jisu, int n) +{ + const int poly = 00020000007; + const int oneByTwo = (poly >> 1) | (1 << 31); + int tid = get_local_id(0); + int i = (get_group_id(0) * GROUP_SIZE) + get_local_id(0); + int zexp = galois_exp(oneByTwo, i + pos); + int wk = 1; + int jzexp = 1; + __local int sj; + + for (int j = 1; j <= jisu; j++) + { + jzexp = galois_mul(jzexp, zexp); + if (tid == 0) sj = sigma[j]; + barrier(CLK_LOCAL_MEM_FENCE); + wk ^= galois_mul(sj, jzexp); // wk ^= sigma[j] / 2^(ij); + barrier(CLK_LOCAL_MEM_FENCE); + } + wk_out[i] = wk; +} diff --git a/CUETools.CTDB.Converter/CUETools.CTDB.Converter.csproj b/CUETools.CTDB.Converter/CUETools.CTDB.Converter.csproj index 0feff43..7c0545a 100644 --- a/CUETools.CTDB.Converter/CUETools.CTDB.Converter.csproj +++ b/CUETools.CTDB.Converter/CUETools.CTDB.Converter.csproj @@ -1,73 +1,30 @@ - - + + - Debug - x86 - 8.0.30703 - 2.0 - {F8C29953-A697-4462-82DC-DA7146654A64} - Exe - Properties - CUETools.CTDB.Converter + net40;net20;netcoreapp2.0 + 2.1.6.0 CUETools.CTDB.Converter - v2.0 - - - 512 + CUETools.CTDB.Converter + CUETools + Exe + A tool for CTDB database files conversion. + Copyright (c) 2008-2018 Grigory Chudov + Grigory Chudov + true + ..\bin\$(Configuration)\ + https://github.com/gchudov/cuetools.net + git + - - true - bin\Debug\ - DEBUG;TRACE - full - AnyCPU - bin\Debug\CUETools.CTDB.Converter.exe.CodeAnalysisLog.xml - true - GlobalSuppressions.cs - prompt - MinimumRecommendedRules.ruleset - ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets - false - ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules - false - - - ..\bin\Release\ - TRACE - true - pdbonly - AnyCPU - bin\Release\CUETools.CTDB.Converter.exe.CodeAnalysisLog.xml - true - GlobalSuppressions.cs - prompt - MinimumRecommendedRules.ruleset - ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets - false - ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules - false - - - - - - - - - - - - - {ECEB839C-171B-4535-958F-9899310A0342} - CUETools.Parity + + + + False + + + + - - - \ No newline at end of file + + diff --git a/CUETools.CTDB.Converter/Properties/AssemblyInfo.cs b/CUETools.CTDB.Converter/Properties/AssemblyInfo.cs deleted file mode 100644 index 0acd0f7..0000000 --- a/CUETools.CTDB.Converter/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -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("CUETools.CTDB.Converter")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CUETools.CTDB.Converter")] -[assembly: AssemblyCopyright("Copyright © 2011")] -[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("b6155a69-7207-4214-ad24-7737b8b1868a")] - -// 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/CUETools.CTDB.EACPlugin/CUETools.CTDB.EACPlugin.csproj b/CUETools.CTDB.EACPlugin/CUETools.CTDB.EACPlugin.csproj index 4841539..b780faa 100644 --- a/CUETools.CTDB.EACPlugin/CUETools.CTDB.EACPlugin.csproj +++ b/CUETools.CTDB.EACPlugin/CUETools.CTDB.EACPlugin.csproj @@ -51,18 +51,6 @@ 4 AllRules.ruleset - - - False - .\Interop.HelperFunctionsLib.dll - False - - - - - - - Form @@ -116,24 +104,6 @@ Resources.Designer.cs - - - {5802C7E9-157E-4124-946D-70B5AE48A5A1} - CUETools.AccurateRip - - - {1DD41038-D885-46C5-8DDE-E0B82F066584} - CUETools.CDImage - - - {6458A13A-30EF-45A9-9D58-E5031B17BEE2} - CUETools.Codecs - - - {AA2A9A7E-45FB-4632-AD85-85B0E556F818} - CUETools.CTDB - - @@ -163,6 +133,42 @@ + + + .\Interop.HelperFunctionsLib.dll + True + + + + + + + + + {5802c7e9-157e-4124-946d-70b5ae48a5a1} + CUETools.AccurateRip + + + {1dd41038-d885-46c5-8dde-e0b82f066584} + CUETools.CDImage + + + {6458a13a-30ef-45a9-9d58-e5031b17bee2} + CUETools.Codecs + + + {c36efaa5-4f81-4a29-800d-ba866ff13bc8} + CUETools.CTDB.Types + + + {aa2a9a7e-45fb-4632-ad85-85b0e556f818} + CUETools.CTDB + + + {eceb839c-171b-4535-958f-9899310a0342} + CUETools.Parity + + - \ No newline at end of file + + diff --git a/CUETools.CTDB/CUETools.CTDB.csproj.bak b/CUETools.CTDB/CUETools.CTDB.csproj.bak new file mode 100644 index 0000000..1a5a1d1 --- /dev/null +++ b/CUETools.CTDB/CUETools.CTDB.csproj.bak @@ -0,0 +1,50 @@ + + + + net40;net20;netstandard2.0 + 2.1.6.0 + CUETools.CTDB + CUETools.CTDB + CUETools + A library for accessing CUETools Database. + Copyright (c) 2008-2018 Grigory Chudov + Grigory Chudov + true + ..\bin\$(Configuration)\ + https://github.com/gchudov/cuetools.net + git + + + + + + False + + + + + + + + ..\bin\Release\net20\CUETools.CTDB.Types.XmlSerializers.dll + + + + + + + ..\bin\Release\net40\CUETools.CTDB.Types.XmlSerializers.dll + + + + + + + + + + + + + + diff --git a/CUETools.CTDB/CUEToolsDB.cs b/CUETools.CTDB/CUEToolsDB.cs index 63597d5..57668c6 100644 --- a/CUETools.CTDB/CUEToolsDB.cs +++ b/CUETools.CTDB/CUEToolsDB.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Globalization; using System.IO; -using System.Management; using System.Net; using System.Security.Cryptography; using System.Text; @@ -11,6 +10,13 @@ using System.Xml.Serialization; using CUETools.AccurateRip; using CUETools.CDImage; using CUETools.Parity; +#if NET20 +using System.Management; +#else +using DeviceId; +using DeviceId.Encoders; +using DeviceId.Formatters; +#endif using Krystalware.UploadHelper; namespace CUETools.CTDB @@ -98,9 +104,9 @@ namespace CUETools.CTDB this.QueryExceptionMessage = resp.StatusDescription; if (this.QueryResponseStatus == HttpStatusCode.OK) { - //XmlSerializer serializer = new XmlSerializer(typeof(CTDBResponse)); - XmlSerializer serializer = new Microsoft.Xml.Serialization.GeneratedAssembly.CTDBResponseSerializer(); - this.total = 0; + //var serializer = new XmlSerializer(typeof(CTDBResponse)); + var serializer = new Microsoft.Xml.Serialization.GeneratedAssembly.CTDBResponseSerializer(); + this.total = 0; using (Stream responseStream = resp.GetResponseStream()) { CTDBResponse ctdbResp = serializer.Deserialize(responseStream) as CTDBResponse; @@ -277,16 +283,27 @@ namespace CUETools.CTDB { if (uuidInfo == null) { +#if NET20 string id = "CTDB userid"; using (ManagementClass mc = new ManagementClass("Win32_ComputerSystemProduct")) foreach (ManagementObject mo in mc.GetInstances()) { - id = id + mo.Properties["UUID"].Value.ToString(); - break; - } - byte[] hashBytes = (new SHA1CryptoServiceProvider()).ComputeHash(Encoding.ASCII.GetBytes(id)); - uuidInfo = Convert.ToBase64String(hashBytes).Replace('+', '.').Replace('/', '_').Replace('=', '-'); - } + id = id + mo.Properties["UUID"].Value.ToString(); + break; + } + byte[] hashBytes = (new SHA1CryptoServiceProvider()).ComputeHash(Encoding.ASCII.GetBytes(id)); + uuidInfo = Convert.ToBase64String(hashBytes).Replace('+', '.').Replace('/', '_').Replace('=', '-'); +#else + uuidInfo = new DeviceIdBuilder() + .AddMachineName() +#if NET40 + .AddProcessorId() + .AddMotherboardSerialNumber() +#endif + .UseFormatter(new HashDeviceIdFormatter(() => SHA256.Create(), new Base64UrlByteArrayEncoder())) + .ToString(); +#endif + } return uuidInfo; } @@ -391,7 +408,8 @@ namespace CUETools.CTDB { using (Stream s = resp.GetResponseStream()) { - var serializer = new XmlSerializer(typeof(CTDBResponse)); + //var serializer = new XmlSerializer(typeof(CTDBResponse)); + var serializer = new Microsoft.Xml.Serialization.GeneratedAssembly.CTDBResponseSerializer(); return serializer.Deserialize(s) as CTDBResponse; } } diff --git a/CUETools.CTDB/GeneratedAssembly.cs b/CUETools.CTDB/GeneratedAssembly.cs new file mode 100644 index 0000000..b0744e7 --- /dev/null +++ b/CUETools.CTDB/GeneratedAssembly.cs @@ -0,0 +1,1810 @@ +namespace Microsoft.Xml.Serialization.GeneratedAssembly { + + public class XmlSerializationWriter1 : System.Xml.Serialization.XmlSerializationWriter { + + public void Write15_ctdb(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"ctdb", @"http://db.cuetools.net/ns/mmd-1.0#"); + return; + } + TopLevelElement(); + Write8_CTDBResponse(@"ctdb", @"http://db.cuetools.net/ns/mmd-1.0#", ((global::CUETools.CTDB.CTDBResponse)o), true, false); + } + + public void Write16_CTDBResponseEntry(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"CTDBResponseEntry", @""); + return; + } + TopLevelElement(); + Write9_CTDBResponseEntry(@"CTDBResponseEntry", @"", ((global::CUETools.CTDB.CTDBResponseEntry)o), true, false); + } + + public void Write17_CTDBResponseMeta(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"CTDBResponseMeta", @""); + return; + } + TopLevelElement(); + Write14_CTDBResponseMeta(@"CTDBResponseMeta", @"", ((global::CUETools.CTDB.CTDBResponseMeta)o), true, false); + } + + public void Write18_CTDBResponseMetaImage(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"CTDBResponseMetaImage", @""); + return; + } + TopLevelElement(); + Write10_CTDBResponseMetaImage(@"CTDBResponseMetaImage", @"", ((global::CUETools.CTDB.CTDBResponseMetaImage)o), true, false); + } + + public void Write19_CTDBResponseMetaLabel(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"CTDBResponseMetaLabel", @""); + return; + } + TopLevelElement(); + Write12_CTDBResponseMetaLabel(@"CTDBResponseMetaLabel", @"", ((global::CUETools.CTDB.CTDBResponseMetaLabel)o), true, false); + } + + public void Write20_CTDBResponseMetaRelease(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"CTDBResponseMetaRelease", @""); + return; + } + TopLevelElement(); + Write13_CTDBResponseMetaRelease(@"CTDBResponseMetaRelease", @"", ((global::CUETools.CTDB.CTDBResponseMetaRelease)o), true, false); + } + + public void Write21_CTDBResponseMetaTrack(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"CTDBResponseMetaTrack", @""); + return; + } + TopLevelElement(); + Write11_CTDBResponseMetaTrack(@"CTDBResponseMetaTrack", @"", ((global::CUETools.CTDB.CTDBResponseMetaTrack)o), true, false); + } + + void Write11_CTDBResponseMetaTrack(string n, string ns, global::CUETools.CTDB.CTDBResponseMetaTrack o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMetaTrack)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMetaTrack", @""); + WriteAttribute(@"name", @"", ((global::System.String)o.@name)); + WriteAttribute(@"artist", @"", ((global::System.String)o.@artist)); + WriteElementString(@"extra", @"", ((global::System.String)o.@extra)); + WriteEndElement(o); + } + + void Write13_CTDBResponseMetaRelease(string n, string ns, global::CUETools.CTDB.CTDBResponseMetaRelease o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMetaRelease)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMetaRelease", @""); + WriteAttribute(@"date", @"", ((global::System.String)o.@date)); + WriteAttribute(@"country", @"", ((global::System.String)o.@country)); + WriteEndElement(o); + } + + void Write12_CTDBResponseMetaLabel(string n, string ns, global::CUETools.CTDB.CTDBResponseMetaLabel o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMetaLabel)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMetaLabel", @""); + WriteAttribute(@"name", @"", ((global::System.String)o.@name)); + WriteAttribute(@"catno", @"", ((global::System.String)o.@catno)); + WriteEndElement(o); + } + + void Write10_CTDBResponseMetaImage(string n, string ns, global::CUETools.CTDB.CTDBResponseMetaImage o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMetaImage)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMetaImage", @""); + WriteAttribute(@"uri", @"", ((global::System.String)o.@uri)); + WriteAttribute(@"uri150", @"", ((global::System.String)o.@uri150)); + WriteAttribute(@"height", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@height))); + WriteAttribute(@"width", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@width))); + WriteAttribute(@"primary", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@primary))); + WriteEndElement(o); + } + + void Write14_CTDBResponseMeta(string n, string ns, global::CUETools.CTDB.CTDBResponseMeta o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMeta)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMeta", @""); + WriteAttribute(@"source", @"", ((global::System.String)o.@source)); + WriteAttribute(@"id", @"", ((global::System.String)o.@id)); + WriteAttribute(@"artist", @"", ((global::System.String)o.@artist)); + WriteAttribute(@"album", @"", ((global::System.String)o.@album)); + WriteAttribute(@"year", @"", ((global::System.String)o.@year)); + WriteAttribute(@"genre", @"", ((global::System.String)o.@genre)); + WriteAttribute(@"discnumber", @"", ((global::System.String)o.@discnumber)); + WriteAttribute(@"disccount", @"", ((global::System.String)o.@disccount)); + WriteAttribute(@"discname", @"", ((global::System.String)o.@discname)); + WriteAttribute(@"infourl", @"", ((global::System.String)o.@infourl)); + WriteAttribute(@"barcode", @"", ((global::System.String)o.@barcode)); + { + global::CUETools.CTDB.CTDBResponseMetaImage[] a = (global::CUETools.CTDB.CTDBResponseMetaImage[])o.@coverart; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write10_CTDBResponseMetaImage(@"coverart", @"", ((global::CUETools.CTDB.CTDBResponseMetaImage)a[ia]), false, false); + } + } + } + { + global::CUETools.CTDB.CTDBResponseMetaTrack[] a = (global::CUETools.CTDB.CTDBResponseMetaTrack[])o.@track; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write11_CTDBResponseMetaTrack(@"track", @"", ((global::CUETools.CTDB.CTDBResponseMetaTrack)a[ia]), false, false); + } + } + } + { + global::CUETools.CTDB.CTDBResponseMetaLabel[] a = (global::CUETools.CTDB.CTDBResponseMetaLabel[])o.@label; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write12_CTDBResponseMetaLabel(@"label", @"", ((global::CUETools.CTDB.CTDBResponseMetaLabel)a[ia]), false, false); + } + } + } + { + global::CUETools.CTDB.CTDBResponseMetaRelease[] a = (global::CUETools.CTDB.CTDBResponseMetaRelease[])o.@release; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write13_CTDBResponseMetaRelease(@"release", @"", ((global::CUETools.CTDB.CTDBResponseMetaRelease)a[ia]), false, false); + } + } + } + WriteElementString(@"extra", @"", ((global::System.String)o.@extra)); + WriteEndElement(o); + } + + void Write9_CTDBResponseEntry(string n, string ns, global::CUETools.CTDB.CTDBResponseEntry o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseEntry)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseEntry", @""); + WriteAttribute(@"id", @"", System.Xml.XmlConvert.ToString((global::System.Int64)((global::System.Int64)o.@id))); + WriteAttribute(@"crc32", @"", ((global::System.String)o.@crc32)); + WriteAttribute(@"confidence", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@confidence))); + WriteAttribute(@"npar", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@npar))); + WriteAttribute(@"stride", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@stride))); + WriteAttribute(@"hasparity", @"", ((global::System.String)o.@hasparity)); + WriteAttribute(@"parity", @"", ((global::System.String)o.@parity)); + WriteAttribute(@"syndrome", @"", ((global::System.String)o.@syndrome)); + WriteAttribute(@"trackcrcs", @"", ((global::System.String)o.@trackcrcs)); + WriteAttribute(@"toc", @"", ((global::System.String)o.@toc)); + WriteEndElement(o); + } + + void Write8_CTDBResponse(string n, string ns, global::CUETools.CTDB.CTDBResponse o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponse)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponse", @"http://db.cuetools.net/ns/mmd-1.0#"); + WriteAttribute(@"status", @"", ((global::System.String)o.@status)); + WriteAttribute(@"updateurl", @"", ((global::System.String)o.@updateurl)); + WriteAttribute(@"updatemsg", @"", ((global::System.String)o.@updatemsg)); + WriteAttribute(@"message", @"", ((global::System.String)o.@message)); + WriteAttribute(@"npar", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@npar))); + { + global::CUETools.CTDB.CTDBResponseEntry[] a = (global::CUETools.CTDB.CTDBResponseEntry[])o.@entry; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write2_CTDBResponseEntry(@"entry", @"http://db.cuetools.net/ns/mmd-1.0#", ((global::CUETools.CTDB.CTDBResponseEntry)a[ia]), false, false); + } + } + } + { + global::CUETools.CTDB.CTDBResponseMeta[] a = (global::CUETools.CTDB.CTDBResponseMeta[])o.@metadata; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write7_CTDBResponseMeta(@"metadata", @"http://db.cuetools.net/ns/mmd-1.0#", ((global::CUETools.CTDB.CTDBResponseMeta)a[ia]), false, false); + } + } + } + WriteEndElement(o); + } + + void Write7_CTDBResponseMeta(string n, string ns, global::CUETools.CTDB.CTDBResponseMeta o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMeta)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMeta", @"http://db.cuetools.net/ns/mmd-1.0#"); + WriteAttribute(@"source", @"", ((global::System.String)o.@source)); + WriteAttribute(@"id", @"", ((global::System.String)o.@id)); + WriteAttribute(@"artist", @"", ((global::System.String)o.@artist)); + WriteAttribute(@"album", @"", ((global::System.String)o.@album)); + WriteAttribute(@"year", @"", ((global::System.String)o.@year)); + WriteAttribute(@"genre", @"", ((global::System.String)o.@genre)); + WriteAttribute(@"discnumber", @"", ((global::System.String)o.@discnumber)); + WriteAttribute(@"disccount", @"", ((global::System.String)o.@disccount)); + WriteAttribute(@"discname", @"", ((global::System.String)o.@discname)); + WriteAttribute(@"infourl", @"", ((global::System.String)o.@infourl)); + WriteAttribute(@"barcode", @"", ((global::System.String)o.@barcode)); + { + global::CUETools.CTDB.CTDBResponseMetaImage[] a = (global::CUETools.CTDB.CTDBResponseMetaImage[])o.@coverart; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write3_CTDBResponseMetaImage(@"coverart", @"http://db.cuetools.net/ns/mmd-1.0#", ((global::CUETools.CTDB.CTDBResponseMetaImage)a[ia]), false, false); + } + } + } + { + global::CUETools.CTDB.CTDBResponseMetaTrack[] a = (global::CUETools.CTDB.CTDBResponseMetaTrack[])o.@track; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write4_CTDBResponseMetaTrack(@"track", @"http://db.cuetools.net/ns/mmd-1.0#", ((global::CUETools.CTDB.CTDBResponseMetaTrack)a[ia]), false, false); + } + } + } + { + global::CUETools.CTDB.CTDBResponseMetaLabel[] a = (global::CUETools.CTDB.CTDBResponseMetaLabel[])o.@label; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write5_CTDBResponseMetaLabel(@"label", @"http://db.cuetools.net/ns/mmd-1.0#", ((global::CUETools.CTDB.CTDBResponseMetaLabel)a[ia]), false, false); + } + } + } + { + global::CUETools.CTDB.CTDBResponseMetaRelease[] a = (global::CUETools.CTDB.CTDBResponseMetaRelease[])o.@release; + if (a != null) { + for (int ia = 0; ia < a.Length; ia++) { + Write6_CTDBResponseMetaRelease(@"release", @"http://db.cuetools.net/ns/mmd-1.0#", ((global::CUETools.CTDB.CTDBResponseMetaRelease)a[ia]), false, false); + } + } + } + WriteElementString(@"extra", @"http://db.cuetools.net/ns/mmd-1.0#", ((global::System.String)o.@extra)); + WriteEndElement(o); + } + + void Write6_CTDBResponseMetaRelease(string n, string ns, global::CUETools.CTDB.CTDBResponseMetaRelease o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMetaRelease)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMetaRelease", @"http://db.cuetools.net/ns/mmd-1.0#"); + WriteAttribute(@"date", @"", ((global::System.String)o.@date)); + WriteAttribute(@"country", @"", ((global::System.String)o.@country)); + WriteEndElement(o); + } + + void Write5_CTDBResponseMetaLabel(string n, string ns, global::CUETools.CTDB.CTDBResponseMetaLabel o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMetaLabel)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMetaLabel", @"http://db.cuetools.net/ns/mmd-1.0#"); + WriteAttribute(@"name", @"", ((global::System.String)o.@name)); + WriteAttribute(@"catno", @"", ((global::System.String)o.@catno)); + WriteEndElement(o); + } + + void Write4_CTDBResponseMetaTrack(string n, string ns, global::CUETools.CTDB.CTDBResponseMetaTrack o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMetaTrack)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMetaTrack", @"http://db.cuetools.net/ns/mmd-1.0#"); + WriteAttribute(@"name", @"", ((global::System.String)o.@name)); + WriteAttribute(@"artist", @"", ((global::System.String)o.@artist)); + WriteElementString(@"extra", @"http://db.cuetools.net/ns/mmd-1.0#", ((global::System.String)o.@extra)); + WriteEndElement(o); + } + + void Write3_CTDBResponseMetaImage(string n, string ns, global::CUETools.CTDB.CTDBResponseMetaImage o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseMetaImage)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseMetaImage", @"http://db.cuetools.net/ns/mmd-1.0#"); + WriteAttribute(@"uri", @"", ((global::System.String)o.@uri)); + WriteAttribute(@"uri150", @"", ((global::System.String)o.@uri150)); + WriteAttribute(@"height", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@height))); + WriteAttribute(@"width", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@width))); + WriteAttribute(@"primary", @"", System.Xml.XmlConvert.ToString((global::System.Boolean)((global::System.Boolean)o.@primary))); + WriteEndElement(o); + } + + void Write2_CTDBResponseEntry(string n, string ns, global::CUETools.CTDB.CTDBResponseEntry o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::CUETools.CTDB.CTDBResponseEntry)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"CTDBResponseEntry", @"http://db.cuetools.net/ns/mmd-1.0#"); + WriteAttribute(@"id", @"", System.Xml.XmlConvert.ToString((global::System.Int64)((global::System.Int64)o.@id))); + WriteAttribute(@"crc32", @"", ((global::System.String)o.@crc32)); + WriteAttribute(@"confidence", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@confidence))); + WriteAttribute(@"npar", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@npar))); + WriteAttribute(@"stride", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)o.@stride))); + WriteAttribute(@"hasparity", @"", ((global::System.String)o.@hasparity)); + WriteAttribute(@"parity", @"", ((global::System.String)o.@parity)); + WriteAttribute(@"syndrome", @"", ((global::System.String)o.@syndrome)); + WriteAttribute(@"trackcrcs", @"", ((global::System.String)o.@trackcrcs)); + WriteAttribute(@"toc", @"", ((global::System.String)o.@toc)); + WriteEndElement(o); + } + + protected override void InitCallbacks() { + } + } + + public class XmlSerializationReader1 : System.Xml.Serialization.XmlSerializationReader { + + public object Read15_ctdb() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id1_ctdb && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read8_CTDBResponse(true, true); + } + else { + throw CreateUnknownNodeException(); + } + } + else { + UnknownNode(null, @"http://db.cuetools.net/ns/mmd-1.0#:ctdb"); + } + return (object)o; + } + + public object Read16_CTDBResponseEntry() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id3_CTDBResponseEntry && (object) Reader.NamespaceURI == (object)id4_Item)) { + o = Read9_CTDBResponseEntry(true, true); + } + else { + throw CreateUnknownNodeException(); + } + } + else { + UnknownNode(null, @":CTDBResponseEntry"); + } + return (object)o; + } + + public object Read17_CTDBResponseMeta() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id5_CTDBResponseMeta && (object) Reader.NamespaceURI == (object)id4_Item)) { + o = Read14_CTDBResponseMeta(true, true); + } + else { + throw CreateUnknownNodeException(); + } + } + else { + UnknownNode(null, @":CTDBResponseMeta"); + } + return (object)o; + } + + public object Read18_CTDBResponseMetaImage() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id6_CTDBResponseMetaImage && (object) Reader.NamespaceURI == (object)id4_Item)) { + o = Read10_CTDBResponseMetaImage(true, true); + } + else { + throw CreateUnknownNodeException(); + } + } + else { + UnknownNode(null, @":CTDBResponseMetaImage"); + } + return (object)o; + } + + public object Read19_CTDBResponseMetaLabel() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id7_CTDBResponseMetaLabel && (object) Reader.NamespaceURI == (object)id4_Item)) { + o = Read12_CTDBResponseMetaLabel(true, true); + } + else { + throw CreateUnknownNodeException(); + } + } + else { + UnknownNode(null, @":CTDBResponseMetaLabel"); + } + return (object)o; + } + + public object Read20_CTDBResponseMetaRelease() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id8_CTDBResponseMetaRelease && (object) Reader.NamespaceURI == (object)id4_Item)) { + o = Read13_CTDBResponseMetaRelease(true, true); + } + else { + throw CreateUnknownNodeException(); + } + } + else { + UnknownNode(null, @":CTDBResponseMetaRelease"); + } + return (object)o; + } + + public object Read21_CTDBResponseMetaTrack() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id9_CTDBResponseMetaTrack && (object) Reader.NamespaceURI == (object)id4_Item)) { + o = Read11_CTDBResponseMetaTrack(true, true); + } + else { + throw CreateUnknownNodeException(); + } + } + else { + UnknownNode(null, @":CTDBResponseMetaTrack"); + } + return (object)o; + } + + global::CUETools.CTDB.CTDBResponseMetaTrack Read11_CTDBResponseMetaTrack(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id9_CTDBResponseMetaTrack && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id4_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMetaTrack o; + o = new global::CUETools.CTDB.CTDBResponseMetaTrack(); + bool[] paramsRead = new bool[3]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id10_name && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@name = Reader.Value; + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id11_artist && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@artist = Reader.Value; + paramsRead[1] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":name, :artist"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations0 = 0; + int readerCount0 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id12_extra && (object) Reader.NamespaceURI == (object)id4_Item)) { + { + o.@extra = Reader.ReadElementString(); + } + paramsRead[2] = true; + } + else { + UnknownNode((object)o, @":extra"); + } + } + else { + UnknownNode((object)o, @":extra"); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations0, ref readerCount0); + } + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseMetaRelease Read13_CTDBResponseMetaRelease(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id8_CTDBResponseMetaRelease && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id4_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMetaRelease o; + o = new global::CUETools.CTDB.CTDBResponseMetaRelease(); + bool[] paramsRead = new bool[2]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id13_date && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@date = Reader.Value; + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id14_country && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@country = Reader.Value; + paramsRead[1] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":date, :country"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations1 = 0; + int readerCount1 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + UnknownNode((object)o, @""); + } + else { + UnknownNode((object)o, @""); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations1, ref readerCount1); + } + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseMetaLabel Read12_CTDBResponseMetaLabel(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id7_CTDBResponseMetaLabel && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id4_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMetaLabel o; + o = new global::CUETools.CTDB.CTDBResponseMetaLabel(); + bool[] paramsRead = new bool[2]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id10_name && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@name = Reader.Value; + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id15_catno && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@catno = Reader.Value; + paramsRead[1] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":name, :catno"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations2 = 0; + int readerCount2 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + UnknownNode((object)o, @""); + } + else { + UnknownNode((object)o, @""); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations2, ref readerCount2); + } + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseMetaImage Read10_CTDBResponseMetaImage(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id6_CTDBResponseMetaImage && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id4_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMetaImage o; + o = new global::CUETools.CTDB.CTDBResponseMetaImage(); + bool[] paramsRead = new bool[5]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id16_uri && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@uri = Reader.Value; + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id17_uri150 && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@uri150 = Reader.Value; + paramsRead[1] = true; + } + else if (!paramsRead[2] && ((object) Reader.LocalName == (object)id18_height && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@height = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[2] = true; + } + else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id19_width && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@width = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[3] = true; + } + else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id20_primary && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@primary = System.Xml.XmlConvert.ToBoolean(Reader.Value); + paramsRead[4] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":uri, :uri150, :height, :width, :primary"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations3 = 0; + int readerCount3 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + UnknownNode((object)o, @""); + } + else { + UnknownNode((object)o, @""); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations3, ref readerCount3); + } + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseMeta Read14_CTDBResponseMeta(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id5_CTDBResponseMeta && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id4_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMeta o; + o = new global::CUETools.CTDB.CTDBResponseMeta(); + global::CUETools.CTDB.CTDBResponseMetaImage[] a_0 = null; + int ca_0 = 0; + global::CUETools.CTDB.CTDBResponseMetaTrack[] a_1 = null; + int ca_1 = 0; + global::CUETools.CTDB.CTDBResponseMetaLabel[] a_2 = null; + int ca_2 = 0; + global::CUETools.CTDB.CTDBResponseMetaRelease[] a_3 = null; + int ca_3 = 0; + bool[] paramsRead = new bool[16]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id21_source && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@source = Reader.Value; + paramsRead[4] = true; + } + else if (!paramsRead[5] && ((object) Reader.LocalName == (object)id22_id && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@id = Reader.Value; + paramsRead[5] = true; + } + else if (!paramsRead[6] && ((object) Reader.LocalName == (object)id11_artist && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@artist = Reader.Value; + paramsRead[6] = true; + } + else if (!paramsRead[7] && ((object) Reader.LocalName == (object)id23_album && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@album = Reader.Value; + paramsRead[7] = true; + } + else if (!paramsRead[8] && ((object) Reader.LocalName == (object)id24_year && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@year = Reader.Value; + paramsRead[8] = true; + } + else if (!paramsRead[9] && ((object) Reader.LocalName == (object)id25_genre && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@genre = Reader.Value; + paramsRead[9] = true; + } + else if (!paramsRead[11] && ((object) Reader.LocalName == (object)id26_discnumber && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@discnumber = Reader.Value; + paramsRead[11] = true; + } + else if (!paramsRead[12] && ((object) Reader.LocalName == (object)id27_disccount && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@disccount = Reader.Value; + paramsRead[12] = true; + } + else if (!paramsRead[13] && ((object) Reader.LocalName == (object)id28_discname && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@discname = Reader.Value; + paramsRead[13] = true; + } + else if (!paramsRead[14] && ((object) Reader.LocalName == (object)id29_infourl && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@infourl = Reader.Value; + paramsRead[14] = true; + } + else if (!paramsRead[15] && ((object) Reader.LocalName == (object)id30_barcode && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@barcode = Reader.Value; + paramsRead[15] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":source, :id, :artist, :album, :year, :genre, :discnumber, :disccount, :discname, :infourl, :barcode"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + o.@coverart = (global::CUETools.CTDB.CTDBResponseMetaImage[])ShrinkArray(a_0, ca_0, typeof(global::CUETools.CTDB.CTDBResponseMetaImage), true); + o.@track = (global::CUETools.CTDB.CTDBResponseMetaTrack[])ShrinkArray(a_1, ca_1, typeof(global::CUETools.CTDB.CTDBResponseMetaTrack), true); + o.@label = (global::CUETools.CTDB.CTDBResponseMetaLabel[])ShrinkArray(a_2, ca_2, typeof(global::CUETools.CTDB.CTDBResponseMetaLabel), true); + o.@release = (global::CUETools.CTDB.CTDBResponseMetaRelease[])ShrinkArray(a_3, ca_3, typeof(global::CUETools.CTDB.CTDBResponseMetaRelease), true); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations4 = 0; + int readerCount4 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id31_coverart && (object) Reader.NamespaceURI == (object)id4_Item)) { + a_0 = (global::CUETools.CTDB.CTDBResponseMetaImage[])EnsureArrayIndex(a_0, ca_0, typeof(global::CUETools.CTDB.CTDBResponseMetaImage));a_0[ca_0++] = Read10_CTDBResponseMetaImage(false, true); + } + else if (((object) Reader.LocalName == (object)id32_track && (object) Reader.NamespaceURI == (object)id4_Item)) { + a_1 = (global::CUETools.CTDB.CTDBResponseMetaTrack[])EnsureArrayIndex(a_1, ca_1, typeof(global::CUETools.CTDB.CTDBResponseMetaTrack));a_1[ca_1++] = Read11_CTDBResponseMetaTrack(false, true); + } + else if (((object) Reader.LocalName == (object)id33_label && (object) Reader.NamespaceURI == (object)id4_Item)) { + a_2 = (global::CUETools.CTDB.CTDBResponseMetaLabel[])EnsureArrayIndex(a_2, ca_2, typeof(global::CUETools.CTDB.CTDBResponseMetaLabel));a_2[ca_2++] = Read12_CTDBResponseMetaLabel(false, true); + } + else if (((object) Reader.LocalName == (object)id34_release && (object) Reader.NamespaceURI == (object)id4_Item)) { + a_3 = (global::CUETools.CTDB.CTDBResponseMetaRelease[])EnsureArrayIndex(a_3, ca_3, typeof(global::CUETools.CTDB.CTDBResponseMetaRelease));a_3[ca_3++] = Read13_CTDBResponseMetaRelease(false, true); + } + else if (!paramsRead[10] && ((object) Reader.LocalName == (object)id12_extra && (object) Reader.NamespaceURI == (object)id4_Item)) { + { + o.@extra = Reader.ReadElementString(); + } + paramsRead[10] = true; + } + else { + UnknownNode((object)o, @":coverart, :track, :label, :release, :extra"); + } + } + else { + UnknownNode((object)o, @":coverart, :track, :label, :release, :extra"); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations4, ref readerCount4); + } + o.@coverart = (global::CUETools.CTDB.CTDBResponseMetaImage[])ShrinkArray(a_0, ca_0, typeof(global::CUETools.CTDB.CTDBResponseMetaImage), true); + o.@track = (global::CUETools.CTDB.CTDBResponseMetaTrack[])ShrinkArray(a_1, ca_1, typeof(global::CUETools.CTDB.CTDBResponseMetaTrack), true); + o.@label = (global::CUETools.CTDB.CTDBResponseMetaLabel[])ShrinkArray(a_2, ca_2, typeof(global::CUETools.CTDB.CTDBResponseMetaLabel), true); + o.@release = (global::CUETools.CTDB.CTDBResponseMetaRelease[])ShrinkArray(a_3, ca_3, typeof(global::CUETools.CTDB.CTDBResponseMetaRelease), true); + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseEntry Read9_CTDBResponseEntry(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id3_CTDBResponseEntry && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id4_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseEntry o; + o = new global::CUETools.CTDB.CTDBResponseEntry(); + bool[] paramsRead = new bool[10]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id22_id && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@id = System.Xml.XmlConvert.ToInt64(Reader.Value); + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id35_crc32 && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@crc32 = Reader.Value; + paramsRead[1] = true; + } + else if (!paramsRead[2] && ((object) Reader.LocalName == (object)id36_confidence && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@confidence = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[2] = true; + } + else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id37_npar && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@npar = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[3] = true; + } + else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id38_stride && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@stride = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[4] = true; + } + else if (!paramsRead[5] && ((object) Reader.LocalName == (object)id39_hasparity && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@hasparity = Reader.Value; + paramsRead[5] = true; + } + else if (!paramsRead[6] && ((object) Reader.LocalName == (object)id40_parity && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@parity = Reader.Value; + paramsRead[6] = true; + } + else if (!paramsRead[7] && ((object) Reader.LocalName == (object)id41_syndrome && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@syndrome = Reader.Value; + paramsRead[7] = true; + } + else if (!paramsRead[8] && ((object) Reader.LocalName == (object)id42_trackcrcs && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@trackcrcs = Reader.Value; + paramsRead[8] = true; + } + else if (!paramsRead[9] && ((object) Reader.LocalName == (object)id43_toc && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@toc = Reader.Value; + paramsRead[9] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":id, :crc32, :confidence, :npar, :stride, :hasparity, :parity, :syndrome, :trackcrcs, :toc"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations5 = 0; + int readerCount5 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + UnknownNode((object)o, @""); + } + else { + UnknownNode((object)o, @""); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations5, ref readerCount5); + } + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponse Read8_CTDBResponse(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id44_CTDBResponse && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponse o; + o = new global::CUETools.CTDB.CTDBResponse(); + global::CUETools.CTDB.CTDBResponseEntry[] a_0 = null; + int ca_0 = 0; + global::CUETools.CTDB.CTDBResponseMeta[] a_1 = null; + int ca_1 = 0; + bool[] paramsRead = new bool[7]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id45_status && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@status = Reader.Value; + paramsRead[2] = true; + } + else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id46_updateurl && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@updateurl = Reader.Value; + paramsRead[3] = true; + } + else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id47_updatemsg && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@updatemsg = Reader.Value; + paramsRead[4] = true; + } + else if (!paramsRead[5] && ((object) Reader.LocalName == (object)id48_message && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@message = Reader.Value; + paramsRead[5] = true; + } + else if (!paramsRead[6] && ((object) Reader.LocalName == (object)id37_npar && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@npar = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[6] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":status, :updateurl, :updatemsg, :message, :npar"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + o.@entry = (global::CUETools.CTDB.CTDBResponseEntry[])ShrinkArray(a_0, ca_0, typeof(global::CUETools.CTDB.CTDBResponseEntry), true); + o.@metadata = (global::CUETools.CTDB.CTDBResponseMeta[])ShrinkArray(a_1, ca_1, typeof(global::CUETools.CTDB.CTDBResponseMeta), true); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations6 = 0; + int readerCount6 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id49_entry && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_0 = (global::CUETools.CTDB.CTDBResponseEntry[])EnsureArrayIndex(a_0, ca_0, typeof(global::CUETools.CTDB.CTDBResponseEntry));a_0[ca_0++] = Read2_CTDBResponseEntry(false, true); + } + else if (((object) Reader.LocalName == (object)id50_metadata && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_1 = (global::CUETools.CTDB.CTDBResponseMeta[])EnsureArrayIndex(a_1, ca_1, typeof(global::CUETools.CTDB.CTDBResponseMeta));a_1[ca_1++] = Read7_CTDBResponseMeta(false, true); + } + else { + UnknownNode((object)o, @"http://db.cuetools.net/ns/mmd-1.0#:entry, http://db.cuetools.net/ns/mmd-1.0#:metadata"); + } + } + else { + UnknownNode((object)o, @"http://db.cuetools.net/ns/mmd-1.0#:entry, http://db.cuetools.net/ns/mmd-1.0#:metadata"); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations6, ref readerCount6); + } + o.@entry = (global::CUETools.CTDB.CTDBResponseEntry[])ShrinkArray(a_0, ca_0, typeof(global::CUETools.CTDB.CTDBResponseEntry), true); + o.@metadata = (global::CUETools.CTDB.CTDBResponseMeta[])ShrinkArray(a_1, ca_1, typeof(global::CUETools.CTDB.CTDBResponseMeta), true); + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseMeta Read7_CTDBResponseMeta(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id5_CTDBResponseMeta && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMeta o; + o = new global::CUETools.CTDB.CTDBResponseMeta(); + global::CUETools.CTDB.CTDBResponseMetaImage[] a_0 = null; + int ca_0 = 0; + global::CUETools.CTDB.CTDBResponseMetaTrack[] a_1 = null; + int ca_1 = 0; + global::CUETools.CTDB.CTDBResponseMetaLabel[] a_2 = null; + int ca_2 = 0; + global::CUETools.CTDB.CTDBResponseMetaRelease[] a_3 = null; + int ca_3 = 0; + bool[] paramsRead = new bool[16]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id21_source && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@source = Reader.Value; + paramsRead[4] = true; + } + else if (!paramsRead[5] && ((object) Reader.LocalName == (object)id22_id && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@id = Reader.Value; + paramsRead[5] = true; + } + else if (!paramsRead[6] && ((object) Reader.LocalName == (object)id11_artist && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@artist = Reader.Value; + paramsRead[6] = true; + } + else if (!paramsRead[7] && ((object) Reader.LocalName == (object)id23_album && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@album = Reader.Value; + paramsRead[7] = true; + } + else if (!paramsRead[8] && ((object) Reader.LocalName == (object)id24_year && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@year = Reader.Value; + paramsRead[8] = true; + } + else if (!paramsRead[9] && ((object) Reader.LocalName == (object)id25_genre && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@genre = Reader.Value; + paramsRead[9] = true; + } + else if (!paramsRead[11] && ((object) Reader.LocalName == (object)id26_discnumber && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@discnumber = Reader.Value; + paramsRead[11] = true; + } + else if (!paramsRead[12] && ((object) Reader.LocalName == (object)id27_disccount && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@disccount = Reader.Value; + paramsRead[12] = true; + } + else if (!paramsRead[13] && ((object) Reader.LocalName == (object)id28_discname && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@discname = Reader.Value; + paramsRead[13] = true; + } + else if (!paramsRead[14] && ((object) Reader.LocalName == (object)id29_infourl && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@infourl = Reader.Value; + paramsRead[14] = true; + } + else if (!paramsRead[15] && ((object) Reader.LocalName == (object)id30_barcode && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@barcode = Reader.Value; + paramsRead[15] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":source, :id, :artist, :album, :year, :genre, :discnumber, :disccount, :discname, :infourl, :barcode"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + o.@coverart = (global::CUETools.CTDB.CTDBResponseMetaImage[])ShrinkArray(a_0, ca_0, typeof(global::CUETools.CTDB.CTDBResponseMetaImage), true); + o.@track = (global::CUETools.CTDB.CTDBResponseMetaTrack[])ShrinkArray(a_1, ca_1, typeof(global::CUETools.CTDB.CTDBResponseMetaTrack), true); + o.@label = (global::CUETools.CTDB.CTDBResponseMetaLabel[])ShrinkArray(a_2, ca_2, typeof(global::CUETools.CTDB.CTDBResponseMetaLabel), true); + o.@release = (global::CUETools.CTDB.CTDBResponseMetaRelease[])ShrinkArray(a_3, ca_3, typeof(global::CUETools.CTDB.CTDBResponseMetaRelease), true); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations7 = 0; + int readerCount7 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id31_coverart && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_0 = (global::CUETools.CTDB.CTDBResponseMetaImage[])EnsureArrayIndex(a_0, ca_0, typeof(global::CUETools.CTDB.CTDBResponseMetaImage));a_0[ca_0++] = Read3_CTDBResponseMetaImage(false, true); + } + else if (((object) Reader.LocalName == (object)id32_track && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_1 = (global::CUETools.CTDB.CTDBResponseMetaTrack[])EnsureArrayIndex(a_1, ca_1, typeof(global::CUETools.CTDB.CTDBResponseMetaTrack));a_1[ca_1++] = Read4_CTDBResponseMetaTrack(false, true); + } + else if (((object) Reader.LocalName == (object)id33_label && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_2 = (global::CUETools.CTDB.CTDBResponseMetaLabel[])EnsureArrayIndex(a_2, ca_2, typeof(global::CUETools.CTDB.CTDBResponseMetaLabel));a_2[ca_2++] = Read5_CTDBResponseMetaLabel(false, true); + } + else if (((object) Reader.LocalName == (object)id34_release && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_3 = (global::CUETools.CTDB.CTDBResponseMetaRelease[])EnsureArrayIndex(a_3, ca_3, typeof(global::CUETools.CTDB.CTDBResponseMetaRelease));a_3[ca_3++] = Read6_CTDBResponseMetaRelease(false, true); + } + else if (!paramsRead[10] && ((object) Reader.LocalName == (object)id12_extra && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@extra = Reader.ReadElementString(); + } + paramsRead[10] = true; + } + else { + UnknownNode((object)o, @"http://db.cuetools.net/ns/mmd-1.0#:coverart, http://db.cuetools.net/ns/mmd-1.0#:track, http://db.cuetools.net/ns/mmd-1.0#:label, http://db.cuetools.net/ns/mmd-1.0#:release, http://db.cuetools.net/ns/mmd-1.0#:extra"); + } + } + else { + UnknownNode((object)o, @"http://db.cuetools.net/ns/mmd-1.0#:coverart, http://db.cuetools.net/ns/mmd-1.0#:track, http://db.cuetools.net/ns/mmd-1.0#:label, http://db.cuetools.net/ns/mmd-1.0#:release, http://db.cuetools.net/ns/mmd-1.0#:extra"); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations7, ref readerCount7); + } + o.@coverart = (global::CUETools.CTDB.CTDBResponseMetaImage[])ShrinkArray(a_0, ca_0, typeof(global::CUETools.CTDB.CTDBResponseMetaImage), true); + o.@track = (global::CUETools.CTDB.CTDBResponseMetaTrack[])ShrinkArray(a_1, ca_1, typeof(global::CUETools.CTDB.CTDBResponseMetaTrack), true); + o.@label = (global::CUETools.CTDB.CTDBResponseMetaLabel[])ShrinkArray(a_2, ca_2, typeof(global::CUETools.CTDB.CTDBResponseMetaLabel), true); + o.@release = (global::CUETools.CTDB.CTDBResponseMetaRelease[])ShrinkArray(a_3, ca_3, typeof(global::CUETools.CTDB.CTDBResponseMetaRelease), true); + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseMetaRelease Read6_CTDBResponseMetaRelease(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id8_CTDBResponseMetaRelease && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMetaRelease o; + o = new global::CUETools.CTDB.CTDBResponseMetaRelease(); + bool[] paramsRead = new bool[2]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id13_date && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@date = Reader.Value; + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id14_country && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@country = Reader.Value; + paramsRead[1] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":date, :country"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations8 = 0; + int readerCount8 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + UnknownNode((object)o, @""); + } + else { + UnknownNode((object)o, @""); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations8, ref readerCount8); + } + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseMetaLabel Read5_CTDBResponseMetaLabel(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id7_CTDBResponseMetaLabel && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMetaLabel o; + o = new global::CUETools.CTDB.CTDBResponseMetaLabel(); + bool[] paramsRead = new bool[2]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id10_name && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@name = Reader.Value; + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id15_catno && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@catno = Reader.Value; + paramsRead[1] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":name, :catno"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations9 = 0; + int readerCount9 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + UnknownNode((object)o, @""); + } + else { + UnknownNode((object)o, @""); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations9, ref readerCount9); + } + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseMetaTrack Read4_CTDBResponseMetaTrack(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id9_CTDBResponseMetaTrack && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMetaTrack o; + o = new global::CUETools.CTDB.CTDBResponseMetaTrack(); + bool[] paramsRead = new bool[3]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id10_name && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@name = Reader.Value; + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id11_artist && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@artist = Reader.Value; + paramsRead[1] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":name, :artist"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations10 = 0; + int readerCount10 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id12_extra && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@extra = Reader.ReadElementString(); + } + paramsRead[2] = true; + } + else { + UnknownNode((object)o, @"http://db.cuetools.net/ns/mmd-1.0#:extra"); + } + } + else { + UnknownNode((object)o, @"http://db.cuetools.net/ns/mmd-1.0#:extra"); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations10, ref readerCount10); + } + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseMetaImage Read3_CTDBResponseMetaImage(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id6_CTDBResponseMetaImage && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseMetaImage o; + o = new global::CUETools.CTDB.CTDBResponseMetaImage(); + bool[] paramsRead = new bool[5]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id16_uri && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@uri = Reader.Value; + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id17_uri150 && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@uri150 = Reader.Value; + paramsRead[1] = true; + } + else if (!paramsRead[2] && ((object) Reader.LocalName == (object)id18_height && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@height = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[2] = true; + } + else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id19_width && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@width = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[3] = true; + } + else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id20_primary && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@primary = System.Xml.XmlConvert.ToBoolean(Reader.Value); + paramsRead[4] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":uri, :uri150, :height, :width, :primary"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations11 = 0; + int readerCount11 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + UnknownNode((object)o, @""); + } + else { + UnknownNode((object)o, @""); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations11, ref readerCount11); + } + ReadEndElement(); + return o; + } + + global::CUETools.CTDB.CTDBResponseEntry Read2_CTDBResponseEntry(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id3_CTDBResponseEntry && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::CUETools.CTDB.CTDBResponseEntry o; + o = new global::CUETools.CTDB.CTDBResponseEntry(); + bool[] paramsRead = new bool[10]; + while (Reader.MoveToNextAttribute()) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id22_id && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@id = System.Xml.XmlConvert.ToInt64(Reader.Value); + paramsRead[0] = true; + } + else if (!paramsRead[1] && ((object) Reader.LocalName == (object)id35_crc32 && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@crc32 = Reader.Value; + paramsRead[1] = true; + } + else if (!paramsRead[2] && ((object) Reader.LocalName == (object)id36_confidence && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@confidence = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[2] = true; + } + else if (!paramsRead[3] && ((object) Reader.LocalName == (object)id37_npar && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@npar = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[3] = true; + } + else if (!paramsRead[4] && ((object) Reader.LocalName == (object)id38_stride && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@stride = System.Xml.XmlConvert.ToInt32(Reader.Value); + paramsRead[4] = true; + } + else if (!paramsRead[5] && ((object) Reader.LocalName == (object)id39_hasparity && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@hasparity = Reader.Value; + paramsRead[5] = true; + } + else if (!paramsRead[6] && ((object) Reader.LocalName == (object)id40_parity && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@parity = Reader.Value; + paramsRead[6] = true; + } + else if (!paramsRead[7] && ((object) Reader.LocalName == (object)id41_syndrome && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@syndrome = Reader.Value; + paramsRead[7] = true; + } + else if (!paramsRead[8] && ((object) Reader.LocalName == (object)id42_trackcrcs && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@trackcrcs = Reader.Value; + paramsRead[8] = true; + } + else if (!paramsRead[9] && ((object) Reader.LocalName == (object)id43_toc && (object) Reader.NamespaceURI == (object)id4_Item)) { + o.@toc = Reader.Value; + paramsRead[9] = true; + } + else if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o, @":id, :crc32, :confidence, :npar, :stride, :hasparity, :parity, :syndrome, :trackcrcs, :toc"); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations12 = 0; + int readerCount12 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + UnknownNode((object)o, @""); + } + else { + UnknownNode((object)o, @""); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations12, ref readerCount12); + } + ReadEndElement(); + return o; + } + + protected override void InitCallbacks() { + } + + string id11_artist; + string id9_CTDBResponseMetaTrack; + string id4_Item; + string id45_status; + string id5_CTDBResponseMeta; + string id37_npar; + string id34_release; + string id49_entry; + string id30_barcode; + string id22_id; + string id16_uri; + string id8_CTDBResponseMetaRelease; + string id42_trackcrcs; + string id15_catno; + string id41_syndrome; + string id38_stride; + string id32_track; + string id24_year; + string id35_crc32; + string id14_country; + string id40_parity; + string id29_infourl; + string id18_height; + string id7_CTDBResponseMetaLabel; + string id6_CTDBResponseMetaImage; + string id28_discname; + string id19_width; + string id20_primary; + string id13_date; + string id1_ctdb; + string id27_disccount; + string id2_Item; + string id3_CTDBResponseEntry; + string id33_label; + string id21_source; + string id17_uri150; + string id48_message; + string id39_hasparity; + string id25_genre; + string id46_updateurl; + string id44_CTDBResponse; + string id50_metadata; + string id12_extra; + string id26_discnumber; + string id47_updatemsg; + string id23_album; + string id31_coverart; + string id36_confidence; + string id43_toc; + string id10_name; + + protected override void InitIDs() { + id11_artist = Reader.NameTable.Add(@"artist"); + id9_CTDBResponseMetaTrack = Reader.NameTable.Add(@"CTDBResponseMetaTrack"); + id4_Item = Reader.NameTable.Add(@""); + id45_status = Reader.NameTable.Add(@"status"); + id5_CTDBResponseMeta = Reader.NameTable.Add(@"CTDBResponseMeta"); + id37_npar = Reader.NameTable.Add(@"npar"); + id34_release = Reader.NameTable.Add(@"release"); + id49_entry = Reader.NameTable.Add(@"entry"); + id30_barcode = Reader.NameTable.Add(@"barcode"); + id22_id = Reader.NameTable.Add(@"id"); + id16_uri = Reader.NameTable.Add(@"uri"); + id8_CTDBResponseMetaRelease = Reader.NameTable.Add(@"CTDBResponseMetaRelease"); + id42_trackcrcs = Reader.NameTable.Add(@"trackcrcs"); + id15_catno = Reader.NameTable.Add(@"catno"); + id41_syndrome = Reader.NameTable.Add(@"syndrome"); + id38_stride = Reader.NameTable.Add(@"stride"); + id32_track = Reader.NameTable.Add(@"track"); + id24_year = Reader.NameTable.Add(@"year"); + id35_crc32 = Reader.NameTable.Add(@"crc32"); + id14_country = Reader.NameTable.Add(@"country"); + id40_parity = Reader.NameTable.Add(@"parity"); + id29_infourl = Reader.NameTable.Add(@"infourl"); + id18_height = Reader.NameTable.Add(@"height"); + id7_CTDBResponseMetaLabel = Reader.NameTable.Add(@"CTDBResponseMetaLabel"); + id6_CTDBResponseMetaImage = Reader.NameTable.Add(@"CTDBResponseMetaImage"); + id28_discname = Reader.NameTable.Add(@"discname"); + id19_width = Reader.NameTable.Add(@"width"); + id20_primary = Reader.NameTable.Add(@"primary"); + id13_date = Reader.NameTable.Add(@"date"); + id1_ctdb = Reader.NameTable.Add(@"ctdb"); + id27_disccount = Reader.NameTable.Add(@"disccount"); + id2_Item = Reader.NameTable.Add(@"http://db.cuetools.net/ns/mmd-1.0#"); + id3_CTDBResponseEntry = Reader.NameTable.Add(@"CTDBResponseEntry"); + id33_label = Reader.NameTable.Add(@"label"); + id21_source = Reader.NameTable.Add(@"source"); + id17_uri150 = Reader.NameTable.Add(@"uri150"); + id48_message = Reader.NameTable.Add(@"message"); + id39_hasparity = Reader.NameTable.Add(@"hasparity"); + id25_genre = Reader.NameTable.Add(@"genre"); + id46_updateurl = Reader.NameTable.Add(@"updateurl"); + id44_CTDBResponse = Reader.NameTable.Add(@"CTDBResponse"); + id50_metadata = Reader.NameTable.Add(@"metadata"); + id12_extra = Reader.NameTable.Add(@"extra"); + id26_discnumber = Reader.NameTable.Add(@"discnumber"); + id47_updatemsg = Reader.NameTable.Add(@"updatemsg"); + id23_album = Reader.NameTable.Add(@"album"); + id31_coverart = Reader.NameTable.Add(@"coverart"); + id36_confidence = Reader.NameTable.Add(@"confidence"); + id43_toc = Reader.NameTable.Add(@"toc"); + id10_name = Reader.NameTable.Add(@"name"); + } + } + + public abstract class XmlSerializer1 : System.Xml.Serialization.XmlSerializer { + protected override System.Xml.Serialization.XmlSerializationReader CreateReader() { + return new XmlSerializationReader1(); + } + protected override System.Xml.Serialization.XmlSerializationWriter CreateWriter() { + return new XmlSerializationWriter1(); + } + } + + public sealed class CTDBResponseSerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"ctdb", @"http://db.cuetools.net/ns/mmd-1.0#"); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write15_ctdb(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read15_ctdb(); + } + } + + public sealed class CTDBResponseEntrySerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"CTDBResponseEntry", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write16_CTDBResponseEntry(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read16_CTDBResponseEntry(); + } + } + + public sealed class CTDBResponseMetaSerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"CTDBResponseMeta", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write17_CTDBResponseMeta(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read17_CTDBResponseMeta(); + } + } + + public sealed class CTDBResponseMetaImageSerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"CTDBResponseMetaImage", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write18_CTDBResponseMetaImage(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read18_CTDBResponseMetaImage(); + } + } + + public sealed class CTDBResponseMetaLabelSerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"CTDBResponseMetaLabel", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write19_CTDBResponseMetaLabel(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read19_CTDBResponseMetaLabel(); + } + } + + public sealed class CTDBResponseMetaReleaseSerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"CTDBResponseMetaRelease", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write20_CTDBResponseMetaRelease(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read20_CTDBResponseMetaRelease(); + } + } + + public sealed class CTDBResponseMetaTrackSerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"CTDBResponseMetaTrack", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write21_CTDBResponseMetaTrack(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read21_CTDBResponseMetaTrack(); + } + } + + public class XmlSerializerContract : global::System.Xml.Serialization.XmlSerializerImplementation { + public override global::System.Xml.Serialization.XmlSerializationReader Reader { get { return new XmlSerializationReader1(); } } + public override global::System.Xml.Serialization.XmlSerializationWriter Writer { get { return new XmlSerializationWriter1(); } } + System.Collections.Hashtable readMethods = null; + public override System.Collections.Hashtable ReadMethods { + get { + if (readMethods == null) { + System.Collections.Hashtable _tmp = new System.Collections.Hashtable(); + _tmp[@"CUETools.CTDB.CTDBResponse:http://db.cuetools.net/ns/mmd-1.0#:ctdb:True:"] = @"Read15_ctdb"; + _tmp[@"CUETools.CTDB.CTDBResponseEntry::"] = @"Read16_CTDBResponseEntry"; + _tmp[@"CUETools.CTDB.CTDBResponseMeta::"] = @"Read17_CTDBResponseMeta"; + _tmp[@"CUETools.CTDB.CTDBResponseMetaImage::"] = @"Read18_CTDBResponseMetaImage"; + _tmp[@"CUETools.CTDB.CTDBResponseMetaLabel::"] = @"Read19_CTDBResponseMetaLabel"; + _tmp[@"CUETools.CTDB.CTDBResponseMetaRelease::"] = @"Read20_CTDBResponseMetaRelease"; + _tmp[@"CUETools.CTDB.CTDBResponseMetaTrack::"] = @"Read21_CTDBResponseMetaTrack"; + if (readMethods == null) readMethods = _tmp; + } + return readMethods; + } + } + System.Collections.Hashtable writeMethods = null; + public override System.Collections.Hashtable WriteMethods { + get { + if (writeMethods == null) { + System.Collections.Hashtable _tmp = new System.Collections.Hashtable(); + _tmp[@"CUETools.CTDB.CTDBResponse:http://db.cuetools.net/ns/mmd-1.0#:ctdb:True:"] = @"Write15_ctdb"; + _tmp[@"CUETools.CTDB.CTDBResponseEntry::"] = @"Write16_CTDBResponseEntry"; + _tmp[@"CUETools.CTDB.CTDBResponseMeta::"] = @"Write17_CTDBResponseMeta"; + _tmp[@"CUETools.CTDB.CTDBResponseMetaImage::"] = @"Write18_CTDBResponseMetaImage"; + _tmp[@"CUETools.CTDB.CTDBResponseMetaLabel::"] = @"Write19_CTDBResponseMetaLabel"; + _tmp[@"CUETools.CTDB.CTDBResponseMetaRelease::"] = @"Write20_CTDBResponseMetaRelease"; + _tmp[@"CUETools.CTDB.CTDBResponseMetaTrack::"] = @"Write21_CTDBResponseMetaTrack"; + if (writeMethods == null) writeMethods = _tmp; + } + return writeMethods; + } + } + System.Collections.Hashtable typedSerializers = null; + public override System.Collections.Hashtable TypedSerializers { + get { + if (typedSerializers == null) { + System.Collections.Hashtable _tmp = new System.Collections.Hashtable(); + _tmp.Add(@"CUETools.CTDB.CTDBResponseEntry::", new CTDBResponseEntrySerializer()); + _tmp.Add(@"CUETools.CTDB.CTDBResponseMeta::", new CTDBResponseMetaSerializer()); + _tmp.Add(@"CUETools.CTDB.CTDBResponse:http://db.cuetools.net/ns/mmd-1.0#:ctdb:True:", new CTDBResponseSerializer()); + _tmp.Add(@"CUETools.CTDB.CTDBResponseMetaTrack::", new CTDBResponseMetaTrackSerializer()); + _tmp.Add(@"CUETools.CTDB.CTDBResponseMetaRelease::", new CTDBResponseMetaReleaseSerializer()); + _tmp.Add(@"CUETools.CTDB.CTDBResponseMetaLabel::", new CTDBResponseMetaLabelSerializer()); + _tmp.Add(@"CUETools.CTDB.CTDBResponseMetaImage::", new CTDBResponseMetaImageSerializer()); + if (typedSerializers == null) typedSerializers = _tmp; + } + return typedSerializers; + } + } + public override System.Boolean CanSerialize(System.Type type) { + if (type == typeof(global::CUETools.CTDB.CTDBResponse)) return true; + if (type == typeof(global::CUETools.CTDB.CTDBResponseEntry)) return true; + if (type == typeof(global::CUETools.CTDB.CTDBResponseMeta)) return true; + if (type == typeof(global::CUETools.CTDB.CTDBResponseMetaImage)) return true; + if (type == typeof(global::CUETools.CTDB.CTDBResponseMetaLabel)) return true; + if (type == typeof(global::CUETools.CTDB.CTDBResponseMetaRelease)) return true; + if (type == typeof(global::CUETools.CTDB.CTDBResponseMetaTrack)) return true; + return false; + } + public override System.Xml.Serialization.XmlSerializer GetSerializer(System.Type type) { + if (type == typeof(global::CUETools.CTDB.CTDBResponse)) return new CTDBResponseSerializer(); + if (type == typeof(global::CUETools.CTDB.CTDBResponseEntry)) return new CTDBResponseEntrySerializer(); + if (type == typeof(global::CUETools.CTDB.CTDBResponseMeta)) return new CTDBResponseMetaSerializer(); + if (type == typeof(global::CUETools.CTDB.CTDBResponseMetaImage)) return new CTDBResponseMetaImageSerializer(); + if (type == typeof(global::CUETools.CTDB.CTDBResponseMetaLabel)) return new CTDBResponseMetaLabelSerializer(); + if (type == typeof(global::CUETools.CTDB.CTDBResponseMetaRelease)) return new CTDBResponseMetaReleaseSerializer(); + if (type == typeof(global::CUETools.CTDB.CTDBResponseMetaTrack)) return new CTDBResponseMetaTrackSerializer(); + return null; + } + } +} diff --git a/CUETools.CTDB/UploadHelper/Properties/AssemblyInfo.cs b/CUETools.CTDB/UploadHelper/Properties/AssemblyInfo.cs deleted file mode 100644 index 8616d05..0000000 --- a/CUETools.CTDB/UploadHelper/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -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("UploadHelper")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("UploadHelper")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] -[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("13eac2b4-c1d5-4317-a17a-5389ad4c6005")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CUETools.CTDB/UploadHelper/UploadHelper.csproj b/CUETools.CTDB/UploadHelper/UploadHelper.csproj deleted file mode 100644 index 025e3ae..0000000 --- a/CUETools.CTDB/UploadHelper/UploadHelper.csproj +++ /dev/null @@ -1,59 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {02FBD52C-B997-4D18-9E2C-81B5AE8EFB30} - Library - Properties - Krystalware.UploadHelper - Krystalware.UploadHelper - - - - - - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CUETools.ChaptersToCue/CUETools.ChaptersToCue.csproj b/CUETools.ChaptersToCue/CUETools.ChaptersToCue.csproj new file mode 100644 index 0000000..9d7bd09 --- /dev/null +++ b/CUETools.ChaptersToCue/CUETools.ChaptersToCue.csproj @@ -0,0 +1,106 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {9253A314-1821-42BF-B02F-2BF986B1765D} + Exe + Properties + CUETools.ChaptersToCue + CUETools.ChaptersToCue + + + 3.5 + + + v4.0 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + ..\bin\Debug\net40\ + DEBUG;TRACE + prompt + 4 + AllRules.ruleset + + + pdbonly + true + ..\bin\Release\net40\ + TRACE + prompt + 4 + AllRules.ruleset + + + + + + + False + ..\bin\Release\taglib-sharp.dll + + + + + + + + + {1DD41038-D885-46C5-8DDE-E0B82F066584} + CUETools.CDImage + + + {AA2A9A7E-45FB-4632-AD85-85B0E556F818} + CUETools.CTDB + + + {6458A13A-30EF-45A9-9D58-E5031B17BEE2} + CUETools.Codecs + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + \ No newline at end of file diff --git a/CUETools.ChaptersToCue/Program.cs b/CUETools.ChaptersToCue/Program.cs new file mode 100644 index 0000000..0ea330f --- /dev/null +++ b/CUETools.ChaptersToCue/Program.cs @@ -0,0 +1,251 @@ +// **************************************************************************** +// +// ChaptersToCue +// Copyright (C) 2018 Grigory Chudov (gchudov@gmail.com) +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// **************************************************************************** + +using System; +using System.IO; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections.Generic; +using CUETools.CDImage; +using CUETools.CTDB; +using CUETools.Codecs; + +namespace CUETools.ChaptersToCue +{ + class Program + { + static void Usage() + { + Console.WriteLine("Usage : CUETools.ChaptersToCue.exe "); + Console.WriteLine(); + Console.WriteLine("-i, --input File containing chapter times"); + Console.WriteLine("-o, --output Output filename; Default: Artist - year - album.cue"); + Console.WriteLine("-t, --tracks File containing track filenames"); + Console.WriteLine("-m, --meta query CTDB for metadata;"); + Console.WriteLine("--celltimes Input is in Celltimes format;"); + Console.WriteLine("--image Use image file to calculate duration"); + } + + static void Main(string[] args) + { + TextWriter stdout = Console.Out; + Console.SetOut(Console.Error); + Console.WriteLine("CUETools.ChaptersToCue v2.1.7 Copyright (C) 2017 Grigory Chudov"); + Console.WriteLine("This is free software under the GNU GPLv3+ license; There is NO WARRANTY, to"); + Console.WriteLine("the extent permitted by law. for details."); + + bool queryMeta = false; + bool celltimes = false; + int fps_mul = 0; + int fps_div = 1; + string inputPath = "-"; + string outputPath = null; + string tracksPath = null; + string imagePath = null; + for (int arg = 0; arg < args.Length; arg++) + { + bool ok = true; + if ((args[arg] == "-i" || args[arg] == "--input") && ++arg < args.Length) + inputPath = args[arg]; + else if ((args[arg] == "-o" || args[arg] == "--output") && ++arg < args.Length) + outputPath = args[arg]; + else if ((args[arg] == "-t" || args[arg] == "--tracks") && ++arg < args.Length) + tracksPath = args[arg]; + else if (args[arg] == "--image" && ++arg < args.Length) + imagePath = args[arg]; + else if (args[arg] == "-m" || args[arg] == "--meta") + queryMeta = true; + else if (args[arg] == "--celltimes" && ++arg < args.Length) + { + celltimes = true; + ok = int.TryParse(args[arg], out fps_mul); + if (ok && fps_mul == 30) + { + fps_mul = 30000; + fps_div = 1001; + } + } + else + ok = false; + if (!ok) + { + Usage(); + return; + } + } + + string strtoc = ""; + string extension = null; + if (tracksPath != null) + { + //CUEToolsCodecsConfig config = new CUEConfig(); + //TagLib.UserDefined.AdditionalFileTypes.Config = config; + TimeSpan pos = new TimeSpan(0); + using (TextReader sr = tracksPath == "-" ? Console.In : new StreamReader(tracksPath)) + { + while (sr.Peek() >= 0) + { + string line = sr.ReadLine(); + extension = Path.GetExtension(line); + TagLib.File sourceInfo = TagLib.File.Create(new TagLib.File.LocalFileAbstraction(line)); + strtoc += string.Format(" {0}", (int)(pos.TotalSeconds * 75)); + pos += sourceInfo.Properties.Duration; + } + } + strtoc += string.Format(" {0}", (int)(pos.TotalSeconds * 75)); + } + else + { + using (TextReader sr = inputPath == "-" ? Console.In : new StreamReader(inputPath)) + { + if (celltimes) + { + strtoc += string.Format(" {0}", 0); + while (sr.Peek() >= 0) + { + string line = sr.ReadLine(); + strtoc += string.Format(" {0}", long.Parse(line) * 75 * fps_div / fps_mul); + } + } + else + { + while (sr.Peek() >= 0) + { + string line = sr.ReadLine(); + Regex r = new Regex(@"^CHAPTER(?\d\d)(?