commit 5eb621c3e69f7c9ab65b6cf7d6830a35018dc2f8
Author: Alan McGovern <a...@slacker.site>
Date:   Wed Jun 9 17:37:02 2010 +0100

    Directly access native struct instead of using a copy
    
    Refactor all the managed structs and wrapper classes to not use a stale
    cached copy of the native struct. Instead use unsafe code to directly
    read/write from the native pointer so we never have invalid data.
    
    Signed-off-by: Nathaniel McCallum <nathan...@natemccallum.com>

 bindings/mono/Makefile.include             |    2 +-
 bindings/mono/libgpod-sharp/Artwork.cs     |   22 +-
 bindings/mono/libgpod-sharp/Chapter.cs     |   12 +-
 bindings/mono/libgpod-sharp/ChapterData.cs |    4 +-
 bindings/mono/libgpod-sharp/Device.cs      |    6 +-
 bindings/mono/libgpod-sharp/GPodBase.cs    |   29 ++-
 bindings/mono/libgpod-sharp/ITDB.cs        |   12 +-
 bindings/mono/libgpod-sharp/IpodInfo.cs    |   33 ++-
 bindings/mono/libgpod-sharp/PhotoAlbum.cs  |   42 ++--
 bindings/mono/libgpod-sharp/PhotoDB.cs     |    8 +-
 bindings/mono/libgpod-sharp/Playlist.cs    |   45 ++-
 bindings/mono/libgpod-sharp/Track.cs       |  461 ++++++++++++++++-----------
 12 files changed, 406 insertions(+), 270 deletions(-)
---
diff --git a/bindings/mono/Makefile.include b/bindings/mono/Makefile.include
index b3ad247..46cdc62 100644
--- a/bindings/mono/Makefile.include
+++ b/bindings/mono/Makefile.include
@@ -18,7 +18,7 @@ all: $(ASSEMBLY_FILE)
 $(ASSEMBLY_FILE).mdb: $(ASSEMBLY_FILE)
 
 $(ASSEMBLY_FILE): $(SOURCES_BUILD)
-       $(MCS) -debug -target:$(TARGET) -out:$@ $(LINK) $(SOURCES_BUILD)
+       $(MCS) -debug -unsafe -target:$(TARGET) -out:$@ $(LINK) $(SOURCES_BUILD)
        @if [ -e $(srcdir)/$(notdir $...@.config) ]; then \
                cp $(srcdir)/$(notdir $...@.config) $(top_builddir)/bin; \
        fi;
diff --git a/bindings/mono/libgpod-sharp/Artwork.cs 
b/bindings/mono/libgpod-sharp/Artwork.cs
index 1de459e..b10b184 100644
--- a/bindings/mono/libgpod-sharp/Artwork.cs
+++ b/bindings/mono/libgpod-sharp/Artwork.cs
@@ -63,17 +63,17 @@ namespace GPod {
                }
        }
 
-       public class Artwork : GPodBase<Itdb_Artwork> {
-               public Thumbnail        Thumbnail               { get { return 
new Thumbnail(Struct.thumbnail); }
-                                                                               
          set { Struct.thumbnail = HandleRef.ToIntPtr(value.Handle); } }
-               public uint                     Rating                  { get { 
return Struct.rating / 20; }
-                                                                               
          set { Struct.rating = (value > 5 ? 5 : value) * 20; } }
-               public DateTime         TimeCreated             { get { return 
Artwork.time_tToDateTime (Struct.creation_date); }
-                                                                               
          set { Struct.creation_date = Artwork.DateTimeTotime_t(value); } }
-               public DateTime         TimeDigitized   { get { return 
Artwork.time_tToDateTime (Struct.digitized_date); }
-                                                                               
          set { Struct.digitized_date = Artwork.DateTimeTotime_t(value); } }
-               public uint                     Size                    { get { 
return Struct.artwork_size; }
-                                                                               
          set { Struct.artwork_size = value; } }
+       public unsafe class Artwork : GPodBase<Itdb_Artwork> {
+               public Thumbnail        Thumbnail               { get { return 
new Thumbnail(((Itdb_Artwork *) Native)->thumbnail); }
+                                                                               
          set { ((Itdb_Artwork *) Native)->thumbnail = 
HandleRef.ToIntPtr(value.Handle); } }
+               public uint                     Rating                  { get { 
return ((Itdb_Artwork *) Native)->rating / 20; }
+                                                                               
          set { ((Itdb_Artwork *) Native)->rating = (value > 5 ? 5 : value) * 
20; } }
+               public DateTime         TimeCreated             { get { return 
Artwork.time_tToDateTime (((Itdb_Artwork *) Native)->creation_date); }
+                                                                               
          set { ((Itdb_Artwork *) Native)->creation_date = 
Artwork.DateTimeTotime_t(value); } }
+               public DateTime         TimeDigitized   { get { return 
Artwork.time_tToDateTime (((Itdb_Artwork *) Native)->digitized_date); }
+                                                                               
          set { ((Itdb_Artwork *) Native)->digitized_date = 
Artwork.DateTimeTotime_t(value); } }
+               public uint                     Size                    { get { 
return ((Itdb_Artwork *) Native)->artwork_size; }
+                                                                               
          set { ((Itdb_Artwork *) Native)->artwork_size = value; } }
 
                public Artwork(IntPtr handle, bool borrowed) : base(handle, 
borrowed) {}
                public Artwork(IntPtr handle) : base(handle) {}
diff --git a/bindings/mono/libgpod-sharp/Chapter.cs 
b/bindings/mono/libgpod-sharp/Chapter.cs
index 5969080..a2cd9e6 100644
--- a/bindings/mono/libgpod-sharp/Chapter.cs
+++ b/bindings/mono/libgpod-sharp/Chapter.cs
@@ -25,7 +25,7 @@ namespace GPod {
                [StructLayout (LayoutKind.Sequential)]
                public struct Itdb_Chapter {
                    public uint   startpos;
-                   public string chaptertitle;
+                   public IntPtr chaptertitle;
                    // Ignore the rest
                        
                        [DllImport ("gpod")]
@@ -39,7 +39,7 @@ namespace GPod {
                }
        }
 
-       public class Chapter : GPodBase<Itdb_Chapter> { 
+       public unsafe class Chapter : GPodBase<Itdb_Chapter> {
                public Chapter(IntPtr handle, bool borrowed) : base(handle, 
borrowed) {}
                public Chapter(IntPtr handle) : base(handle) {}
                public Chapter() : this(Itdb_Chapter.itdb_chapter_new(), false) 
{}
@@ -51,13 +51,13 @@ namespace GPod {
                protected override void Destroy() { 
Itdb_Chapter.itdb_chapter_free(Handle); }
                
                public uint StartPosition {
-                       get { return Struct.startpos; }
-                       set { Struct.startpos = value; }
+                       get { return ((Itdb_Chapter *) Native)->startpos; }
+                       set { ((Itdb_Chapter *) Native)->startpos = value; }
                }
                
                public string Title {
-                       get { return Struct.chaptertitle; }
-                       set { Struct.chaptertitle = value; }
+                       get { return PtrToStringUTF8 (((Itdb_Chapter *) 
Native)->chaptertitle); }
+                       set { var x = (Itdb_Chapter *) Native; 
ReplaceStringUTF8 (ref x->chaptertitle, value); }
                }
        }
 }
\ No newline at end of file
diff --git a/bindings/mono/libgpod-sharp/ChapterData.cs 
b/bindings/mono/libgpod-sharp/ChapterData.cs
index 00b0b03..bdc6310 100644
--- a/bindings/mono/libgpod-sharp/ChapterData.cs
+++ b/bindings/mono/libgpod-sharp/ChapterData.cs
@@ -61,13 +61,13 @@ namespace GPod {
                }
        }
        
-       public class ChapterData : GPodBase<Itdb_ChapterData> { 
+       public unsafe class ChapterData : GPodBase<Itdb_ChapterData> {  
                public ChapterData(IntPtr handle, bool borrowed) : base(handle, 
borrowed) {}
                public ChapterData(IntPtr handle) : base(handle) {}
                public ChapterData() : 
this(Itdb_ChapterData.itdb_chapterdata_new(), false) {}
                public ChapterData(ChapterData other) : 
this(Itdb_ChapterData.itdb_chapterdata_duplicate(other.Handle), false) {}
                protected override void Destroy() { 
Itdb_ChapterData.itdb_chapterdata_free(Handle); }
                
-               public IList<Chapter> Chapters { get { return new 
ChapterList(true, Handle, Struct.chapters); } }
+               public IList<Chapter> Chapters { get { return new 
ChapterList(true, Handle, ((Itdb_ChapterData *) Native)->chapters); } }
        }
 }
diff --git a/bindings/mono/libgpod-sharp/Device.cs 
b/bindings/mono/libgpod-sharp/Device.cs
index 7ee0eb7..3e162a7 100644
--- a/bindings/mono/libgpod-sharp/Device.cs
+++ b/bindings/mono/libgpod-sharp/Device.cs
@@ -24,7 +24,7 @@ namespace GPod {
        
        namespace native {
                public struct Itdb_Device {
-                       public string mountpoint;
+                       public IntPtr mountpoint;
                        // Ignore the rest
        
                        [DllImport ("gpod")]
@@ -84,7 +84,7 @@ namespace GPod {
                }
        }*/
        
-       public class Device : GPodBase<Itdb_Device> {
+       public unsafe class Device : GPodBase<Itdb_Device> {
                public bool             SupportsArtwork                 { get { 
return Itdb_Device.itdb_device_supports_artwork(Handle); } }
                public bool             SupportsChapterImage    { get { return 
Itdb_Device.itdb_device_supports_chapter_image(Handle); } }
                public bool             SupportsPhoto                   { get { 
return Itdb_Device.itdb_device_supports_photo(Handle); } }
@@ -92,7 +92,7 @@ namespace GPod {
                public bool             SupportsVideo                   { get { 
return Itdb_Device.itdb_device_supports_video(Handle); } }
                //public SysInfo        SysInfo                                 
{ get { return new SysInfo(Handle); } }
                public IpodInfo IpodInfo                                { get { 
return new IpodInfo(Itdb_Device.itdb_device_get_ipod_info(Handle), true); } }
-               public string   Mountpoint                              { get { 
return Struct.mountpoint; }
+               public string   Mountpoint                              { get { 
return PtrToStringUTF8 (((Itdb_Device *)Native)->mountpoint); }
                                                                                
                  set { Itdb_Device.itdb_device_set_mountpoint(Handle, value); 
} }
                
                public Device(IntPtr handle, bool borrowed) : base(handle, 
borrowed) {}
diff --git a/bindings/mono/libgpod-sharp/GPodBase.cs 
b/bindings/mono/libgpod-sharp/GPodBase.cs
index cb29e77..d1840d3 100644
--- a/bindings/mono/libgpod-sharp/GPodBase.cs
+++ b/bindings/mono/libgpod-sharp/GPodBase.cs
@@ -53,6 +53,29 @@ namespace GPod {
        public abstract class GPodBase<T> : IGPodBase, IDisposable {
                //protected static Dictionary<IntPtr, int> RefCounter = new 
RefCounter();
                
+               protected static IntPtr StringToPtrUTF8 (string s)
+               {
+                       if (s == null)
+                               return IntPtr.Zero;
+                       // We should P/Invoke g_strdup with 's' and return that 
pointer.
+                       return Marshal.StringToHGlobalAuto (s);
+               }
+               
+               protected static string PtrToStringUTF8 (IntPtr ptr)
+               {
+                       // FIXME: Enforce this to be UTF8, this actually uses 
platform encoding
+                       // which is probably going to be utf8 on most linuxes.
+                       return Marshal.PtrToStringAuto (ptr);
+               }
+               
+               protected static void ReplaceStringUTF8 (ref IntPtr ptr, string 
str)
+               {
+                       if (ptr != IntPtr.Zero) {
+                               // FIXME: g_free it
+                       }
+                       ptr = StringToPtrUTF8 (str);
+               }
+               
                protected static IntPtr DateTimeTotime_t (DateTime time) {
                        DateTime epoch = new DateTime (1970, 1, 1, 0, 0, 0);
                        return new IntPtr (((int) 
time.ToUniversalTime().Subtract(epoch).TotalSeconds));
@@ -64,15 +87,17 @@ namespace GPod {
                        return epoch.AddSeconds((int)time_t + utc_offset);
                }
                
+               internal IntPtr Native {
+                       get { return HandleRef.ToIntPtr (Handle); }
+               }
+               
                public    HandleRef Handle;
-               protected T                     Struct;
                protected bool          Borrowed;
                
                public GPodBase(IntPtr handle) : this(handle, true) {}
                public GPodBase(IntPtr handle, bool borrowed) {
                        Borrowed = borrowed;
                        Handle   = new HandleRef (this, handle);
-                       Struct   = (T) 
Marshal.PtrToStructure(HandleRef.ToIntPtr(Handle), typeof(T));
                }
                ~GPodBase() { if (!Borrowed) Destroy(); }
                
diff --git a/bindings/mono/libgpod-sharp/ITDB.cs 
b/bindings/mono/libgpod-sharp/ITDB.cs
index 3a8cdd6..4b49dcb 100644
--- a/bindings/mono/libgpod-sharp/ITDB.cs
+++ b/bindings/mono/libgpod-sharp/ITDB.cs
@@ -27,7 +27,7 @@ namespace GPod {
                public struct Itdb_iTunesDB {
                        public IntPtr tracks;
                public IntPtr playlists;
-               public string filename;
+               public IntPtr filename;
                public IntPtr device;
                        // Ignore everything else
                                        
@@ -99,7 +99,7 @@ namespace GPod {
                protected override void DoUnlink(int index) { 
Itdb_iTunesDB.itdb_playlist_unlink(this[index].Handle); }
        }
 
-       public class ITDB : GPodBase<Itdb_iTunesDB> {
+       public unsafe class ITDB : GPodBase<Itdb_iTunesDB> {
                public static bool InitIpod(string mountpoint, string 
model_number, string ipod_name) {
                        IntPtr gerror;
                        bool res = Itdb_iTunesDB.itdb_init_ipod(mountpoint, 
model_number, ipod_name, out gerror);
@@ -123,13 +123,13 @@ namespace GPod {
                        return Itdb_iTunesDB.itdb_get_music_dir (mountpoint);
                }
                
-               public IList<Track>             Tracks                          
                { get { return new ITDBTrackList(true, Handle, Struct.tracks); 
} }
-               public IList<Playlist>  Playlists                               
        { get { return new ITDBPlaylistList(true, Handle, Struct.playlists); } }
+               public IList<Track>             Tracks                          
                { get { return new ITDBTrackList(true, Handle, ((Itdb_iTunesDB 
*) Native)->tracks); } }
+               public IList<Playlist>  Playlists                               
        { get { return new ITDBPlaylistList(true, Handle, ((Itdb_iTunesDB *) 
Native)->playlists); } }
                public Playlist                 MasterPlaylist                  
        { get { return new Playlist(Itdb_iTunesDB.itdb_playlist_mpl(Handle)); } 
}
                public Playlist                 PodcastsPlaylist                
        { get { return new 
Playlist(Itdb_iTunesDB.itdb_playlist_podcasts(Handle)); } }
-               public Device                   Device                          
                { get { return new Device(Struct.device, true); } }
+               public Device                   Device                          
                { get { return new Device(((Itdb_iTunesDB *) Native)->device, 
true); } }
                public uint                             
NonTransferredTrackCount        { get { return 
Itdb_iTunesDB.itdb_tracks_number_nontransferred(Handle); } }
-               public string                   Mountpoint                      
                { get { return 
Marshal.PtrToStringAuto(Itdb_iTunesDB.itdb_get_mountpoint(Handle)); }
+               public string                   Mountpoint                      
                { get { return PtrToStringUTF8 
(Itdb_iTunesDB.itdb_get_mountpoint(Handle)); }
                                                                                
                                          set { 
Itdb_iTunesDB.itdb_set_mountpoint(Handle, value); } }
                
                public ITDB(IntPtr handle, bool borrowed)       : base(handle, 
borrowed) {}
diff --git a/bindings/mono/libgpod-sharp/IpodInfo.cs 
b/bindings/mono/libgpod-sharp/IpodInfo.cs
index 55b9f2f..0bc0fb1 100644
--- a/bindings/mono/libgpod-sharp/IpodInfo.cs
+++ b/bindings/mono/libgpod-sharp/IpodInfo.cs
@@ -23,7 +23,7 @@ namespace GPod {
        
        namespace native {
                public struct Itdb_IpodInfo {
-                       public string         model_number;
+                       public IntPtr         model_number;
                        public double         capacity;
                        public IpodModel      ipod_model;
                        public IpodGeneration ipod_generation;
@@ -115,7 +115,7 @@ namespace GPod {
            IphoneBlack,
        }
 
-       public class IpodInfo : GPodBase<Itdb_IpodInfo> {               
+       public unsafe class IpodInfo : GPodBase<Itdb_IpodInfo> {                
                public static IpodInfo[] GetTable() {
                        IntPtr table = 
Itdb_IpodInfo.itdb_info_get_ipod_info_table();
                        
@@ -133,12 +133,29 @@ namespace GPod {
                        return retval;
                }
                
-               public string                   ModelNumber                     
{ get { return Struct.model_number; } }
-               public double                   Capacity                        
{ get { return Struct.capacity; } }
-               public IpodModel                Model                           
{ get { return Struct.ipod_model; } }
-               public IpodGeneration   Generation                      { get { 
return Struct.ipod_generation; } }
-               public string                   ModelString                     
{ get { return 
Marshal.PtrToStringAnsi(Itdb_IpodInfo.itdb_info_get_ipod_model_name_string(this.Model));
 } }
-               public string                   GenerationString        { get { 
return 
Marshal.PtrToStringAnsi(Itdb_IpodInfo.itdb_info_get_ipod_generation_string(this.Generation));
 } }
+               public double Capacity {
+                       get { return ((Itdb_IpodInfo *) Native)->capacity; }
+               }
+               
+               public IpodGeneration Generation {
+                       get { return ((Itdb_IpodInfo *) 
Native)->ipod_generation; }
+               }
+               
+               public string GenerationString {
+                       get { return PtrToStringUTF8 
(Itdb_IpodInfo.itdb_info_get_ipod_generation_string(this.Generation)); }
+               }
+               
+               public IpodModel Model {
+                       get { return ((Itdb_IpodInfo *) Native)->ipod_model; }
+               }
+               
+               public string ModelNumber {
+                       get { return PtrToStringUTF8 (((Itdb_IpodInfo *) 
Native)->model_number); }
+               }
+               
+               public string ModelString {
+                       get { return PtrToStringUTF8 
(Itdb_IpodInfo.itdb_info_get_ipod_model_name_string(this.Model)); }
+               }
                
                public IpodInfo(IntPtr handle, bool borrowed) : base(handle, 
borrowed) {}
                public IpodInfo(IntPtr handle)                : base(handle) {}
diff --git a/bindings/mono/libgpod-sharp/PhotoAlbum.cs 
b/bindings/mono/libgpod-sharp/PhotoAlbum.cs
index 1cc3e35..3f0ea5e 100644
--- a/bindings/mono/libgpod-sharp/PhotoAlbum.cs
+++ b/bindings/mono/libgpod-sharp/PhotoAlbum.cs
@@ -26,7 +26,7 @@ namespace GPod {
        namespace native {
                public struct Itdb_PhotoAlbum {
                        public IntPtr photodb;
-                       public string name;
+                       public IntPtr name;
                        public IntPtr members;
                        public byte   album_type;
                        public byte   playmusic;
@@ -67,31 +67,31 @@ namespace GPod {
                protected override void DoUnlink(int index) { 
Itdb_PhotoDB.itdb_photodb_photoalbum_unlink(this[index].Handle); }
        }
        
-       public class PhotoAlbum : GPodBase<Itdb_PhotoAlbum> {
+       public unsafe class PhotoAlbum : GPodBase<Itdb_PhotoAlbum> {
                public PhotoAlbum(IntPtr handle, bool borrowed) : base(handle, 
borrowed) {}
                public PhotoAlbum(IntPtr handle)                                
: base(handle) {}
                public PhotoAlbum(string albumname)                             
: base(Itdb_PhotoAlbum.itdb_photodb_photoalbum_new(albumname), false) {}
                protected override void Destroy() { 
Itdb_PhotoAlbum.itdb_photodb_photoalbum_free(Handle); }
                
-               public IList<Artwork>           Photos                          
{ get { return new PhotoAlbumArtworkList(Handle, Struct.members); } }
-               public string                           Name                    
        { get { return Struct.name; }
-                                                                               
                                  set { Struct.name = value; } }
-               public bool                                     PlayMusic       
                { get { return Struct.playmusic == 1; }
-                                                                               
                                  set { Struct.playmusic = (byte) (value ? 1 : 
0); } }
-               public bool                                     Repeat          
                { get { return Struct.repeat == 1; }
-                                                                               
                                  set { Struct.repeat = (byte) (value ? 1 : 0); 
} }
-               public bool                                     Random          
                { get { return Struct.random == 1; }
-                                                                               
                                  set { Struct.random = (byte) (value ? 1 : 0); 
} }
-               public bool                                     ShowTitles      
                { get { return Struct.show_titles == 1; }
-                                                                               
                                  set { Struct.show_titles = (byte) (value ? 1 
: 0); } }
-               public TransitionDirection      TransitionDirection     { get { 
return (TransitionDirection) Struct.transition_direction; }
-                                                                               
                                  set { Struct.transition_direction = (byte) 
value; } }
-               public int                                      SlideDuration   
        { get { return Struct.slide_duration; }
-                                                                               
                                  set { Struct.slide_duration = value; } }
-               public int                                      
TransitionDuration      { get { return Struct.transition_duration; }
-                                                                               
                                  set { Struct.transition_duration = value; } }
+               public IList<Artwork>           Photos                          
{ get { return new PhotoAlbumArtworkList(Handle, ((Itdb_PhotoAlbum *) 
Native)->members); } }
+               public string                           Name                    
        { get { return PtrToStringUTF8 (((Itdb_PhotoAlbum *) Native)->name); }
+                                                                               
                                  set { var x = (Itdb_PhotoAlbum *) Native; 
ReplaceStringUTF8 (ref x->name, value); } }
+               public bool                                     PlayMusic       
                { get { return ((Itdb_PhotoAlbum *) Native)->playmusic == 1; }
+                                                                               
                                  set { ((Itdb_PhotoAlbum *) Native)->playmusic 
= (byte) (value ? 1 : 0); } }
+               public bool                                     Repeat          
                { get { return ((Itdb_PhotoAlbum *) Native)->repeat == 1; }
+                                                                               
                                  set { ((Itdb_PhotoAlbum *) Native)->repeat = 
(byte) (value ? 1 : 0); } }
+               public bool                                     Random          
                { get { return ((Itdb_PhotoAlbum *) Native)->random == 1; }
+                                                                               
                                  set { ((Itdb_PhotoAlbum *) Native)->random = 
(byte) (value ? 1 : 0); } }
+               public bool                                     ShowTitles      
                { get { return ((Itdb_PhotoAlbum *) Native)->show_titles == 1; }
+                                                                               
                                  set { ((Itdb_PhotoAlbum *) 
Native)->show_titles = (byte) (value ? 1 : 0); } }
+               public TransitionDirection      TransitionDirection     { get { 
return (TransitionDirection) ((Itdb_PhotoAlbum *) 
Native)->transition_direction; }
+                                                                               
                                  set { ((Itdb_PhotoAlbum *) 
Native)->transition_direction = (byte) value; } }
+               public int                                      SlideDuration   
        { get { return ((Itdb_PhotoAlbum *) Native)->slide_duration; }
+                                                                               
                                  set { ((Itdb_PhotoAlbum *) 
Native)->slide_duration = value; } }
+               public int                                      
TransitionDuration      { get { return ((Itdb_PhotoAlbum *) 
Native)->transition_duration; }
+                                                                               
                                  set { ((Itdb_PhotoAlbum *) 
Native)->transition_duration = value; } }
                // TODO: Do I need to do this?
-               //public Track                          Song                    
        { get { return Struct.transition_duration; }
-               //                                                              
                                  set { Struct.transition_duration = value; } }
+               //public Track                          Song                    
        { get { return ((Itdb_PhotoAlbum *) Native)->transition_duration; }
+               //                                                              
                                  set { ((Itdb_PhotoAlbum *) 
Native)->transition_duration = value; } }
        }
 }
diff --git a/bindings/mono/libgpod-sharp/PhotoDB.cs 
b/bindings/mono/libgpod-sharp/PhotoDB.cs
index 707efeb..62db030 100644
--- a/bindings/mono/libgpod-sharp/PhotoDB.cs
+++ b/bindings/mono/libgpod-sharp/PhotoDB.cs
@@ -83,14 +83,14 @@ namespace GPod {
                protected override void DoUnlink(int index) { 
Itdb_PhotoDB.itdb_photodb_photoalbum_unlink(this[index].Handle); }
        }
        
-       public class PhotoDB : GPodBase<Itdb_PhotoDB> {
+       public unsafe class PhotoDB : GPodBase<Itdb_PhotoDB> {
                public static PhotoDB Create(string mountpoint) {
                        return new 
PhotoDB(Itdb_PhotoDB.itdb_photodb_create(mountpoint), false);
                }
                
-               public IList<Artwork>           Photos                          
                { get { return new PhotoDBArtworkList(true, Handle, 
Struct.photos); } }
-               public IList<PhotoAlbum>        PhotoAlbums                     
                { get { return new PhotoDBPhotoAlbumList(true, Handle, 
Struct.photoalbums); } }
-               public Device                           Device                  
                        { get { return new Device(Struct.device, true); } }
+               public IList<Artwork>           Photos                          
                { get { return new PhotoDBArtworkList(true, Handle, 
((Itdb_PhotoDB *) Native)->photos); } }
+               public IList<PhotoAlbum>        PhotoAlbums                     
                { get { return new PhotoDBPhotoAlbumList(true, Handle, 
((Itdb_PhotoDB *) Native)->photoalbums); } }
+               public Device                           Device                  
                        { get { return new Device(((Itdb_PhotoDB *) 
Native)->device, true); } }
                
                public PhotoDB(IntPtr handle, bool borrowed)    : base(handle, 
borrowed) {}
                public PhotoDB(string mountpoint)                               
: base(itdb_photodb_parse_wrapped(mountpoint), false) {}
diff --git a/bindings/mono/libgpod-sharp/Playlist.cs 
b/bindings/mono/libgpod-sharp/Playlist.cs
index 521b567..6704012 100644
--- a/bindings/mono/libgpod-sharp/Playlist.cs
+++ b/bindings/mono/libgpod-sharp/Playlist.cs
@@ -26,7 +26,7 @@ namespace GPod {
        namespace native {
                public struct Itdb_Playlist {
                    public IntPtr itdb;
-                   public string name;
+                   public IntPtr name;
                    public byte   type;
                    public byte   flag1;
                    public byte   flag2;
@@ -96,23 +96,32 @@ namespace GPod {
                protected override void DoUnlink(int index) { 
Itdb_Playlist.itdb_playlist_remove_track(this.handle, this[index].Handle); }
        }
        
-       public class Playlist : GPodBase<Itdb_Playlist> {
-               public ITDB                             ITDB                    
        { get { return new ITDB(Struct.itdb, true); } }
-               public IList<Track>                     Tracks                  
        { get { return new PlaylistTrackList(Handle, Struct.members); } }
-               public string                           Name                    
        { get { return Struct.name; }
-                                                                               
                                  set { Struct.name = value; } }
-               public bool                             IsSmartPlaylist         
{ get { return Struct.is_spl; }
-                                                                               
                                  set { Struct.is_spl = value; } }
-               public DateTime                         TimeCreated             
        { get { return Artwork.time_tToDateTime(Struct.timestamp); }
-                                                                               
                                  set { Struct.timestamp = 
Artwork.DateTimeTotime_t(value); } }
-               public ulong                            ID                      
                { get { return Struct.id; }
-                                                                               
                                  set { Struct.id = value; } }
-               public PlaylistSortOrder        SortOrder                       
{ get { return Struct.sortorder; }
-                                                                               
                                  set { Struct.sortorder = value; } }
-               public bool                                     IsPodcast       
                { get { return Struct.podcastflag == 1; }
-                                                                               
                                  set { Struct.podcastflag = (uint) (value ? 1 
: 0); } }
-               public bool                                     IsMaster        
                { get { return (Struct.type & 0xff) == 1; }
-                                                                               
                                  set { Struct.type = (byte) (value ? 1 : 0); } 
}
+       public unsafe class Playlist : GPodBase<Itdb_Playlist> {
+               public ITDB ITDB {
+                       get { return new ITDB(((Itdb_Playlist *) Native)->itdb, 
true); }
+               }
+               
+               public IList<Track> Tracks {
+                       get { return new PlaylistTrackList(Handle, 
((Itdb_Playlist *) Native)->members); }
+               }
+               
+               public string Name {
+                       get { return PtrToStringUTF8 (((Itdb_Playlist *) 
Native)->name); }
+                       set { var x = (Itdb_Playlist *) Native; 
ReplaceStringUTF8 (ref x->name, value); }
+               }
+               
+               public bool                             IsSmartPlaylist         
{ get { return ((Itdb_Playlist *) Native)->is_spl; }
+                                                                               
                                  set { ((Itdb_Playlist *) Native)->is_spl = 
value; } }
+               public DateTime                         TimeCreated             
        { get { return Artwork.time_tToDateTime(((Itdb_Playlist *) 
Native)->timestamp); }
+                                                                               
                                  set { ((Itdb_Playlist *) Native)->timestamp = 
Artwork.DateTimeTotime_t(value); } }
+               public ulong                            ID                      
                { get { return ((Itdb_Playlist *) Native)->id; }
+                                                                               
                                  set { ((Itdb_Playlist *) Native)->id = value; 
} }
+               public PlaylistSortOrder        SortOrder                       
{ get { return ((Itdb_Playlist *) Native)->sortorder; }
+                                                                               
                                  set { ((Itdb_Playlist *) Native)->sortorder = 
value; } }
+               public bool                                     IsPodcast       
                { get { return ((Itdb_Playlist *) Native)->podcastflag == 1; }
+                                                                               
                                  set { ((Itdb_Playlist *) Native)->podcastflag 
= (uint) (value ? 1 : 0); } }
+               public bool                                     IsMaster        
                { get { return (((Itdb_Playlist *) Native)->type & 0xff) == 1; }
+                                                                               
                                  set { ((Itdb_Playlist *) Native)->type = 
(byte) (value ? 1 : 0); } }
 
                public Playlist(IntPtr handle, bool borrowed) : base(handle, 
borrowed) {}
                public Playlist(IntPtr handle) : base(handle) {}
diff --git a/bindings/mono/libgpod-sharp/Track.cs 
b/bindings/mono/libgpod-sharp/Track.cs
index 71e4745..3c342f9 100644
--- a/bindings/mono/libgpod-sharp/Track.cs
+++ b/bindings/mono/libgpod-sharp/Track.cs
@@ -22,36 +22,37 @@ namespace GPod {
        using Gdk;
        using native;
        
+       
        namespace native {
                [StructLayout (LayoutKind.Sequential)]
                public struct Itdb_Track {
-                       public IntPtr    itdb;
-                       public string    title;
-                       public string    ipod_path;
-                       public string    album;
-                       public string    artist;
-                       public string    genre;
-                       public string    filetype;
-                       public string    comment;
-                       public string    category;
-                       public string    composer;
-                       public string    grouping;
-                       public string    description;
-                       public string    podcasturl;
-                       public string    podcastrss;
-                       public IntPtr    chapterdata;
-                       public string    subtitle;
-                       public string    tvshow;
-                       public string    tvepisode;
-                       public string    tvnetwork;
-                       public string    albumartist;
-                       public string    keywords;
-                       public string    sort_artist;
-                       public string    sort_title;
-                       public string    sort_album;
-                       public string    sort_albumartist;
-                       public string    sort_composer;
-                       public string    sort_tvshow;
+                       public IntPtr           itdb;
+                       public IntPtr           title;
+                       public IntPtr           ipod_path;
+                       public IntPtr           album;
+                       public IntPtr           artist;
+                       public IntPtr           genre;
+                       public IntPtr           filetype;
+                       public IntPtr           comment;
+                       public IntPtr           category;
+                       public IntPtr           composer;
+                       public IntPtr           grouping;
+                       public IntPtr           description;
+                       public IntPtr           podcasturl;
+                       public IntPtr           podcastrss;
+                       public IntPtr           chapterdata;
+                       public IntPtr           subtitle;
+                       public IntPtr           tvshow;
+                       public IntPtr           tvepisode;
+                       public IntPtr           tvnetwork;
+                       public IntPtr           albumartist;
+                       public IntPtr           keywords;
+                       public IntPtr           sort_artist;
+                       public IntPtr           sort_title;
+                       public IntPtr           sort_album;
+                       public IntPtr           sort_albumartist;
+                       public IntPtr           sort_composer;
+                       public IntPtr           sort_tvshow;
                        public uint      id;
                        public int       size;
                        public int       tracklen;
@@ -168,167 +169,251 @@ namespace GPod {
                MusicTVShow = 0x0060,
        }
        
-       public class Track : GPodBase<Itdb_Track> {
-               public bool                     HasThumbnails                   
        { get { return Itdb_Track.itdb_track_has_thumbnails(Handle); } }
-               public ITDB             ITDB                                    
        { get { return new ITDB(Struct.itdb, true); } }
-               public string           Title                                   
        { get { return Struct.title; }
-                                                                               
                                  set { Struct.title = value; } }
-               public string           IpodPath                                
        { get { return Struct.ipod_path; } 
-                                                                               
                                  set { Struct.ipod_path = value; } }
-               public string           Album                                   
        { get { return Struct.album; }
-                                                                               
                                  set { Struct.album = value; } }
-               public string           Artist                                  
        { get { return Struct.artist; }
-                                                                               
                                  set { Struct.artist = value; } }
-               public string           Genre                                   
        { get { return Struct.genre; }
-                                                                               
                                  set { Struct.genre = value; } }
-               public string           Filetype                                
        { get { return Struct.filetype; }
-                                                                               
                                  set { Struct.filetype = value; } }
-               public string           Comment                                 
        { get { return Struct.comment; }
-                                                                               
                                  set { Struct.comment = value; } }
-               public string           Category                                
        { get { return Struct.category; } 
-                                                                               
                                  set { Struct.category = value; } }
-               public string           Composer                                
        { get { return Struct.composer; }
-                                                                               
                                  set { Struct.composer = value; } }
-               public string           Grouping                                
        { get { return Struct.grouping; }
-                                                                               
                                  set { Struct.grouping = value; } }
-               public string           Description                             
        { get { return Struct.description; }
-                                                                               
                                  set { Struct.description = value; } }
-               public string           PodcastURL                              
        { get { return Struct.podcasturl; }
-                                                                               
                                  set { Struct.podcasturl = value; } }
-               public string           PodcastRSS                              
        { get { return Struct.podcastrss; }
-                                                                               
                                  set { Struct.podcastrss = value; } }
-               public ChapterData      ChapterData                             
        { get { return new ChapterData(Struct.chapterdata); }
-                                                                               
                                  set { Struct.chapterdata = 
HandleRef.ToIntPtr(value.Handle); } }      
-               public string           Subtitle                                
        { get { return Struct.subtitle; }
-                                                                               
                                  set { Struct.subtitle = value; } }
-               public string           TVShow                                  
        { get { return Struct.tvshow; }
-                                                                               
                                  set { Struct.tvshow = value; } }
-               public string           TVEpisode                               
        { get { return Struct.tvepisode; }
-                                                                               
                                  set { Struct.tvepisode = value; } }
-               public string           TVNetwork                               
        { get { return Struct.tvnetwork; }
-                                                                               
                                  set { Struct.tvnetwork = value; } }
-               public string           AlbumArtist                             
        { get { return Struct.albumartist; }
-                                                                               
                                  set { Struct.albumartist = value; } }
-               public string           Keywords                                
        { get { return Struct.keywords; }
-                                                                               
                                  set { Struct.keywords = value; } }
-               public string           SortArtist                              
        { get { return Struct.sort_artist; }
-                                                                               
                                  set { Struct.sort_artist = value; } }
-               public string           SortTitle                               
        { get { return Struct.sort_title; } 
-                                                                               
                                  set { Struct.sort_title = value; } }
-               public string           SortAlbum                               
        { get { return Struct.sort_album; }
-                                                                               
                                  set { Struct.sort_album = value; } }
-               public string           SortAlbumArtist                         
{ get { return Struct.sort_albumartist; }
-                                                                               
                                  set { Struct.sort_albumartist = value; } }
-               public string           SortComposer                            
{ get { return Struct.sort_composer; }
-                                                                               
                                  set { Struct.sort_composer = value; } }
-               public string           SortTVShow                              
        { get { return Struct.sort_tvshow; }
-                                                                               
                                  set { Struct.sort_tvshow = value; } }
-               public int                      Size                            
                { get { return Struct.size; }
-                                                                               
                                  set { Struct.size = value; } }
-               public int                      TrackLength                     
                { get { return Struct.tracklen; }
-                                                                               
                                  set { Struct.tracklen = value; } }
-               public int                      CDNumber                        
                { get { return Struct.cd_nr; }
-                                                                               
                                  set { Struct.cd_nr = value; } }
-               public int                      CDs                             
                        { get { return Struct.cds; }
-                                                                               
                                  set { Struct.cds = value; } }
-               public int                      TrackNumber                     
                { get { return Struct.track_nr; }
-                                                                               
                                  set { Struct.track_nr = value; } }
-               public int                      Tracks                          
                { get { return Struct.tracks; }
-                                                                               
                                  set { Struct.tracks = value; } }
-               public int                      Bitrate                         
                { get { return Struct.bitrate; }
-                                                                               
                                  set { Struct.bitrate = value; } }
-               public ushort           Samplerate                              
        { get { return Struct.samplerate; }
-                                                                               
                                  set { Struct.samplerate = value; } }
-               public ushort           SamplerateLow                           
{ get { return Struct.samplerate_low; }
-                                                                               
                                  set { Struct.samplerate_low = value; } }
-               public int                      Year                            
                { get { return Struct.year; }
-                                                                               
                                  set { Struct.year = value; } }
-               public int                      Volume                          
                { get { return Struct.volume; }
-                                                                               
                                  set { Struct.volume = value; } }
-               public uint                     Soundcheck                      
                { get { return Struct.soundcheck; }
-                                                                               
                                  set { Struct.soundcheck = value; } }
-               public DateTime         TimeAdded                               
        { get { return Track.time_tToDateTime (Struct.time_added); }
-                                                                               
                                  set { Struct.time_added = 
Track.DateTimeTotime_t (value); } }
-               public DateTime         TimeModified                            
{ get { return Track.time_tToDateTime (Struct.time_modified); }
-                                                                               
                                  set { Struct.time_modified = 
Track.DateTimeTotime_t (value); } }
-               public DateTime         TimePlayed                              
        { get { return Track.time_tToDateTime (Struct.time_played); }
-                                                                               
                                  set { Struct.time_played = 
Track.DateTimeTotime_t(value); } }
-               public uint                     BookmarkTime                    
        { get { return Struct.bookmark_time; }
-                                                                               
                                  set { Struct.bookmark_time = value; } }
-               public uint                     Rating                          
                { get { return Struct.rating; }
-                                                                               
                                  set { Struct.rating = value; } }
-               public uint                     PlayCount                       
                { get { return Struct.playcount; }
-                                                                               
                                  set { Struct.playcount = value; } }
-               public uint                     PlayCount2                      
                { get { return Struct.playcount2; }
-                                                                               
                                  set { Struct.playcount2 = value; } }
-               public uint                     RecentPlayCount                 
        { get { return Struct.recent_playcount; }
-                                                                               
                                  set { Struct.recent_playcount = value; } }
-               public bool                     Transferred                     
                { get { return Struct.transferred; }
-                                                                               
                                  set { Struct.transferred = value; } }
-               public short            BPM                                     
                { get { return Struct.BPM; }
-                                                                               
                                  set { Struct.BPM = value; } }
-               public byte             AppRating                               
        { get { return Struct.app_rating; }
-                                                                               
                                  set { Struct.app_rating = value; } }
-               public bool                     Compilation                     
                { get { return Struct.compilation == 1; }
-                                                                               
                                  set { Struct.compilation = (byte) (value ? 1 
: 0); } }
-               public uint                     StartTime                       
                { get { return Struct.starttime; }
-                                                                               
                                  set { Struct.starttime = value; } }
-               public uint                     StopTime                        
                { get { return Struct.stoptime; }
-                                                                               
                                  set { Struct.stoptime = value; } }
-               public bool                     Checked                         
                { get { return Struct.ischecked == 0; }
-                                                                               
                                  set { Struct.ischecked = (byte) (value ? 0x0 
: 0x1); } }
-               public ulong            DBID                                    
        { get { return Struct.dbid; }
-                                                                               
                                  set { Struct.dbid = value; } }
-               public uint                     DRMUserID                       
                { get { return Struct.drm_userid; }
-                                                                               
                                  set { Struct.drm_userid = value; } }
-               public uint                     Visible                         
                { get { return Struct.visible; }
-                                                                               
                                  set { Struct.visible = value; } }
-               public uint                     FiletypeMarker                  
        { get { return Struct.filetype_marker; }
-                                                                               
                                  set { Struct.filetype_marker = value; } }
-               public DateTime         TimeReleased                            
{ get { return Track.time_tToDateTime (Struct.time_released); }
-                                                                               
                                  set { Struct.time_released = 
Track.DateTimeTotime_t(value); } }
-               public bool                     ExplicitFlag                    
        { get { return Struct.explicit_flag == 1; }
-                                                                               
                                  set { Struct.explicit_flag = (byte) (value ? 
1 : 0); } }
-               public uint                     SkipCount                       
                { get { return Struct.skipcount; }
-                                                                               
                                  set { Struct.skipcount = value; } }   
-               public uint                     RecentSkipCount                 
        { get { return Struct.recent_skipcount; }
-                                                                               
                                  set { Struct.recent_skipcount = value; } }
-               public uint                     LastSkipped                     
                { get { return Struct.last_skipped; }
-                                                                               
                                  set { Struct.last_skipped = value; } }
-               public bool                     SkipWhenShuffling               
        { get { return Struct.skip_when_shuffling == 1; }
-                                                                               
                                  set { Struct.skip_when_shuffling = (byte) 
(value ? 1 : 0); } }
-               public bool                     RememberPlaybackPosition        
{ get { return Struct.remember_playback_position == 1; }
-                                                                               
                                  set { Struct.remember_playback_position = 
(byte) (value ? 1 : 0); } }
-               public byte                     Flag4                           
                { get { return Struct.flag4; }
-                                                                               
                                  set { Struct.flag4 = value; } }
-               public ulong            DBID2                                   
        { get { return Struct.dbid2; }
-                                                                               
                                  set { Struct.dbid2 = value; } }
-               public bool                     LyricsFlag                      
                { get { return Struct.lyrics_flag == 1; }
-                                                                               
                                  set { Struct.lyrics_flag = (byte) (value ? 1 
: 0); } }
-               public bool                     MovieFlag                       
                { get { return Struct.movie_flag == 1; }
-                                                                               
                                  set { Struct.movie_flag = (byte) (value ? 1 : 
0); } }
-               public bool                     MarkUnplayed                    
        { get { return Struct.mark_unplayed == 2; }
-                                                                               
                                  set { Struct.mark_unplayed = (byte) (value ? 
2 : 1); } }
-               public uint                     PreGap                          
                { get { return Struct.pregap; }
-                                                                               
                                  set { Struct.pregap = value; } }
-               public ulong            SampleCount                             
        { get { return Struct.samplecount; }
-                                                                               
                                  set { Struct.samplecount = value; } }
-               public uint                     PostGap                         
                { get { return Struct.postgap; }
-                                                                               
                                  set { Struct.postgap = value; } }
-               public MediaType        MediaType                               
        { get { return Struct.mediatype; }
-                                                                               
                                  set { Struct.mediatype = value; } }
-               public uint                     SeasonNumber                    
        { get { return Struct.season_nr; }
-                                                                               
                                  set { Struct.season_nr = value; } }
-               public uint                     EpisodeNumber                   
        { get { return Struct.episode_nr; }
-                                                                               
                                  set { Struct.episode_nr = value; } }
-               public uint                     GaplessData                     
                { get { return Struct.gapless_data; }
-                                                                               
                                  set { Struct.gapless_data = value; } }
-               public bool                     GaplessTrackFlag                
        { get { return Struct.gapless_track_flag == 1; }
-                                                                               
                                  set { Struct.gapless_track_flag = (byte) 
(value ? 1 : 0); } }
-               public bool                     GaplessAlbumFlag                
        { get { return Struct.gapless_album_flag == 1; }
-                                                                               
                                  set { Struct.gapless_album_flag = (byte) 
(value ? 1 : 0); } }
-               public Artwork          Artwork                                 
        { get { return new Artwork(Struct.artwork); }
-                                                                               
                                  set { Struct.artwork = 
HandleRef.ToIntPtr(value.Handle); } }
+       public unsafe class Track : GPodBase<Itdb_Track> {
+               public bool HasThumbnails {
+                       get { return Itdb_Track.itdb_track_has_thumbnails 
(Handle); }
+               }
+               
+               public ITDB ITDB {
+                       get { return new ITDB (((Itdb_Track *) Native)->itdb, 
true); }
+               }
+               
+               public string Title {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->title); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->title, value); }
+               }
+               
+               public string IpodPath {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->ipod_path); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->ipod_path, value); }
+               }
+               
+               public string Album {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->album); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->album, value); }
+               }
+               
+               public string Artist {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->artist); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->artist, value); }
+               }
+               
+               public string Genre {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->genre); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->genre, value); }
+               }
+               
+               public string Filetype {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->filetype); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->filetype, value); }
+               }
+               
+               public string Comment {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->comment); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->comment, value); }
+               }
+               
+               public string Category {
+                       
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->category); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->category, value); }
+               }
+               
+               public string Composer {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->composer); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->composer, value); }
+               }
+               
+               public string Grouping {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->grouping); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->grouping, value); }
+               }
+               
+               public string Description {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->description); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->description, value); }
+               }
+               
+               public string PodcastURL {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->podcasturl); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->podcasturl, value); }
+               }
+               
+               public string PodcastRSS {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->podcastrss); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->podcastrss, value); }
+               }
+               
+               public ChapterData      ChapterData {
+                       get { return new ChapterData (((Itdb_Track *) 
Native)->chapterdata); }
+                       set { ((Itdb_Track *) Native)->chapterdata = 
HandleRef.ToIntPtr(value.Handle); }
+               }
+               public string Subtitle {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->subtitle); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->subtitle, value); }
+               }
+               
+               public string TVShow {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->tvshow); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->tvshow, value); }
+               }
+               
+               public string TVEpisode {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->tvepisode); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->tvepisode, value); }
+               }
+               
+               public string TVNetwork {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->tvnetwork); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->tvnetwork, value); }
+               }
+               
+               public string AlbumArtist {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->albumartist); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->albumartist, value); }
+               }
+               
+               public string Keywords {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->keywords); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->keywords, value); }
+               }
+               
+               public string SortArtist {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->sort_artist); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->sort_artist, value); }
+               }
+               
+               public string SortTitle {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->sort_title); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->sort_title, value); }
+               }
+               
+               public string SortAlbum {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->sort_album); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->sort_album, value); }
+               }
+               
+               public string SortAlbumArtist {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->sort_albumartist); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->sort_albumartist, value); }
+               }
+               
+               public string SortComposer {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->sort_composer); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->sort_composer, value); }
+               }
+               
+               public string SortTVShow {
+                       get { return PtrToStringUTF8 (((Itdb_Track *) 
Native)->sort_tvshow); }
+                       set { var x = (Itdb_Track *) Native; ReplaceStringUTF8 
(ref x->sort_tvshow, value); }
+               }
+               
+               public int                      Size                            
                { get { return ((Itdb_Track *) Native)->size; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->size = value; 
} }
+               public int                      TrackLength                     
                { get { return ((Itdb_Track *) Native)->tracklen; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->tracklen = 
value; } }
+               public int                      CDNumber                        
                { get { return ((Itdb_Track *) Native)->cd_nr; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->cd_nr = value; 
} }
+               public int                      CDs                             
                        { get { return ((Itdb_Track *) Native)->cds; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->cds = value; } 
}
+               public int                      TrackNumber                     
                { get { return ((Itdb_Track *) Native)->track_nr; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->track_nr = 
value; } }
+               public int                      Tracks                          
                { get { return ((Itdb_Track *) Native)->tracks; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->tracks = 
value; } }
+               public int                      Bitrate                         
                { get { return ((Itdb_Track *) Native)->bitrate; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->bitrate = 
value; } }
+               public ushort           Samplerate                              
        { get { return ((Itdb_Track *) Native)->samplerate; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->samplerate = 
value; } }
+               public ushort           SamplerateLow                           
{ get { return ((Itdb_Track *) Native)->samplerate_low; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->samplerate_low 
= value; } }
+               public int                      Year                            
                { get { return ((Itdb_Track *) Native)->year; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->year = value; 
} }
+               public int                      Volume                          
                { get { return ((Itdb_Track *) Native)->volume; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->volume = 
value; } }
+               public uint                     Soundcheck                      
                { get { return ((Itdb_Track *) Native)->soundcheck; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->soundcheck = 
value; } }
+               public DateTime         TimeAdded                               
        { get { return Track.time_tToDateTime (((Itdb_Track *) 
Native)->time_added); }
+                                                                               
                                  set { ((Itdb_Track *) Native)->time_added = 
Track.DateTimeTotime_t (value); } }
+               public DateTime         TimeModified                            
{ get { return Track.time_tToDateTime (((Itdb_Track *) Native)->time_modified); 
}
+                                                                               
                                  set { ((Itdb_Track *) Native)->time_modified 
= Track.DateTimeTotime_t (value); } }
+               public DateTime         TimePlayed                              
        { get { return Track.time_tToDateTime (((Itdb_Track *) 
Native)->time_played); }
+                                                                               
                                  set { ((Itdb_Track *) Native)->time_played = 
Track.DateTimeTotime_t(value); } }
+               public uint                     BookmarkTime                    
        { get { return ((Itdb_Track *) Native)->bookmark_time; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->bookmark_time 
= value; } }
+               public uint                     Rating                          
                { get { return ((Itdb_Track *) Native)->rating; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->rating = 
value; } }
+               public uint                     PlayCount                       
                { get { return ((Itdb_Track *) Native)->playcount; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->playcount = 
value; } }
+               public uint                     PlayCount2                      
                { get { return ((Itdb_Track *) Native)->playcount2; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->playcount2 = 
value; } }
+               public uint                     RecentPlayCount                 
        { get { return ((Itdb_Track *) Native)->recent_playcount; }
+                                                                               
                                  set { ((Itdb_Track *) 
Native)->recent_playcount = value; } }
+               public bool                     Transferred                     
                { get { return ((Itdb_Track *) Native)->transferred; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->transferred = 
value; } }
+               public short            BPM                                     
                { get { return ((Itdb_Track *) Native)->BPM; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->BPM = value; } 
}
+               public byte             AppRating                               
        { get { return ((Itdb_Track *) Native)->app_rating; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->app_rating = 
value; } }
+               public bool                     Compilation                     
                { get { return ((Itdb_Track *) Native)->compilation == 1; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->compilation = 
(byte) (value ? 1 : 0); } }
+               public uint                     StartTime                       
                { get { return ((Itdb_Track *) Native)->starttime; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->starttime = 
value; } }
+               public uint                     StopTime                        
                { get { return ((Itdb_Track *) Native)->stoptime; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->stoptime = 
value; } }
+               public bool                     Checked                         
                { get { return ((Itdb_Track *) Native)->ischecked == 0; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->ischecked = 
(byte) (value ? 0x0 : 0x1); } }
+               public ulong            DBID                                    
        { get { return ((Itdb_Track *) Native)->dbid; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->dbid = value; 
} }
+               public uint                     DRMUserID                       
                { get { return ((Itdb_Track *) Native)->drm_userid; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->drm_userid = 
value; } }
+               public uint                     Visible                         
                { get { return ((Itdb_Track *) Native)->visible; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->visible = 
value; } }
+               public uint                     FiletypeMarker                  
        { get { return ((Itdb_Track *) Native)->filetype_marker; }
+                                                                               
                                  set { ((Itdb_Track *) 
Native)->filetype_marker = value; } }
+               public DateTime         TimeReleased                            
{ get { return Track.time_tToDateTime (((Itdb_Track *) Native)->time_released); 
}
+                                                                               
                                  set { ((Itdb_Track *) Native)->time_released 
= Track.DateTimeTotime_t(value); } }
+               public bool                     ExplicitFlag                    
        { get { return ((Itdb_Track *) Native)->explicit_flag == 1; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->explicit_flag 
= (byte) (value ? 1 : 0); } }
+               public uint                     SkipCount                       
                { get { return ((Itdb_Track *) Native)->skipcount; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->skipcount = 
value; } } 
+               public uint                     RecentSkipCount                 
        { get { return ((Itdb_Track *) Native)->recent_skipcount; }
+                                                                               
                                  set { ((Itdb_Track *) 
Native)->recent_skipcount = value; } }
+               public uint                     LastSkipped                     
                { get { return ((Itdb_Track *) Native)->last_skipped; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->last_skipped = 
value; } }
+               public bool                     SkipWhenShuffling               
        { get { return ((Itdb_Track *) Native)->skip_when_shuffling == 1; }
+                                                                               
                                  set { ((Itdb_Track *) 
Native)->skip_when_shuffling = (byte) (value ? 1 : 0); } }
+               public bool                     RememberPlaybackPosition        
{ get { return ((Itdb_Track *) Native)->remember_playback_position == 1; }
+                                                                               
                                  set { ((Itdb_Track *) 
Native)->remember_playback_position = (byte) (value ? 1 : 0); } }
+               public byte                     Flag4                           
                { get { return ((Itdb_Track *) Native)->flag4; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->flag4 = value; 
} }
+               public ulong            DBID2                                   
        { get { return ((Itdb_Track *) Native)->dbid2; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->dbid2 = value; 
} }
+               public bool                     LyricsFlag                      
                { get { return ((Itdb_Track *) Native)->lyrics_flag == 1; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->lyrics_flag = 
(byte) (value ? 1 : 0); } }
+               public bool                     MovieFlag                       
                { get { return ((Itdb_Track *) Native)->movie_flag == 1; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->movie_flag = 
(byte) (value ? 1 : 0); } }
+               public bool                     MarkUnplayed                    
        { get { return ((Itdb_Track *) Native)->mark_unplayed == 2; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->mark_unplayed 
= (byte) (value ? 2 : 1); } }
+               public uint                     PreGap                          
                { get { return ((Itdb_Track *) Native)->pregap; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->pregap = 
value; } }
+               public ulong            SampleCount                             
        { get { return ((Itdb_Track *) Native)->samplecount; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->samplecount = 
value; } }
+               public uint                     PostGap                         
                { get { return ((Itdb_Track *) Native)->postgap; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->postgap = 
value; } }
+               public MediaType        MediaType                               
        { get { return ((Itdb_Track *) Native)->mediatype; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->mediatype = 
value; } }
+               public uint                     SeasonNumber                    
        { get { return ((Itdb_Track *) Native)->season_nr; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->season_nr = 
value; } }
+               public uint                     EpisodeNumber                   
        { get { return ((Itdb_Track *) Native)->episode_nr; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->episode_nr = 
value; } }
+               public uint                     GaplessData                     
                { get { return ((Itdb_Track *) Native)->gapless_data; }
+                                                                               
                                  set { ((Itdb_Track *) Native)->gapless_data = 
value; } }
+               public bool                     GaplessTrackFlag                
        { get { return ((Itdb_Track *) Native)->gapless_track_flag == 1; }
+                                                                               
                                  set { ((Itdb_Track *) 
Native)->gapless_track_flag = (byte) (value ? 1 : 0); } }
+               public bool                     GaplessAlbumFlag                
        { get { return ((Itdb_Track *) Native)->gapless_album_flag == 1; }
+                                                                               
                                  set { ((Itdb_Track *) 
Native)->gapless_album_flag = (byte) (value ? 1 : 0); } }
+               public Artwork          Artwork                                 
        { get { return new Artwork(((Itdb_Track *) Native)->artwork); }
+                                                                               
                                  set { ((Itdb_Track *) Native)->artwork = 
HandleRef.ToIntPtr(value.Handle); } }
                
                public Track() : this(Itdb_Track.itdb_track_new(), false) {}
                public Track(Track other) : 
this(Itdb_Track.itdb_track_duplicate(other.Handle), false) {}

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to