| 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 | } |