Permalink
Browse files

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
  • Loading branch information...
1 parent eba7089 commit 826491a6edb87681bf86663036c3fc05c61878bf @abock abock committed May 8, 2006
Showing with 44 additions and 9 deletions.
  1. +9 −0 ChangeLog
  2. +7 −2 src/NjbTest.cs
  3. +28 −7 src/Song.cs
View
@@ -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
View
@@ -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);
@@ -56,9 +60,10 @@ public static void HalFdiDump()
Console.WriteLine(" </match>\n");
}
- Console.WriteLine(" <!-- End NJB devices -->");
-
+ Console.WriteLine(" <!-- End NJB devices -->");
Console.WriteLine("\n\n </match>");
+ Console.WriteLine(" </device>");
+ Console.WriteLine("</deviceinfo>");
}
public static void Assert(bool assert, string msg)
View
@@ -132,8 +132,15 @@ private string GetFrameString(string label)
if(frame == 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)
@@ -142,18 +149,32 @@ private ushort GetFrameShort(string label)
if(frame == null) {
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)
{
SongFrame frame = FindFrame(label);
if(frame == null) {
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)

0 comments on commit 826491a

Please sign in to comment.