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