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:
Aaron Bockover 2006-05-08 16:04:27 +00:00
Родитель eba708967e
Коммит 826491a6ed
3 изменённых файлов: 44 добавлений и 9 удалений

Просмотреть файл

@ -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>
0.3.0 Release

Просмотреть файл

@ -33,8 +33,12 @@ public class Test
{
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(" <!-- Begin NJB devices (generated by njb-sharp for libnjb compatible devices) -->\n");
foreach(DeviceId device in DeviceId.ListAll) {
Console.WriteLine(" <!-- {0} -->", device.Name);
Console.WriteLine(" <match key=\"usb.vendor_id\" int=\"0x{0:x4}\">", device.VendorId);
@ -57,8 +61,9 @@ public class Test
}
Console.WriteLine(" <!-- End NJB devices -->");
Console.WriteLine("\n\n </match>");
Console.WriteLine(" </device>");
Console.WriteLine("</deviceinfo>");
}
public static void Assert(bool assert, string msg)

Просмотреть файл

@ -133,7 +133,14 @@ namespace Njb
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)
@ -143,8 +150,15 @@ namespace Njb
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)
{
@ -153,7 +167,14 @@ namespace Njb
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)