PageRenderTime 43ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/IZWebFileManager/NewDocumentTemplateCollection.cs

http://izwebfilemanager.googlecode.com/
C# | 77 lines | 48 code | 14 blank | 15 comment | 2 complexity | d8c1856a546cfc91abcbd78178a49d6c 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 NewDocumentTemplateCollection : StateManagedCollection
  24. {
  25. private static readonly Type [] _knownTypes = new Type [] { typeof (NewDocumentTemplate) };
  26. public NewDocumentTemplate this [int i] {
  27. get { return (NewDocumentTemplate) ((IList) this) [i]; }
  28. set { ((IList) this) [i] = value; }
  29. }
  30. public int Add (NewDocumentTemplate template) {
  31. return ((IList) this).Add (template);
  32. }
  33. public bool Contains (NewDocumentTemplate template) {
  34. return ((IList) this).Contains (template);
  35. }
  36. public void CopyTo (NewDocumentTemplate [] templateArray, int index) {
  37. base.CopyTo (templateArray, index);
  38. }
  39. public int IndexOf (NewDocumentTemplate template) {
  40. return ((IList) this).IndexOf (template);
  41. }
  42. public void Insert (int index, NewDocumentTemplate template) {
  43. ((IList) this).Insert (index, template);
  44. }
  45. public void Remove (NewDocumentTemplate template) {
  46. ((IList) this).Remove (template);
  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 NewDocumentTemplate ();
  55. }
  56. protected override Type [] GetKnownTypes () {
  57. return _knownTypes;
  58. }
  59. protected override void SetDirtyObject (object o) {
  60. ((NewDocumentTemplate) o).SetDirty ();
  61. }
  62. }
  63. }