GlobalizationSection.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* header comment goes here */
  2. using System;
  3. using System.Configuration;
  4. using System.Text;
  5. using System.Xml;
  6. #if NET_2_0
  7. namespace System.Web.Configuration {
  8. public sealed class GlobalizationSection : ConfigurationSection
  9. {
  10. static ConfigurationProperty cultureProp;
  11. static ConfigurationProperty enableBestFitResponseEncodingProp;
  12. static ConfigurationProperty enableClientBasedCultureProp;
  13. static ConfigurationProperty fileEncodingProp;
  14. static ConfigurationProperty requestEncodingProp;
  15. static ConfigurationProperty resourceProviderFactoryTypeProp;
  16. static ConfigurationProperty responseEncodingProp;
  17. static ConfigurationProperty responseHeaderEncodingProp;
  18. static ConfigurationProperty uiCultureProp;
  19. static ConfigurationPropertyCollection properties;
  20. static GlobalizationSection ()
  21. {
  22. cultureProp = new ConfigurationProperty ("culture", typeof (string), "");
  23. enableBestFitResponseEncodingProp = new ConfigurationProperty ("enableBestFitResponseEncoding", typeof (bool), false);
  24. enableClientBasedCultureProp = new ConfigurationProperty ("enableClientBasedCulture", typeof (bool), false);
  25. fileEncodingProp = new ConfigurationProperty ("fileEncoding", typeof (Encoding));
  26. requestEncodingProp = new ConfigurationProperty ("requestEncoding", typeof (Encoding), Encoding.UTF8);
  27. resourceProviderFactoryTypeProp = new ConfigurationProperty ("resourceProviderFactoryType", typeof (string), "");
  28. responseEncodingProp = new ConfigurationProperty ("responseEncoding", typeof (Encoding), Encoding.UTF8);
  29. responseHeaderEncodingProp = new ConfigurationProperty ("responseHeaderEncoding", typeof (Encoding), Encoding.UTF8);
  30. uiCultureProp = new ConfigurationProperty ("uiCulture", typeof (string), "");
  31. properties = new ConfigurationPropertyCollection ();
  32. properties.Add (cultureProp);
  33. properties.Add (enableBestFitResponseEncodingProp);
  34. properties.Add (enableClientBasedCultureProp);
  35. properties.Add (fileEncodingProp);
  36. properties.Add (requestEncodingProp);
  37. properties.Add (resourceProviderFactoryTypeProp);
  38. properties.Add (responseEncodingProp);
  39. properties.Add (responseHeaderEncodingProp);
  40. properties.Add (uiCultureProp);
  41. }
  42. [MonoTODO]
  43. protected override void PostDeserialize ()
  44. {
  45. base.PostDeserialize();
  46. }
  47. [MonoTODO]
  48. protected override void PreSerialize (XmlWriter writer)
  49. {
  50. base.PostDeserialize();
  51. }
  52. [ConfigurationProperty ("culture", DefaultValue = "")]
  53. public string Culture {
  54. get { return (string) base [cultureProp];}
  55. set { base[cultureProp] = value; }
  56. }
  57. [ConfigurationProperty ("enableBestFitResponseEncoding", DefaultValue = "False")]
  58. public bool EnableBestFitResponseEncoding {
  59. get { return (bool) base [enableBestFitResponseEncodingProp];}
  60. set { base[enableBestFitResponseEncodingProp] = value; }
  61. }
  62. [ConfigurationProperty ("enableClientBasedCulture", DefaultValue = "False")]
  63. public bool EnableClientBasedCulture {
  64. get { return (bool) base [enableClientBasedCultureProp];}
  65. set { base[enableClientBasedCultureProp] = value; }
  66. }
  67. [ConfigurationProperty ("fileEncoding")]
  68. public Encoding FileEncoding {
  69. get { return (Encoding) base [fileEncodingProp];}
  70. set { base[fileEncodingProp] = value; }
  71. }
  72. [ConfigurationProperty ("requestEncoding", DefaultValue = "utf-8")]
  73. public Encoding RequestEncoding {
  74. get { return (Encoding) base [requestEncodingProp];}
  75. set { base[requestEncodingProp] = value; }
  76. }
  77. [ConfigurationProperty ("resourceProviderFactoryType", DefaultValue = "")]
  78. public string ResourceProviderFactoryType {
  79. get { return (string) base [resourceProviderFactoryTypeProp];}
  80. set { base[resourceProviderFactoryTypeProp] = value; }
  81. }
  82. [ConfigurationProperty ("responseEncoding", DefaultValue = "utf-8")]
  83. public Encoding ResponseEncoding {
  84. get { return (Encoding) base [responseEncodingProp];}
  85. set { base[responseEncodingProp] = value; }
  86. }
  87. [ConfigurationProperty ("responseHeaderEncoding", DefaultValue = "utf-8")]
  88. public Encoding ResponseHeaderEncoding {
  89. get { return (Encoding) base [responseHeaderEncodingProp];}
  90. set { base[responseHeaderEncodingProp] = value; }
  91. }
  92. [ConfigurationProperty ("uiCulture", DefaultValue = "")]
  93. public string UICulture {
  94. get { return (string) base [uiCultureProp];}
  95. set { base[uiCultureProp] = value; }
  96. }
  97. protected override ConfigurationPropertyCollection Properties {
  98. get { return properties; }
  99. }
  100. }
  101. }
  102. #endif