Implemented the Media collections and corrected signatures.

This commit is contained in:
SND\AstrorEnales_cp 2011-11-17 21:02:52 +00:00
parent bbeb6be3d1
commit f461d172c5
9 changed files with 473 additions and 19 deletions

View File

@ -49,7 +49,11 @@
namespace ANX.Framework
{
public class FrameworkDispatcher
public static class FrameworkDispatcher
{
public static void Update()
{
throw new NotImplementedException();
}
}
}

View File

@ -55,17 +55,68 @@ using System.Collections.Generic;
namespace ANX.Framework.GamerServices
{
public class GamerCollection<T> : ReadOnlyCollection<T>, IEnumerable<Gamer>, IEnumerable where T : Gamer
{
public class GamerCollection<T> : ReadOnlyCollection<T>,
IEnumerable<Gamer>, IEnumerable where T : Gamer
{
#region GamerCollectionEnumerator
public struct GamerCollectionEnumerator
: IEnumerator<T>, IDisposable, IEnumerator
{
private List<T>.Enumerator enumerator;
public GamerCollection()
: base(new List<T>())
{
}
public T Current
{
get
{
return enumerator.Current;
}
}
public new IEnumerator<Gamer> GetEnumerator()
{
throw new NotImplementedException();
}
}
object IEnumerator.Current
{
get
{
return enumerator.Current;
}
}
internal GamerCollectionEnumerator(List<T>.Enumerator setEnumerator)
{
enumerator = setEnumerator;
}
public void Dispose()
{
enumerator.Dispose();
}
public bool MoveNext()
{
return enumerator.MoveNext();
}
void IEnumerator.Reset()
{
((IEnumerator)enumerator).Reset();
}
}
#endregion
public GamerCollection()
: base(new List<T>())
{
}
#region GetEnumerator
public new GamerCollection<T>.GamerCollectionEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
IEnumerator<Gamer> IEnumerable<Gamer>.GetEnumerator()
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -1,4 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
#region License
@ -49,7 +51,62 @@
namespace ANX.Framework.Media
{
public class AlbumCollection
public sealed class AlbumCollection
: IEnumerable<Album>, IEnumerable, IDisposable
{
private List<Album> albums;
public bool IsDisposed
{
get;
private set;
}
public int Count
{
get
{
return albums.Count;
}
}
public Album this[int index]
{
get
{
return albums[index];
}
}
public AlbumCollection()
{
albums = new List<Album>();
IsDisposed = false;
}
~AlbumCollection()
{
Dispose();
}
#region GetEnumerator
public IEnumerator<Album> GetEnumerator()
{
return albums.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return albums.GetEnumerator();
}
#endregion
#region Dispose
public void Dispose()
{
IsDisposed = true;
albums.Clear();
}
#endregion
}
}

View File

@ -1,4 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
#region License
@ -49,7 +51,62 @@
namespace ANX.Framework.Media
{
public class ArtistCollection
public sealed class ArtistCollection
: IEnumerable<Artist>, IEnumerable, IDisposable
{
private List<Artist> artists;
public bool IsDisposed
{
get;
private set;
}
public int Count
{
get
{
return artists.Count;
}
}
public Artist this[int index]
{
get
{
return artists[index];
}
}
public ArtistCollection()
{
artists = new List<Artist>();
IsDisposed = false;
}
~ArtistCollection()
{
Dispose();
}
#region GetEnumerator
public IEnumerator<Artist> GetEnumerator()
{
return artists.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return artists.GetEnumerator();
}
#endregion
#region Dispose
public void Dispose()
{
IsDisposed = true;
artists.Clear();
}
#endregion
}
}

View File

@ -1,4 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
#region License
@ -49,7 +51,62 @@
namespace ANX.Framework.Media
{
public class GenreCollection
public sealed class GenreCollection
: IEnumerable<Genre>, IEnumerable, IDisposable
{
private List<Genre> genres;
public bool IsDisposed
{
get;
private set;
}
public int Count
{
get
{
return genres.Count;
}
}
public Genre this[int index]
{
get
{
return genres[index];
}
}
public GenreCollection()
{
genres = new List<Genre>();
IsDisposed = false;
}
~GenreCollection()
{
Dispose();
}
#region GetEnumerator
public IEnumerator<Genre> GetEnumerator()
{
return genres.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return genres.GetEnumerator();
}
#endregion
#region Dispose
public void Dispose()
{
IsDisposed = true;
genres.Clear();
}
#endregion
}
}

View File

@ -1,4 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
#region License
@ -49,7 +51,62 @@
namespace ANX.Framework.Media
{
public class PictureAlbumCollection
public sealed class PictureAlbumCollection
: IEnumerable<PictureAlbum>, IEnumerable, IDisposable
{
private List<PictureAlbum> pictureAlbums;
public bool IsDisposed
{
get;
private set;
}
public int Count
{
get
{
return pictureAlbums.Count;
}
}
public PictureAlbum this[int index]
{
get
{
return pictureAlbums[index];
}
}
public PictureAlbumCollection()
{
pictureAlbums = new List<PictureAlbum>();
IsDisposed = false;
}
~PictureAlbumCollection()
{
Dispose();
}
#region GetEnumerator
public IEnumerator<PictureAlbum> GetEnumerator()
{
return pictureAlbums.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return pictureAlbums.GetEnumerator();
}
#endregion
#region Dispose
public void Dispose()
{
IsDisposed = true;
pictureAlbums.Clear();
}
#endregion
}
}

View File

@ -1,4 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
#region License
@ -49,7 +51,62 @@
namespace ANX.Framework.Media
{
public class PictureCollection
public sealed class PictureCollection
: IEnumerable<Picture>, IEnumerable, IDisposable
{
private List<Picture> pictures;
public bool IsDisposed
{
get;
private set;
}
public int Count
{
get
{
return pictures.Count;
}
}
public Picture this[int index]
{
get
{
return pictures[index];
}
}
public PictureCollection()
{
pictures = new List<Picture>();
IsDisposed = false;
}
~PictureCollection()
{
Dispose();
}
#region GetEnumerator
public IEnumerator<Picture> GetEnumerator()
{
return pictures.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return pictures.GetEnumerator();
}
#endregion
#region Dispose
public void Dispose()
{
IsDisposed = true;
pictures.Clear();
}
#endregion
}
}

View File

@ -1,4 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
#region License
@ -49,7 +51,62 @@
namespace ANX.Framework.Media
{
public class PlaylistCollection
public sealed class PlaylistCollection
: IEnumerable<Playlist>, IEnumerable, IDisposable
{
private List<Playlist> playlists;
public bool IsDisposed
{
get;
private set;
}
public int Count
{
get
{
return playlists.Count;
}
}
public Playlist this[int index]
{
get
{
return playlists[index];
}
}
public PlaylistCollection()
{
playlists = new List<Playlist>();
IsDisposed = false;
}
~PlaylistCollection()
{
Dispose();
}
#region GetEnumerator
public IEnumerator<Playlist> GetEnumerator()
{
return playlists.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return playlists.GetEnumerator();
}
#endregion
#region Dispose
public void Dispose()
{
IsDisposed = true;
playlists.Clear();
}
#endregion
}
}

View File

@ -1,4 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
#region License
@ -49,7 +51,62 @@
namespace ANX.Framework.Media
{
public class SongCollection
public sealed class SongCollection
: IEnumerable<Song>, IEnumerable, IDisposable
{
private List<Song> songs;
public bool IsDisposed
{
get;
private set;
}
public int Count
{
get
{
return songs.Count;
}
}
public Song this[int index]
{
get
{
return songs[index];
}
}
public SongCollection()
{
songs = new List<Song>();
IsDisposed = false;
}
~SongCollection()
{
Dispose();
}
#region GetEnumerator
public IEnumerator<Song> GetEnumerator()
{
return songs.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return songs.GetEnumerator();
}
#endregion
#region Dispose
public void Dispose()
{
IsDisposed = true;
songs.Clear();
}
#endregion
}
}