PageRenderTime 23ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/IZWebFileManager/SpecialFolder.cs

http://izwebfilemanager.googlecode.com/
C# | 94 lines | 65 code | 14 blank | 15 comment | 4 complexity | e1076cfba36b14c00a749c3e5a928477 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. using System.Web.UI.WebControls;
  22. using System.Collections.ObjectModel;
  23. using System.ComponentModel;
  24. using System.Diagnostics.CodeAnalysis;
  25. using System.Drawing.Design;
  26. namespace IZ.WebFileManager
  27. {
  28. public sealed class SpecialFolder : IStateManager
  29. {
  30. readonly StateBag bag = new StateBag ();
  31. [DefaultValue ("")]
  32. public string DirectoryPath {
  33. get { return bag ["DirectoryPath"] == null ? String.Empty : (string) bag ["DirectoryPath"]; }
  34. set { bag ["DirectoryPath"] = value; }
  35. }
  36. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  37. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  38. [DefaultValue ("")]
  39. [UrlProperty]
  40. [Bindable (true)]
  41. public string SmallImageUrl {
  42. get { return bag ["SmallIconUrl"] == null ? String.Empty : (string) bag ["SmallIconUrl"]; }
  43. set { bag ["SmallIconUrl"] = value; }
  44. }
  45. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  46. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  47. [DefaultValue ("")]
  48. [UrlProperty]
  49. [Bindable (true)]
  50. public string LargeImageUrl {
  51. get { return bag ["LargeIconUrl"] == null ? String.Empty : (string) bag ["LargeIconUrl"]; }
  52. set { bag ["LargeIconUrl"] = value; }
  53. }
  54. [DefaultValue ("Root Folder")]
  55. public string Text {
  56. get { return bag ["Text"] == null ? "Root Folder" : (string) bag ["Text"]; }
  57. set { bag ["Text"] = value; }
  58. }
  59. public override string ToString () {
  60. return DirectoryPath;
  61. }
  62. #region IStateManager Members
  63. bool IStateManager.IsTrackingViewState {
  64. get { return ((IStateManager) bag).IsTrackingViewState; }
  65. }
  66. void IStateManager.LoadViewState (object state) {
  67. ((IStateManager) bag).LoadViewState (state);
  68. }
  69. object IStateManager.SaveViewState () {
  70. return ((IStateManager) bag).SaveViewState ();
  71. }
  72. void IStateManager.TrackViewState () {
  73. ((IStateManager) bag).TrackViewState ();
  74. }
  75. #endregion
  76. internal void SetDirty () {
  77. bag.SetDirty (true);
  78. }
  79. }
  80. }