PageRenderTime 224ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/stable-1.1.2/Client/Settings/SettingDisplayNameAttribute.cs

#
C# | 48 lines | 31 code | 9 blank | 8 comment | 1 complexity | 8effe7835fed1e4210a156301f24811c MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. //-----------------------------------------------------------------------
  2. // <copyright>
  3. // Copyright (C) Ruslan Yakushev for the PHP Manager for IIS project.
  4. //
  5. // This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
  6. // See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
  7. // </copyright>
  8. //-----------------------------------------------------------------------
  9. using System;
  10. namespace Web.Management.PHP.Settings
  11. {
  12. [AttributeUsage(AttributeTargets.Property|AttributeTargets.Event|AttributeTargets.Class)]
  13. internal sealed class SettingDisplayNameAttribute : Attribute {
  14. private bool _replaced;
  15. private string _configPropertyName;
  16. private string _friendlyName;
  17. internal SettingDisplayNameAttribute(string friendlyName) {
  18. _friendlyName = friendlyName;
  19. }
  20. internal SettingDisplayNameAttribute(string friendlyName, string configPropertyName) {
  21. _friendlyName = friendlyName;
  22. _configPropertyName = configPropertyName;
  23. }
  24. public string ConfigPropertyName {
  25. get {
  26. return _configPropertyName;
  27. }
  28. }
  29. public string FriendlyName {
  30. get {
  31. if (!_replaced) {
  32. _replaced = true;
  33. _friendlyName = Resources.ResourceManager.GetString(_friendlyName);
  34. }
  35. return _friendlyName;
  36. }
  37. }
  38. }
  39. }