зеркало из https://github.com/mono/njb-sharp.git
2006-05-08 Aaron Bockover <aaron@abock.org>
* src/Song.cs: Make GetFrameString, GetFrameShort, and GetFrameInt perform conversions to respective return type if frame type is not of the expected data type; fixes an issue with a Nomad Jukebox 1 device reported and originally fixed by Bertrand Lorentz (BGO #341030) * src/NjbTest.cs: Updated to generate a standalone FDI file svn path=/trunk/njb-sharp/; revision=60411
This commit is contained in:
Родитель
eba708967e
Коммит
826491a6ed
|
@ -1,3 +1,12 @@
|
||||||
|
2006-05-08 Aaron Bockover <aaron@abock.org>
|
||||||
|
|
||||||
|
* src/Song.cs: Make GetFrameString, GetFrameShort, and GetFrameInt
|
||||||
|
perform conversions to respective return type if frame type is not of
|
||||||
|
the expected data type; fixes an issue with a Nomad Jukebox 1 device
|
||||||
|
reported and originally fixed by Bertrand Lorentz (BGO #341030)
|
||||||
|
|
||||||
|
* src/NjbTest.cs: Updated to generate a standalone FDI file
|
||||||
|
|
||||||
2006-04-17 Aaron Bockover <aaron@abock.org>
|
2006-04-17 Aaron Bockover <aaron@abock.org>
|
||||||
|
|
||||||
0.3.0 Release
|
0.3.0 Release
|
||||||
|
|
|
@ -33,8 +33,12 @@ public class Test
|
||||||
{
|
{
|
||||||
public static void HalFdiDump()
|
public static void HalFdiDump()
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||||
|
Console.WriteLine("<deviceinfo version=\"0.2\">");
|
||||||
|
Console.WriteLine(" <device>");
|
||||||
Console.WriteLine(" <match key=\"info.bus\" string=\"usb\">\n\n");
|
Console.WriteLine(" <match key=\"info.bus\" string=\"usb\">\n\n");
|
||||||
Console.WriteLine(" <!-- Begin NJB devices (generated by njb-sharp for libnjb compatible devices) -->\n");
|
Console.WriteLine(" <!-- Begin NJB devices (generated by njb-sharp for libnjb compatible devices) -->\n");
|
||||||
|
|
||||||
foreach(DeviceId device in DeviceId.ListAll) {
|
foreach(DeviceId device in DeviceId.ListAll) {
|
||||||
Console.WriteLine(" <!-- {0} -->", device.Name);
|
Console.WriteLine(" <!-- {0} -->", device.Name);
|
||||||
Console.WriteLine(" <match key=\"usb.vendor_id\" int=\"0x{0:x4}\">", device.VendorId);
|
Console.WriteLine(" <match key=\"usb.vendor_id\" int=\"0x{0:x4}\">", device.VendorId);
|
||||||
|
@ -56,9 +60,10 @@ public class Test
|
||||||
Console.WriteLine(" </match>\n");
|
Console.WriteLine(" </match>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine(" <!-- End NJB devices -->");
|
Console.WriteLine(" <!-- End NJB devices -->");
|
||||||
|
|
||||||
Console.WriteLine("\n\n </match>");
|
Console.WriteLine("\n\n </match>");
|
||||||
|
Console.WriteLine(" </device>");
|
||||||
|
Console.WriteLine("</deviceinfo>");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Assert(bool assert, string msg)
|
public static void Assert(bool assert, string msg)
|
||||||
|
|
35
src/Song.cs
35
src/Song.cs
|
@ -132,8 +132,15 @@ namespace Njb
|
||||||
if(frame == null) {
|
if(frame == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return frame.DataString;
|
switch(frame.FrameType) {
|
||||||
|
case SongFrameType.UInt16:
|
||||||
|
return Convert.ToString(frame.DataShort);
|
||||||
|
case SongFrameType.UInt32:
|
||||||
|
return Convert.ToString(frame.DataInt);
|
||||||
|
default:
|
||||||
|
return frame.DataString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ushort GetFrameShort(string label)
|
private ushort GetFrameShort(string label)
|
||||||
|
@ -142,9 +149,16 @@ namespace Njb
|
||||||
if(frame == null) {
|
if(frame == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return frame.DataShort;
|
switch(frame.FrameType) {
|
||||||
}
|
case SongFrameType.String:
|
||||||
|
return Convert.ToUInt16(frame.DataString);
|
||||||
|
case SongFrameType.UInt32:
|
||||||
|
return (ushort)frame.DataInt;
|
||||||
|
default:
|
||||||
|
return frame.DataShort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private uint GetFrameInt(string label)
|
private uint GetFrameInt(string label)
|
||||||
{
|
{
|
||||||
|
@ -152,8 +166,15 @@ namespace Njb
|
||||||
if(frame == null) {
|
if(frame == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return frame.DataInt;
|
switch(frame.FrameType) {
|
||||||
|
case SongFrameType.String:
|
||||||
|
return Convert.ToUInt32(frame.DataString);
|
||||||
|
case SongFrameType.UInt16:
|
||||||
|
return (uint)frame.DataShort;
|
||||||
|
default:
|
||||||
|
return frame.DataInt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddFrame(SongFrame frame)
|
private void AddFrame(SongFrame frame)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче