Changeset 19308

Show
Ignore:
Timestamp:
09/15/08 01:35:51 (4 months ago)
Author:
topia
Message:

update supported iTunesLib version to 1.11 (iTunes 7.7).
* support PersistentID and Playlists property.
* support ITArtwork.Description property.

Location:
lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap
Files:
1 added
23 modified

Legend:

Unmodified
Added
Removed
  • lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap/Application.cs

    r11205 r19308  
    66using System.Runtime.InteropServices; 
    77using Clovery.iTunesHelper.COMWrap.Interfaces; 
     8using Clovery.iTunesHelper.COMWrap.Interfaces.Internal; 
     9using Clovery.iTunesHelper.COMWrap.Internal; 
    810using iTunes = iTunesLib; 
    911 
     
    553555    } 
    554556 
    555     internal class CanSetShufflePlaylistCollection : IIndexedCollection<IPlaylist, bool> 
     557    namespace Internal 
    556558    { 
    557         public bool this[IPlaylist Playlist] 
    558         { 
    559             get { return Playlist.CanSetShuffle; } 
    560         } 
    561     } 
    562  
    563     internal class CanSetSongRepeatPlaylistCollection : IIndexedCollection<IPlaylist, bool> 
    564     { 
    565         public bool this[IPlaylist Playlist] 
    566         { 
    567             get { return Playlist.CanSetSongRepeat; } 
    568         } 
     559        internal class CanSetShufflePlaylistCollection : IIndexedCollection<IPlaylist, bool> 
     560        { 
     561            public bool this[IPlaylist Playlist] 
     562            { 
     563                get { return Playlist.CanSetShuffle; } 
     564            } 
     565        } 
     566 
     567        internal class CanSetSongRepeatPlaylistCollection : IIndexedCollection<IPlaylist, bool> 
     568        { 
     569            public bool this[IPlaylist Playlist] 
     570            { 
     571                get { return Playlist.CanSetSongRepeat; } 
     572            } 
     573        }         
    569574    } 
    570575 
  • lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap/Artworks.cs

    r11205 r19308  
    55using System.Linq; 
    66using Clovery.iTunesHelper.COMWrap.Interfaces; 
     7using Clovery.iTunesHelper.COMWrap.Interfaces.Internal; 
     8using Clovery.iTunesHelper.COMWrap.Internal; 
    79using iTunes = iTunesLib; 
    810 
     
    1517        } 
    1618 
    17         protected internal iTunes.IITArtwork __asIITArtwork 
     19        protected internal iTunes.IITArtwork _asIITArtwork 
    1820        { 
    1921            get { return (iTunes.IITArtwork) this._internal; } 
     
    2224        public void Delete() 
    2325        { 
    24             this.__asIITArtwork.Delete(); 
     26            this._asIITArtwork.Delete(); 
    2527        } 
    2628 
    2729        public ArtworkFormat Format 
    2830        { 
    29             get { return (ArtworkFormat) this.__asIITArtwork.Format; } 
     31            get { return (ArtworkFormat) this._asIITArtwork.Format; } 
    3032        } 
    3133 
    3234        public bool IsDownloadedArtwork 
    3335        { 
    34             get { return this.__asIITArtwork.IsDownloadedArtwork; } 
     36            get { return this._asIITArtwork.IsDownloadedArtwork; } 
     37        } 
     38 
     39        public string Description 
     40        { 
     41            get { return this._asIITArtwork.Description; } 
     42            set { this._asIITArtwork.Description = value; } 
    3543        } 
    3644 
    3745        public void SaveArtworkToFile(string filePath) 
    3846        { 
    39             this.__asIITArtwork.SaveArtworkToFile(filePath); 
     47            this._asIITArtwork.SaveArtworkToFile(filePath); 
    4048        } 
    4149 
    4250        public void SetArtworkFromFile(string filePath) 
    4351        { 
    44             this.__asIITArtwork.SetArtworkFromFile(filePath); 
     52            this._asIITArtwork.SetArtworkFromFile(filePath); 
    4553        } 
    4654    } 
  • lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap/Base.cs

    r11205 r19308  
    55using System.Linq; 
    66using Clovery.iTunesHelper.COMWrap.Interfaces; 
     7using Clovery.iTunesHelper.COMWrap.Interfaces.Internal; 
     8using Clovery.iTunesHelper.COMWrap.Internal; 
    79 
    810namespace Clovery.iTunesHelper.COMWrap 
     
    6971        protected internal readonly int _TrackDatabaseID; 
    7072        protected internal readonly int _trackID; 
     73        protected internal readonly long? _persistentID; 
    7174        protected internal string _name; 
    7275 
     
    7578            _internal.GetITObjectIDs(out this._sourceID, out this._playlistID, out this._trackID, 
    7679                                     out this._TrackDatabaseID); 
     80            { 
     81                int high, low; 
     82                this._app._asIiTunes.GetITObjectPersistentIDs(ref this._internal, out high, out low); 
     83                this._persistentID = Utils.JoinInt32ToInt64(high, low); 
     84            } 
    7785            this._name = _internal.Name; 
    7886        } 
    7987 
    80         protected internal ITObject(int sourceID, int playlistID, int trackID, int TrackDatabaseID, ITunesApp app) : base(app) 
     88        /// <summary> 
     89        /// Create Abstract ITObject. 
     90        /// </summary> 
     91        protected internal ITObject(int sourceID, int playlistID, int trackID, int TrackDatabaseID, long? PersistentID, ITunesApp app) 
     92            : base(app) 
    8193        { 
    8294            this._sourceID = sourceID; 
     
    8496            this._trackID = trackID; 
    8597            this._TrackDatabaseID = TrackDatabaseID; 
     98            this._persistentID = PersistentID; 
     99        } 
     100 
     101        /// <summary> 
     102        /// Create Abstract ITObject. 
     103        /// </summary> 
     104        protected internal ITObject(int sourceID, int playlistID, int trackID, int TrackDatabaseID, ITunesApp app) 
     105            : this(sourceID, playlistID, trackID, TrackDatabaseID, null, app) 
     106        { 
    86107        } 
    87108 
     
    105126        public void GetITObjectIDs(out int sourceID, out int playlistID, out int trackID, out int databaseID) 
    106127        { 
    107             //this._asIITObject.GetITObjectIDs(out sourceID, out playlistID, out trackID, out databaseID); 
    108128            sourceID = this.sourceID; 
    109129            playlistID = this.playlistID; 
     
    160180        } 
    161181 
     182        public long PersistentID 
     183        { 
     184            get 
     185            { 
     186                if (this._persistentID.HasValue) 
     187                { 
     188                    return this._persistentID.Value; 
     189                } 
     190                throw new InvalidOperationException("This object is abstract."); 
     191            } 
     192        } 
     193 
    162194        ///<summary> 
    163195        ///Indicates whether the current object is equal to another object of the same type. 
     
    231263    } 
    232264 
    233     internal class ParentStringIndexerReferrer<TCollection, TItem> : IIndexedCollection<string, TItem> 
    234         where TCollection : IIndexedCollection<string, TItem> 
     265    namespace Internal 
    235266    { 
    236         protected internal readonly TCollection _parent; 
    237  
    238         internal ParentStringIndexerReferrer(TCollection _parent) 
    239         { 
    240             this._parent = _parent; 
    241         } 
    242  
    243         public TItem this[string Name] 
    244         { 
    245             get { return this._parent[Name]; } 
    246         } 
    247     } 
    248  
    249     internal abstract class ITBaseCollection<TItem> : ITFactory, IITBaseCollection<TItem> 
    250         where TItem : class 
    251     { 
    252         protected ITBaseCollection(object _internal, ITunesApp app) : base(_internal, app) 
    253         { 
    254         } 
    255  
    256         public abstract int Count { get; } 
    257  
    258         ///<summary> 
    259         ///Returns an enumerator that iterates through the collection. 
    260         ///</summary> 
    261         /// 
    262         ///<returns> 
    263         ///A <see cref="T:System.Collections.Generic.IEnumerator`1"></see> that can be used to iterate through the collection. 
    264         ///</returns> 
    265         ///<filterpriority>1</filterpriority> 
    266         public IEnumerator<TItem> GetEnumerator() 
    267         { 
    268             return this._GetEnumerator(); 
    269         } 
    270  
    271         ///<summary> 
    272         ///Returns an enumerator that iterates through a collection. 
    273         ///</summary> 
    274         /// 
    275         ///<returns> 
    276         ///An <see cref="T:System.Collections.IEnumerator"></see> object that can be used to iterate through the collection. 
    277         ///</returns> 
    278         ///<filterpriority>2</filterpriority> 
    279         IEnumerator IEnumerable.GetEnumerator() 
    280         { 
    281             return this._GetEnumerator(); 
    282         } 
    283  
    284         protected internal abstract IEnumerator<TItem> _GetEnumerator(); 
    285     } 
    286  
    287     internal class ITBaseEnumerator<TITunesItem, TItem, TBaseCollection> : IEnumerator<TItem> 
    288         where TBaseCollection : IITBaseCollection<TItem>, ItemCreatableCollection<TITunesItem, TItem> 
    289         where TItem : class 
    290     { 
    291         protected internal readonly TBaseCollection _collection; 
    292         protected internal readonly IEnumerator _internal; 
    293         protected TItem _current; 
    294  
    295         internal ITBaseEnumerator(IEnumerator internalEnumerator, TBaseCollection baseCollection) 
    296         { 
    297             this._internal = internalEnumerator; 
    298             this._collection = baseCollection; 
    299         } 
    300  
    301         ///<summary> 
    302         ///Advances the enumerator to the next element of the collection. 
    303         ///</summary> 
    304         /// 
    305         ///<returns> 
    306         ///true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. 
    307         ///</returns> 
    308         /// 
    309         ///<exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority> 
    310         public bool MoveNext() 
    311         { 
    312             this._current = null; 
    313             return this._internal.MoveNext(); 
    314         } 
    315  
    316         ///<summary> 
    317         ///Sets the enumerator to its initial position, which is before the first element in the collection. 
    318         ///</summary> 
    319         /// 
    320         ///<exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority> 
    321         public void Reset() 
    322         { 
    323             this._internal.Reset(); 
    324         } 
    325  
    326         ///<summary> 
    327         ///Gets the current element in the collection. 
    328         ///</summary> 
    329         /// 
    330         ///<returns> 
    331         ///The current element in the collection. 
    332         ///</returns> 
    333         /// 
    334         ///<exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception><filterpriority>2</filterpriority> 
    335         object IEnumerator.Current 
    336         { 
    337             get { return this.GetCurrent(); } 
    338         } 
    339  
    340         ///<summary> 
    341         ///Gets the element in the collection at the current position of the enumerator. 
    342         ///</summary> 
    343         /// 
    344         ///<returns> 
    345         ///The element in the collection at the current position of the enumerator. 
    346         ///</returns> 
    347         /// 
    348         TItem IEnumerator<TItem>.Current 
    349         { 
    350             get { return this.GetCurrent(); } 
    351         } 
    352  
    353         ///<summary> 
    354         ///Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. 
    355         ///</summary> 
    356         ///<filterpriority>2</filterpriority> 
    357         public void Dispose() 
    358         { 
    359         } 
    360  
    361         protected TItem GetCurrent() 
    362         { 
    363             if (this._current == null) 
    364             { 
    365                 this._current = this._GetCurrent(); 
    366             } 
    367  
    368             return this._current; 
    369         } 
    370  
    371         protected TItem _GetCurrent() 
    372         { 
    373             return this._collection.CreateItem((TITunesItem) this._internal.Current); 
     267        internal class ParentStringIndexerReferrer<TCollection, TItem> : IIndexedCollection<string, TItem> 
     268            where TCollection : IIndexedCollection<string, TItem> 
     269        { 
     270            protected internal readonly TCollection _parent; 
     271 
     272            internal ParentStringIndexerReferrer(TCollection _parent) 
     273            { 
     274                this._parent = _parent; 
     275            } 
     276 
     277            public TItem this[string Name] 
     278            { 
     279                get { return this._parent[Name]; } 
     280            } 
     281        } 
     282 
     283        internal abstract class ITBaseCollection<TItem> : ITFactory, IITBaseCollection<TItem> 
     284            where TItem : class 
     285        { 
     286            protected ITBaseCollection(object _internal, ITunesApp app) 
     287                : base(_internal, app) 
     288            { 
     289            } 
     290 
     291            public abstract int Count { get; } 
     292 
     293            ///<summary> 
     294            ///Returns an enumerator that iterates through the collection. 
     295            ///</summary> 
     296            /// 
     297            ///<returns> 
     298            ///A <see cref="T:System.Collections.Generic.IEnumerator`1"></see> that can be used to iterate through the collection. 
     299            ///</returns> 
     300            ///<filterpriority>1</filterpriority> 
     301            public IEnumerator<TItem> GetEnumerator() 
     302            { 
     303                return this._GetEnumerator(); 
     304            } 
     305 
     306            ///<summary> 
     307            ///Returns an enumerator that iterates through a collection. 
     308            ///</summary> 
     309            /// 
     310            ///<returns> 
     311            ///An <see cref="T:System.Collections.IEnumerator"></see> object that can be used to iterate through the collection. 
     312            ///</returns> 
     313            ///<filterpriority>2</filterpriority> 
     314            IEnumerator IEnumerable.GetEnumerator() 
     315            { 
     316                return this._GetEnumerator(); 
     317            } 
     318 
     319            protected internal abstract IEnumerator<TItem> _GetEnumerator(); 
     320        } 
     321 
     322        internal class ITBaseEnumerator<TITunesItem, TItem, TBaseCollection> : IEnumerator<TItem> 
     323            where TBaseCollection : IITBaseCollection<TItem>, ItemCreatableCollection<TITunesItem, TItem> 
     324            where TItem : class 
     325        { 
     326            protected internal readonly TBaseCollection _collection; 
     327            protected internal readonly IEnumerator _internal; 
     328            protected TItem _current; 
     329 
     330            internal ITBaseEnumerator(IEnumerator internalEnumerator, TBaseCollection baseCollection) 
     331            { 
     332                this._internal = internalEnumerator; 
     333                this._collection = baseCollection; 
     334            } 
     335 
     336            ///<summary> 
     337            ///Advances the enumerator to the next element of the collection. 
     338            ///</summary> 
     339            /// 
     340            ///<returns> 
     341            ///true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. 
     342            ///</returns> 
     343            /// 
     344            ///<exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority> 
     345            public bool MoveNext() 
     346            { 
     347                this._current = null; 
     348                return this._internal.MoveNext(); 
     349            } 
     350 
     351            ///<summary> 
     352            ///Sets the enumerator to its initial position, which is before the first element in the collection. 
     353            ///</summary> 
     354            /// 
     355            ///<exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception><filterpriority>2</filterpriority> 
     356            public void Reset() 
     357            { 
     358                this._internal.Reset(); 
     359            } 
     360 
     361            ///<summary> 
     362            ///Gets the current element in the collection. 
     363            ///</summary> 
     364            /// 
     365            ///<returns> 
     366            ///The current element in the collection. 
     367            ///</returns> 
     368            /// 
     369            ///<exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception><filterpriority>2</filterpriority> 
     370            object IEnumerator.Current 
     371            { 
     372                get { return this.GetCurrent(); } 
     373            } 
     374 
     375            ///<summary> 
     376            ///Gets the element in the collection at the current position of the enumerator. 
     377            ///</summary> 
     378            /// 
     379            ///<returns> 
     380            ///The element in the collection at the current position of the enumerator. 
     381            ///</returns> 
     382            /// 
     383            TItem IEnumerator<TItem>.Current 
     384            { 
     385                get { return this.GetCurrent(); } 
     386            } 
     387 
     388            ///<summary> 
     389            ///Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. 
     390            ///</summary> 
     391            ///<filterpriority>2</filterpriority> 
     392            public void Dispose() 
     393            { 
     394            } 
     395 
     396            protected TItem GetCurrent() 
     397            { 
     398                if (this._current == null) 
     399                { 
     400                    this._current = this._GetCurrent(); 
     401                } 
     402 
     403                return this._current; 
     404            } 
     405 
     406            protected TItem _GetCurrent() 
     407            { 
     408                return this._collection.CreateItem((TITunesItem)this._internal.Current); 
     409            } 
    374410        } 
    375411    } 
  • lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap/EQPresets.cs

    r11205 r19308  
    44using System.Linq; 
    55using Clovery.iTunesHelper.COMWrap.Interfaces; 
     6using Clovery.iTunesHelper.COMWrap.Interfaces.Internal; 
     7using Clovery.iTunesHelper.COMWrap.Internal; 
    68using iTunes = iTunesLib; 
    79 
  • lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap/Encoders.cs

    r11205 r19308  
    44using System.Linq; 
    55using Clovery.iTunesHelper.COMWrap.Interfaces; 
     6using Clovery.iTunesHelper.COMWrap.Interfaces.Internal; 
     7using Clovery.iTunesHelper.COMWrap.Internal; 
    68using iTunes = iTunesLib; 
    79 
  • lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap/Enums.cs

    r11205 r19308  
    542542    ///     <item><term>1.8</term><description>iTunes 7.0</description></item> 
    543543    ///     <item><term>1.9</term><description>iTunes 7.1</description></item> 
    544     ///     <item><term>1.10</term><description>iTunes 7.2?</description></item> 
     544    ///     <item><term>1.10</term><description>iTunes 7.4</description></item> 
     545    ///     <item><term>1.11</term><description>iTunes 7.7</description></item> 
    545546    /// </list> 
    546547    /// </summary> 
     
    555556        /// iTunes type library minor version 
    556557        /// </summary> 
    557         MinorVersion = 10 
     558        MinorVersion = 11 
    558559    } 
    559560 
  • lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap/Factory.cs

    r11205 r19308  
    44using System.Collections.Generic; 
    55using System.Linq; 
     6using Clovery.iTunesHelper.COMWrap.Interfaces.Internal; 
    67using iTunesLib; 
    78 
     
    4142        public IITObject CreateAbstractObject(int sourceID, int playlistID, int trackID, int TrackDatabaseID) 
    4243        { 
    43             return new ITObject(sourceID, playlistID, trackID, TrackDatabaseID, this.app); 
     44            return new ITObject(sourceID, playlistID, trackID, TrackDatabaseID, null, this.app); 
    4445        } 
    4546 
  • lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap/Interfaces/IArtwork.cs

    r11205 r19308  
    11// $Id$ 
     2using Clovery.iTunesHelper.COMWrap.Interfaces.Internal; 
     3 
    24namespace Clovery.iTunesHelper.COMWrap.Interfaces 
    35{ 
     
    2426        /// </summary> 
    2527        bool IsDownloadedArtwork { get; } 
     28 
     29        /// <summary> 
     30        /// get/set the description for the artwork. 
     31        /// </summary> 
     32        /// <remarks> 
     33        /// Artwork descriptions are only supported in files that use ID3 tags (i.e. MP3 files).  
     34        /// </remarks> 
     35        string Description { get; set; } 
    2636 
    2737        /// <summary> 
  • lang/csharp/iTunesCOMWrap/trunk/iTunesCOMWrap/Interfaces/IBase.cs

    r11205 r19308  
    22using System; 
    33using System.Collections.Generic; 
     4using Clovery.iTunesHelper.COMWrap.Interfaces.Internal; 
    45using iTunes = iTunesLib; 
    56 
     
    99100        /// </remarks> 
    100101        int TrackDatabaseID { get; } 
     102 
     103        /// <summary> 
     104        /// Get the persistent ID. 
     105        /// </summary> 
     106        /// <remarks> 
     107        /// <para>64-bit persistent which can be used to identify 
     108        /// the IITObject across multiple invocations of iTunes.</para> 
     109        /// </remarks> 
     110        long PersistentID { get; } 
    101111 
    102112        /// <summary> 
     
    136146    } 
    137147 
    138  
    139     /// <summary> 
    140     /// Interface of a index enabled collection. 
    141     /// </summary> 
    142     /// <typeparam name="TIndex">Index type</typeparam> 
    143     /// <typeparam name="TItem">Item type</typeparam> 
    144     public interface IIndexedCollection<TIndex, TItem> 
     148    namespace Internal 
    145149    { 
    146150        /// <summary> 
    147         /// collection indexer of specified type. 
    148         /// </summary> 
    149         /// <param name="Index"><typeparamref name="TIndex"/>'s index of <typeparamref name="TItem"/> to retrive.</param> 
    150         /// <returns>Returns an <typeparamref name="TItem"/> object corresponding to the specified index.</returns> 
    151         TItem this[TIndex Index] { get; } 
    152     } 
    153  
    154     /// <summary> 
    155     /// Base interface of iTunes collections. 
    156     /// </summary> 
    157     /// <typeparam name="TItem">Wrapped item type</typeparam> 
    158     public interface IITBaseCollection<TItem> : IEnumerable<TItem>, IITFactory 
    159     { 
    160         /// <summary>