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