System.Data.Services.Client.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. //Copyright 2010 Microsoft Corporation
  2. //
  3. //Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
  4. //You may obtain a copy of the License at
  5. //
  6. //http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. //Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
  9. //"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. //See the License for the specific language governing permissions and limitations under the License.
  11. namespace System.Data.Services.Client {
  12. using System;
  13. using System.Reflection;
  14. using System.Globalization;
  15. using System.Resources;
  16. using System.Text;
  17. using System.Threading;
  18. using System.ComponentModel;
  19. using System.Security.Permissions;
  20. [AttributeUsage(AttributeTargets.All)]
  21. internal sealed class TextResDescriptionAttribute : DescriptionAttribute {
  22. private bool replaced;
  23. public TextResDescriptionAttribute(string description) : base(description) {
  24. }
  25. public override string Description {
  26. get {
  27. if (!replaced) {
  28. replaced = true;
  29. DescriptionValue = TextRes.GetString(base.Description);
  30. }
  31. return base.Description;
  32. }
  33. }
  34. }
  35. [AttributeUsage(AttributeTargets.All)]
  36. internal sealed class TextResCategoryAttribute : CategoryAttribute {
  37. public TextResCategoryAttribute(string category) : base(category) {
  38. }
  39. protected override string GetLocalizedString(string value) {
  40. return TextRes.GetString(value);
  41. }
  42. }
  43. internal sealed class TextRes {
  44. internal const string BatchStream_MissingBoundary = "BatchStream_MissingBoundary";
  45. internal const string BatchStream_ContentExpected = "BatchStream_ContentExpected";
  46. internal const string BatchStream_ContentUnexpected = "BatchStream_ContentUnexpected";
  47. internal const string BatchStream_GetMethodNotSupportedInChangeset = "BatchStream_GetMethodNotSupportedInChangeset";
  48. internal const string BatchStream_InvalidBatchFormat = "BatchStream_InvalidBatchFormat";
  49. internal const string BatchStream_InvalidDelimiter = "BatchStream_InvalidDelimiter";
  50. internal const string BatchStream_MissingEndChangesetDelimiter = "BatchStream_MissingEndChangesetDelimiter";
  51. internal const string BatchStream_InvalidHeaderValueSpecified = "BatchStream_InvalidHeaderValueSpecified";
  52. internal const string BatchStream_InvalidContentLengthSpecified = "BatchStream_InvalidContentLengthSpecified";
  53. internal const string BatchStream_OnlyGETOperationsCanBeSpecifiedInBatch = "BatchStream_OnlyGETOperationsCanBeSpecifiedInBatch";
  54. internal const string BatchStream_InvalidOperationHeaderSpecified = "BatchStream_InvalidOperationHeaderSpecified";
  55. internal const string BatchStream_InvalidHttpMethodName = "BatchStream_InvalidHttpMethodName";
  56. internal const string BatchStream_MoreDataAfterEndOfBatch = "BatchStream_MoreDataAfterEndOfBatch";
  57. internal const string BatchStream_InternalBufferRequestTooSmall = "BatchStream_InternalBufferRequestTooSmall";
  58. internal const string BatchStream_InvalidMethodHeaderSpecified = "BatchStream_InvalidMethodHeaderSpecified";
  59. internal const string BatchStream_InvalidHttpVersionSpecified = "BatchStream_InvalidHttpVersionSpecified";
  60. internal const string BatchStream_InvalidNumberOfHeadersAtOperationStart = "BatchStream_InvalidNumberOfHeadersAtOperationStart";
  61. internal const string BatchStream_MissingOrInvalidContentEncodingHeader = "BatchStream_MissingOrInvalidContentEncodingHeader";
  62. internal const string BatchStream_InvalidNumberOfHeadersAtChangeSetStart = "BatchStream_InvalidNumberOfHeadersAtChangeSetStart";
  63. internal const string BatchStream_MissingContentTypeHeader = "BatchStream_MissingContentTypeHeader";
  64. internal const string BatchStream_InvalidContentTypeSpecified = "BatchStream_InvalidContentTypeSpecified";
  65. internal const string Batch_ExpectedContentType = "Batch_ExpectedContentType";
  66. internal const string Batch_ExpectedResponse = "Batch_ExpectedResponse";
  67. internal const string Batch_IncompleteResponseCount = "Batch_IncompleteResponseCount";
  68. internal const string Batch_UnexpectedContent = "Batch_UnexpectedContent";
  69. internal const string Context_BaseUri = "Context_BaseUri";
  70. internal const string Context_CannotConvertKey = "Context_CannotConvertKey";
  71. internal const string Context_TrackingExpectsAbsoluteUri = "Context_TrackingExpectsAbsoluteUri";
  72. internal const string Context_LinkResourceInsertFailure = "Context_LinkResourceInsertFailure";
  73. internal const string Context_InternalError = "Context_InternalError";
  74. internal const string Context_BatchExecuteError = "Context_BatchExecuteError";
  75. internal const string Context_EntitySetName = "Context_EntitySetName";
  76. internal const string Context_MissingEditLinkInResponseBody = "Context_MissingEditLinkInResponseBody";
  77. internal const string Context_MissingSelfLinkInResponseBody = "Context_MissingSelfLinkInResponseBody";
  78. internal const string Context_MissingEditMediaLinkInResponseBody = "Context_MissingEditMediaLinkInResponseBody";
  79. internal const string Content_EntityWithoutKey = "Content_EntityWithoutKey";
  80. internal const string Content_EntityIsNotEntityType = "Content_EntityIsNotEntityType";
  81. internal const string Context_EntityNotContained = "Context_EntityNotContained";
  82. internal const string Context_EntityAlreadyContained = "Context_EntityAlreadyContained";
  83. internal const string Context_DifferentEntityAlreadyContained = "Context_DifferentEntityAlreadyContained";
  84. internal const string Context_DidNotOriginateAsync = "Context_DidNotOriginateAsync";
  85. internal const string Context_AsyncAlreadyDone = "Context_AsyncAlreadyDone";
  86. internal const string Context_OperationCanceled = "Context_OperationCanceled";
  87. internal const string Context_NoLoadWithInsertEnd = "Context_NoLoadWithInsertEnd";
  88. internal const string Context_NoRelationWithInsertEnd = "Context_NoRelationWithInsertEnd";
  89. internal const string Context_NoRelationWithDeleteEnd = "Context_NoRelationWithDeleteEnd";
  90. internal const string Context_RelationAlreadyContained = "Context_RelationAlreadyContained";
  91. internal const string Context_RelationNotRefOrCollection = "Context_RelationNotRefOrCollection";
  92. internal const string Context_AddLinkCollectionOnly = "Context_AddLinkCollectionOnly";
  93. internal const string Context_AddRelatedObjectCollectionOnly = "Context_AddRelatedObjectCollectionOnly";
  94. internal const string Context_AddRelatedObjectSourceDeleted = "Context_AddRelatedObjectSourceDeleted";
  95. internal const string Context_SetLinkReferenceOnly = "Context_SetLinkReferenceOnly";
  96. internal const string Context_NoContentTypeForMediaLink = "Context_NoContentTypeForMediaLink";
  97. internal const string Context_BatchNotSupportedForMediaLink = "Context_BatchNotSupportedForMediaLink";
  98. internal const string Context_UnexpectedZeroRawRead = "Context_UnexpectedZeroRawRead";
  99. internal const string Context_VersionNotSupported = "Context_VersionNotSupported";
  100. internal const string Context_SendingRequestEventArgsNotHttp = "Context_SendingRequestEventArgsNotHttp";
  101. internal const string Context_ChildResourceExists = "Context_ChildResourceExists";
  102. internal const string Context_EntityNotMediaLinkEntry = "Context_EntityNotMediaLinkEntry";
  103. internal const string Context_MLEWithoutSaveStream = "Context_MLEWithoutSaveStream";
  104. internal const string Context_SetSaveStreamOnMediaEntryProperty = "Context_SetSaveStreamOnMediaEntryProperty";
  105. internal const string Context_SetSaveStreamWithoutEditMediaLink = "Context_SetSaveStreamWithoutEditMediaLink";
  106. internal const string Collection_NullCollectionReference = "Collection_NullCollectionReference";
  107. internal const string ClientType_MissingOpenProperty = "ClientType_MissingOpenProperty";
  108. internal const string Clienttype_MultipleOpenProperty = "Clienttype_MultipleOpenProperty";
  109. internal const string ClientType_MissingProperty = "ClientType_MissingProperty";
  110. internal const string ClientType_KeysMustBeSimpleTypes = "ClientType_KeysMustBeSimpleTypes";
  111. internal const string ClientType_KeysOnDifferentDeclaredType = "ClientType_KeysOnDifferentDeclaredType";
  112. internal const string ClientType_MissingMimeTypeProperty = "ClientType_MissingMimeTypeProperty";
  113. internal const string ClientType_MissingMediaEntryProperty = "ClientType_MissingMediaEntryProperty";
  114. internal const string ClientType_NoSettableFields = "ClientType_NoSettableFields";
  115. internal const string ClientType_MultipleImplementationNotSupported = "ClientType_MultipleImplementationNotSupported";
  116. internal const string ClientType_NullOpenProperties = "ClientType_NullOpenProperties";
  117. internal const string ClientType_CollectionOfNonEntities = "ClientType_CollectionOfNonEntities";
  118. internal const string ClientType_Ambiguous = "ClientType_Ambiguous";
  119. internal const string DataServiceException_GeneralError = "DataServiceException_GeneralError";
  120. internal const string DataServiceRequest_FailGetCount = "DataServiceRequest_FailGetCount";
  121. internal const string Deserialize_GetEnumerator = "Deserialize_GetEnumerator";
  122. internal const string Deserialize_Current = "Deserialize_Current";
  123. internal const string Deserialize_MixedTextWithComment = "Deserialize_MixedTextWithComment";
  124. internal const string Deserialize_ExpectingSimpleValue = "Deserialize_ExpectingSimpleValue";
  125. internal const string Deserialize_NotApplicationXml = "Deserialize_NotApplicationXml";
  126. internal const string Deserialize_MismatchAtomLinkLocalSimple = "Deserialize_MismatchAtomLinkLocalSimple";
  127. internal const string Deserialize_MismatchAtomLinkFeedPropertyNotCollection = "Deserialize_MismatchAtomLinkFeedPropertyNotCollection";
  128. internal const string Deserialize_MismatchAtomLinkEntryPropertyIsCollection = "Deserialize_MismatchAtomLinkEntryPropertyIsCollection";
  129. internal const string Deserialize_UnknownMimeTypeSpecified = "Deserialize_UnknownMimeTypeSpecified";
  130. internal const string Deserialize_ExpectedEmptyMediaLinkEntryContent = "Deserialize_ExpectedEmptyMediaLinkEntryContent";
  131. internal const string Deserialize_ContentPlusPropertiesNotAllowed = "Deserialize_ContentPlusPropertiesNotAllowed";
  132. internal const string Deserialize_NoLocationHeader = "Deserialize_NoLocationHeader";
  133. internal const string Deserialize_ServerException = "Deserialize_ServerException";
  134. internal const string Deserialize_MissingIdElement = "Deserialize_MissingIdElement";
  135. internal const string EpmClientType_PropertyIsComplex = "EpmClientType_PropertyIsComplex";
  136. internal const string EpmClientType_PropertyIsPrimitive = "EpmClientType_PropertyIsPrimitive";
  137. internal const string EpmSourceTree_InvalidSourcePath = "EpmSourceTree_InvalidSourcePath";
  138. internal const string EpmSourceTree_DuplicateEpmAttrsWithSameSourceName = "EpmSourceTree_DuplicateEpmAttrsWithSameSourceName";
  139. internal const string EpmSourceTree_InaccessiblePropertyOnType = "EpmSourceTree_InaccessiblePropertyOnType";
  140. internal const string EpmTargetTree_InvalidTargetPath = "EpmTargetTree_InvalidTargetPath";
  141. internal const string EpmTargetTree_AttributeInMiddle = "EpmTargetTree_AttributeInMiddle";
  142. internal const string EpmTargetTree_DuplicateEpmAttrsWithSameTargetName = "EpmTargetTree_DuplicateEpmAttrsWithSameTargetName";
  143. internal const string EntityPropertyMapping_EpmAttribute = "EntityPropertyMapping_EpmAttribute";
  144. internal const string EntityPropertyMapping_TargetNamespaceUriNotValid = "EntityPropertyMapping_TargetNamespaceUriNotValid";
  145. internal const string HttpProcessUtility_ContentTypeMissing = "HttpProcessUtility_ContentTypeMissing";
  146. internal const string HttpProcessUtility_MediaTypeMissingValue = "HttpProcessUtility_MediaTypeMissingValue";
  147. internal const string HttpProcessUtility_MediaTypeRequiresSemicolonBeforeParameter = "HttpProcessUtility_MediaTypeRequiresSemicolonBeforeParameter";
  148. internal const string HttpProcessUtility_MediaTypeRequiresSlash = "HttpProcessUtility_MediaTypeRequiresSlash";
  149. internal const string HttpProcessUtility_MediaTypeRequiresSubType = "HttpProcessUtility_MediaTypeRequiresSubType";
  150. internal const string HttpProcessUtility_MediaTypeUnspecified = "HttpProcessUtility_MediaTypeUnspecified";
  151. internal const string HttpProcessUtility_EncodingNotSupported = "HttpProcessUtility_EncodingNotSupported";
  152. internal const string HttpProcessUtility_EscapeCharWithoutQuotes = "HttpProcessUtility_EscapeCharWithoutQuotes";
  153. internal const string HttpProcessUtility_EscapeCharAtEnd = "HttpProcessUtility_EscapeCharAtEnd";
  154. internal const string HttpProcessUtility_ClosingQuoteNotFound = "HttpProcessUtility_ClosingQuoteNotFound";
  155. internal const string MaterializeFromAtom_CountNotPresent = "MaterializeFromAtom_CountNotPresent";
  156. internal const string MaterializeFromAtom_CountFormatError = "MaterializeFromAtom_CountFormatError";
  157. internal const string MaterializeFromAtom_TopLevelLinkNotAvailable = "MaterializeFromAtom_TopLevelLinkNotAvailable";
  158. internal const string MaterializeFromAtom_CollectionKeyNotPresentInLinkTable = "MaterializeFromAtom_CollectionKeyNotPresentInLinkTable";
  159. internal const string MaterializeFromAtom_GetNestLinkForFlatCollection = "MaterializeFromAtom_GetNestLinkForFlatCollection";
  160. internal const string Serializer_NullKeysAreNotSupported = "Serializer_NullKeysAreNotSupported";
  161. internal const string Util_EmptyString = "Util_EmptyString";
  162. internal const string Util_EmptyArray = "Util_EmptyArray";
  163. internal const string Util_NullArrayElement = "Util_NullArrayElement";
  164. internal const string ALinq_UnsupportedExpression = "ALinq_UnsupportedExpression";
  165. internal const string ALinq_CouldNotConvert = "ALinq_CouldNotConvert";
  166. internal const string ALinq_MethodNotSupported = "ALinq_MethodNotSupported";
  167. internal const string ALinq_UnaryNotSupported = "ALinq_UnaryNotSupported";
  168. internal const string ALinq_BinaryNotSupported = "ALinq_BinaryNotSupported";
  169. internal const string ALinq_ConstantNotSupported = "ALinq_ConstantNotSupported";
  170. internal const string ALinq_TypeBinaryNotSupported = "ALinq_TypeBinaryNotSupported";
  171. internal const string ALinq_ConditionalNotSupported = "ALinq_ConditionalNotSupported";
  172. internal const string ALinq_ParameterNotSupported = "ALinq_ParameterNotSupported";
  173. internal const string ALinq_MemberAccessNotSupported = "ALinq_MemberAccessNotSupported";
  174. internal const string ALinq_LambdaNotSupported = "ALinq_LambdaNotSupported";
  175. internal const string ALinq_NewNotSupported = "ALinq_NewNotSupported";
  176. internal const string ALinq_MemberInitNotSupported = "ALinq_MemberInitNotSupported";
  177. internal const string ALinq_ListInitNotSupported = "ALinq_ListInitNotSupported";
  178. internal const string ALinq_NewArrayNotSupported = "ALinq_NewArrayNotSupported";
  179. internal const string ALinq_InvocationNotSupported = "ALinq_InvocationNotSupported";
  180. internal const string ALinq_QueryOptionsOnlyAllowedOnLeafNodes = "ALinq_QueryOptionsOnlyAllowedOnLeafNodes";
  181. internal const string ALinq_CantExpand = "ALinq_CantExpand";
  182. internal const string ALinq_CantCastToUnsupportedPrimitive = "ALinq_CantCastToUnsupportedPrimitive";
  183. internal const string ALinq_CantNavigateWithoutKeyPredicate = "ALinq_CantNavigateWithoutKeyPredicate";
  184. internal const string ALinq_CanOnlyApplyOneKeyPredicate = "ALinq_CanOnlyApplyOneKeyPredicate";
  185. internal const string ALinq_CantTranslateExpression = "ALinq_CantTranslateExpression";
  186. internal const string ALinq_TranslationError = "ALinq_TranslationError";
  187. internal const string ALinq_CantAddQueryOption = "ALinq_CantAddQueryOption";
  188. internal const string ALinq_CantAddDuplicateQueryOption = "ALinq_CantAddDuplicateQueryOption";
  189. internal const string ALinq_CantAddAstoriaQueryOption = "ALinq_CantAddAstoriaQueryOption";
  190. internal const string ALinq_CantAddQueryOptionStartingWithDollarSign = "ALinq_CantAddQueryOptionStartingWithDollarSign";
  191. internal const string ALinq_CantReferToPublicField = "ALinq_CantReferToPublicField";
  192. internal const string ALinq_QueryOptionsOnlyAllowedOnSingletons = "ALinq_QueryOptionsOnlyAllowedOnSingletons";
  193. internal const string ALinq_QueryOptionOutOfOrder = "ALinq_QueryOptionOutOfOrder";
  194. internal const string ALinq_CannotAddCountOption = "ALinq_CannotAddCountOption";
  195. internal const string ALinq_CannotAddCountOptionConflict = "ALinq_CannotAddCountOptionConflict";
  196. internal const string ALinq_ProjectionOnlyAllowedOnLeafNodes = "ALinq_ProjectionOnlyAllowedOnLeafNodes";
  197. internal const string ALinq_ProjectionCanOnlyHaveOneProjection = "ALinq_ProjectionCanOnlyHaveOneProjection";
  198. internal const string ALinq_ProjectionMemberAssignmentMismatch = "ALinq_ProjectionMemberAssignmentMismatch";
  199. internal const string ALinq_ExpressionNotSupportedInProjectionToEntity = "ALinq_ExpressionNotSupportedInProjectionToEntity";
  200. internal const string ALinq_ExpressionNotSupportedInProjection = "ALinq_ExpressionNotSupportedInProjection";
  201. internal const string ALinq_CannotConstructKnownEntityTypes = "ALinq_CannotConstructKnownEntityTypes";
  202. internal const string ALinq_CannotCreateConstantEntity = "ALinq_CannotCreateConstantEntity";
  203. internal const string ALinq_PropertyNamesMustMatchInProjections = "ALinq_PropertyNamesMustMatchInProjections";
  204. internal const string ALinq_CanOnlyProjectTheLeaf = "ALinq_CanOnlyProjectTheLeaf";
  205. internal const string ALinq_CannotProjectWithExplicitExpansion = "ALinq_CannotProjectWithExplicitExpansion";
  206. internal const string DSKAttribute_MustSpecifyAtleastOnePropertyName = "DSKAttribute_MustSpecifyAtleastOnePropertyName";
  207. internal const string DataServiceCollection_LoadRequiresTargetCollectionObserved = "DataServiceCollection_LoadRequiresTargetCollectionObserved";
  208. internal const string DataServiceCollection_CannotStopTrackingChildCollection = "DataServiceCollection_CannotStopTrackingChildCollection";
  209. internal const string DataServiceCollection_OperationForTrackedOnly = "DataServiceCollection_OperationForTrackedOnly";
  210. internal const string DataServiceCollection_CannotDetermineContextFromItems = "DataServiceCollection_CannotDetermineContextFromItems";
  211. internal const string DataServiceCollection_InsertIntoTrackedButNotLoadedCollection = "DataServiceCollection_InsertIntoTrackedButNotLoadedCollection";
  212. internal const string DataBinding_DataServiceCollectionArgumentMustHaveEntityType = "DataBinding_DataServiceCollectionArgumentMustHaveEntityType";
  213. internal const string DataBinding_CollectionPropertySetterValueHasObserver = "DataBinding_CollectionPropertySetterValueHasObserver";
  214. internal const string DataBinding_CollectionChangedUnknownAction = "DataBinding_CollectionChangedUnknownAction";
  215. internal const string DataBinding_BindingOperation_DetachedSource = "DataBinding_BindingOperation_DetachedSource";
  216. internal const string DataBinding_BindingOperation_ArrayItemNull = "DataBinding_BindingOperation_ArrayItemNull";
  217. internal const string DataBinding_BindingOperation_ArrayItemNotEntity = "DataBinding_BindingOperation_ArrayItemNotEntity";
  218. internal const string DataBinding_Util_UnknownEntitySetName = "DataBinding_Util_UnknownEntitySetName";
  219. internal const string DataBinding_EntityAlreadyInCollection = "DataBinding_EntityAlreadyInCollection";
  220. internal const string DataBinding_NotifyPropertyChangedNotImpl = "DataBinding_NotifyPropertyChangedNotImpl";
  221. internal const string DataBinding_ComplexObjectAssociatedWithMultipleEntities = "DataBinding_ComplexObjectAssociatedWithMultipleEntities";
  222. internal const string AtomParser_FeedUnexpected = "AtomParser_FeedUnexpected";
  223. internal const string AtomParser_PagingLinkOutsideOfFeed = "AtomParser_PagingLinkOutsideOfFeed";
  224. internal const string AtomParser_ManyFeedCounts = "AtomParser_ManyFeedCounts";
  225. internal const string AtomParser_FeedCountNotUnderFeed = "AtomParser_FeedCountNotUnderFeed";
  226. internal const string AtomParser_UnexpectedContentUnderExpandedLink = "AtomParser_UnexpectedContentUnderExpandedLink";
  227. internal const string AtomMaterializer_CannotAssignNull = "AtomMaterializer_CannotAssignNull";
  228. internal const string AtomMaterializer_DuplicatedNextLink = "AtomMaterializer_DuplicatedNextLink";
  229. internal const string AtomMaterializer_EntryIntoCollectionMismatch = "AtomMaterializer_EntryIntoCollectionMismatch";
  230. internal const string AtomMaterializer_EntryToAccessIsNull = "AtomMaterializer_EntryToAccessIsNull";
  231. internal const string AtomMaterializer_EntryToInitializeIsNull = "AtomMaterializer_EntryToInitializeIsNull";
  232. internal const string AtomMaterializer_ProjectEntityTypeMismatch = "AtomMaterializer_ProjectEntityTypeMismatch";
  233. internal const string AtomMaterializer_LinksMissingHref = "AtomMaterializer_LinksMissingHref";
  234. internal const string AtomMaterializer_PropertyMissing = "AtomMaterializer_PropertyMissing";
  235. internal const string AtomMaterializer_PropertyMissingFromEntry = "AtomMaterializer_PropertyMissingFromEntry";
  236. internal const string AtomMaterializer_PropertyNotExpectedEntry = "AtomMaterializer_PropertyNotExpectedEntry";
  237. static TextRes loader;
  238. ResourceManager resources;
  239. internal TextRes() {
  240. resources = new System.Resources.ResourceManager("System.Data.Services.Client", this.GetType().Assembly);
  241. }
  242. private static TextRes GetLoader() {
  243. if (loader == null) {
  244. TextRes sr = new TextRes();
  245. Interlocked.CompareExchange(ref loader, sr, null);
  246. }
  247. return loader;
  248. }
  249. private static CultureInfo Culture {
  250. get { return null; }
  251. }
  252. #if !TEXTRES_ONLYGETSTRING
  253. public static ResourceManager Resources {
  254. get {
  255. return GetLoader().resources;
  256. }
  257. }
  258. #endif
  259. public static string GetString(string name, params object[] args) {
  260. TextRes sys = GetLoader();
  261. if (sys == null)
  262. return null;
  263. string res = sys.resources.GetString(name, TextRes.Culture);
  264. if (args != null && args.Length > 0) {
  265. for (int i = 0; i < args.Length; i ++) {
  266. String value = args[i] as String;
  267. if (value != null && value.Length > 1024) {
  268. args[i] = value.Substring(0, 1024 - 3) + "...";
  269. }
  270. }
  271. return String.Format(CultureInfo.CurrentCulture, res, args);
  272. }
  273. else {
  274. return res;
  275. }
  276. }
  277. public static string GetString(string name) {
  278. TextRes sys = GetLoader();
  279. if (sys == null)
  280. return null;
  281. return sys.resources.GetString(name, TextRes.Culture);
  282. }
  283. #if !TEXTRES_ONLYGETSTRING
  284. public static object GetObject(string name) {
  285. TextRes sys = GetLoader();
  286. if (sys == null)
  287. return null;
  288. return sys.resources.GetObject(name, TextRes.Culture);
  289. }
  290. #endif
  291. }
  292. }