Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Bwg.Scsi/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ private struct PREVENT_MEDIA_REMOVAL
private const uint IOCTL_SCSI_PASS_THROUGH_DIRECT = 0x4d014;
private const uint IOCTL_SCSI_GET_CAPABILITIES = 0x41010;
private const uint IOCTL_STORAGE_MEDIA_REMOVAL = 0x2D4804;
private const uint IOCTL_CDROM_SET_SPEED = 0x24060;

private const uint ERROR_NOT_SUPPORTED = 50 ;
#endregion
Expand Down
5 changes: 5 additions & 0 deletions CUERipper/CUERipper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,17 @@
<EmbeddedResource Include="frmCUERipper.de-DE.resx">
<DependentUpon>frmCUERipper.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmCUERipper.nl.resx">
<DependentUpon>frmCUERipper.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="frmCUERipper.resx">
<SubType>Designer</SubType>
<DependentUpon>frmCUERipper.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmCUERipper.ru-RU.resx">
<DependentUpon>frmCUERipper.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="frmFreedbSubmit.de-DE.resx">
<DependentUpon>frmFreedbSubmit.cs</DependentUpon>
Expand Down
91 changes: 91 additions & 0 deletions CUERipper/CUERipperConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,99 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace CUERipper
{
public class ColumnInfo
{
public String Name { get; set; }
public int Width { get; set; }
public int DisplayIndex { get; set; }
public ColumnInfo(string name, int width, int displayIndex)
{
Name = name;
Width = width;
DisplayIndex = displayIndex;
}
}



[Serializable]
public class DataGridViewColumnSettings : IXmlSerializable
{
public List<ColumnInfo> listColumnInfo { get; set; } = new List<ColumnInfo>();

public void ReadFrom(DataGridView dgv)
{
listColumnInfo.Clear();
foreach (DataGridViewColumn colgrid in dgv.Columns)
{
listColumnInfo.Add(new ColumnInfo(colgrid.Name, colgrid.Width, colgrid.DisplayIndex));
}
listColumnInfo.Sort((x, y) => x.DisplayIndex.CompareTo(y.DisplayIndex));
}

public void ApplyTo(DataGridView dgv)
{
int i = 0;
foreach (ColumnInfo columninf in listColumnInfo)
{
var colgrid = dgv.Columns[columninf.Name];
if (colgrid != null)
{
if (i < dgv.ColumnCount)
colgrid.DisplayIndex = i;
i++;
colgrid.Width = columninf.Width;
}
}
}

// IXmlSerializable implementation
public XmlSchema GetSchema() => null;

public void ReadXml(XmlReader reader)
{
listColumnInfo.Clear();

try
{
reader.ReadStartElement();
int i = 1;
while (reader.IsStartElement("Column"))
{
string name = reader.GetAttribute("Name");
int width = int.Parse(reader.GetAttribute("Width"));
ColumnInfo columninf = new ColumnInfo(name, width, i);
listColumnInfo.Add(columninf);
reader.ReadStartElement("Column");
i++;
}
reader.ReadEndElement();
}
catch (XmlException)
{
return;
}
}

public void WriteXml(XmlWriter writer)
{
foreach (var columninf in listColumnInfo)
{
writer.WriteStartElement("Column");
writer.WriteAttributeString("Name", columninf.Name);
writer.WriteAttributeString("Width", columninf.Width.ToString());
writer.WriteEndElement();
}
}
}

[XmlRoot("dictionary")]
public class SerializableDictionary<TKey, TValue>
: Dictionary<TKey, TValue>, IXmlSerializable
Expand Down Expand Up @@ -108,5 +197,7 @@ public CUERipperConfig()
// 0 (ReadCdBEh), 1 (ReadCdD8h), 2 (Unknown/AutoDetect)
public SerializableDictionary<string, int> ReadCDCommands { get; set; }

public DataGridViewColumnSettings TrackGridSettings { get; set; } = new DataGridViewColumnSettings();

}
}
Loading