Author: jwilcox
Date: 2006-06-16 12:01:54 -0400 (Fri, 16 Jun 2006)
New Revision: 61803

Modified:
   trunk/ipod-sharp/ChangeLog
   trunk/ipod-sharp/src/PhotoDatabase.cs
Log:
2006-06-16  James Willcox  <[EMAIL PROTECTED]>

        * src/PhotoDatabase.cs: read/write the full size image records



Modified: trunk/ipod-sharp/ChangeLog
===================================================================
--- trunk/ipod-sharp/ChangeLog  2006-06-16 14:29:34 UTC (rev 61802)
+++ trunk/ipod-sharp/ChangeLog  2006-06-16 16:01:54 UTC (rev 61803)
@@ -1,5 +1,9 @@
 2006-06-16  James Willcox  <[EMAIL PROTECTED]>
 
+       * src/PhotoDatabase.cs: read/write the full size image records
+
+2006-06-16  James Willcox  <[EMAIL PROTECTED]>
+
        * Convert more stuff to use generic collections
 
 2006-06-15  James Willcox  <[EMAIL PROTECTED]>

Modified: trunk/ipod-sharp/src/PhotoDatabase.cs
===================================================================
--- trunk/ipod-sharp/src/PhotoDatabase.cs       2006-06-16 14:29:34 UTC (rev 
61802)
+++ trunk/ipod-sharp/src/PhotoDatabase.cs       2006-06-16 16:01:54 UTC (rev 
61803)
@@ -452,11 +452,15 @@
             this.Name = "mhod";
         }
 
-        public PhotoDetailRecord (bool isbe, ImageNameRecord name) : this 
(isbe) {
+        public PhotoDetailRecord (bool isbe, ImageNameRecord name, 
PhotoDetailType type) : this (isbe) {
             Type = PhotoDetailType.ThumbnailContainer;
             ImageName = name;
+            Type = type;
         }
 
+        public PhotoDetailRecord (bool isbe, PhotoDetailType type) : this 
(isbe, null, type) {
+        }
+
         public override void Read (BinaryReader reader) {
             base.Read (reader);
 
@@ -465,11 +469,10 @@
 
             switch (Type) {
             case PhotoDetailType.ThumbnailContainer:
+            case PhotoDetailType.ImageContainer:
                 ImageName = new ImageNameRecord (IsBE);
                 ImageName.Read (reader);
                 break;
-            case PhotoDetailType.ImageContainer:
-                throw new ApplicationException ("Not implemented yet");
             case PhotoDetailType.FileName:
                 ReadString (reader, true);
                 break;
@@ -513,10 +516,9 @@
 
             switch (Type) {
             case PhotoDetailType.ThumbnailContainer:
+            case PhotoDetailType.ImageContainer:
                 SaveChild (ImageName, out childBytes, out childLen);
                 break;
-            case PhotoDetailType.ImageContainer:
-                throw new ApplicationException ("not implemented yet");
             case PhotoDetailType.FileName:
                 childBytes = Encoding.Unicode.GetBytes (Value);
                 childLen = 12 + childBytes.Length;
@@ -548,10 +550,9 @@
 
             switch (Type) {
             case PhotoDetailType.ThumbnailContainer:
+            case PhotoDetailType.ImageContainer:
                 writer.Write (childBytes, 0, childLen);
                 break;
-            case PhotoDetailType.ImageContainer:
-                throw new ApplicationException ("not implemented yet");
             case PhotoDetailType.FileName:
                 WriteString (writer, childBytes, childPadding, true);
                 break;
@@ -638,6 +639,7 @@
         private int unknownOne;
         private int unknownTwo;
         private int sourceImageSize;
+        private ImageNameRecord fullName;
 
         private List<ImageNameRecord> names = new List<ImageNameRecord> ();
         
@@ -683,7 +685,12 @@
             for (int i = 0; i < numChildren; i++) {
                 PhotoDetailRecord detail = new PhotoDetailRecord (IsBE);
                 detail.Read (reader);
-                names.Add (detail.ImageName);
+
+                if (detail.Type == PhotoDetailType.ThumbnailContainer) {
+                    names.Add (detail.ImageName);
+                } else {
+                    fullName = detail.ImageName;
+                }
             }
         }
 
@@ -694,15 +701,19 @@
 
             List<PhotoDetailRecord> details = new List<PhotoDetailRecord> ();
             foreach (ImageNameRecord name in names) {
-                details.Add (new PhotoDetailRecord (IsBE, name));
+                details.Add (new PhotoDetailRecord (IsBE, name, 
PhotoDetailType.ThumbnailContainer));
             }
+
+            if (fullName != null) {
+                details.Add (new PhotoDetailRecord (IsBE, fullName, 
PhotoDetailType.ImageContainer));
+            }
             
             SaveChildren (details, out childBytes, out childLen);
 
             WriteName (writer);
             writer.Write (52 + PadLength);
             writer.Write (52 + PadLength + childLen);
-            writer.Write (names.Count);
+            writer.Write (details.Count);
             writer.Write (Id);
             writer.Write (TrackId);
             writer.Write (unknownOne);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to