PageRenderTime 17ms CodeModel.GetById 6ms RepoModel.GetById 1ms app.codeStats 0ms

/IZWebFileManager/FileTypeCollection.cs

http://izwebfilemanager.googlecode.com/
C# | 77 lines | 48 code | 14 blank | 15 comment | 2 complexity | aa760f0039c70deaa67011df4e02b6ec MD5 | raw file
  1. // Copyright (C) 2006 Igor Zelmanovich <izwebfilemanager@gmail.com>
  2. //
  3. // This program is free software; you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation; either version 2 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Text;
  19. using System.Web.UI;
  20. using System.Collections;
  21. namespace IZ.WebFileManager
  22. {
  23. public sealed class FileTypeCollection : StateManagedCollection
  24. {
  25. private static readonly Type [] _knownTypes = new Type [] { typeof (FileType) };
  26. public FileType this [int i] {
  27. get { return (FileType) ((IList) this) [i]; }
  28. set { ((IList) this) [i] = value; }
  29. }
  30. public int Add (FileType fileType) {
  31. return ((IList) this).Add (fileType);
  32. }
  33. public bool Contains (FileType fileType) {
  34. return ((IList) this).Contains (fileType);
  35. }
  36. public void CopyTo (FileType [] fileTypeArray, int index) {
  37. base.CopyTo (fileTypeArray, index);
  38. }
  39. public int IndexOf (FileType fileType) {
  40. return ((IList) this).IndexOf (fileType);
  41. }
  42. public void Insert (int index, FileType fileType) {
  43. ((IList) this).Insert (index, fileType);
  44. }
  45. public void Remove (FileType fileType) {
  46. ((IList) this).Remove (fileType);
  47. }
  48. public void RemoveAt (int index) {
  49. ((IList) this).RemoveAt (index);
  50. }
  51. protected override object CreateKnownType (int index) {
  52. if (index != 0)
  53. throw new ArgumentOutOfRangeException ("Unknown Type");
  54. return new FileType ();
  55. }
  56. protected override Type [] GetKnownTypes () {
  57. return _knownTypes;
  58. }
  59. protected override void SetDirtyObject (object o) {
  60. ((FileType) o).SetDirty ();
  61. }
  62. }
  63. }