Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Net / System / Net / _NetRes.cs / 1 / _NetRes.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net { using System.Diagnostics; using System.Globalization; internal class NetRes { /*++ Constructor This is the constructor, marked private because this class shouldn't be instantiated. --*/ private NetRes() { } /*++ GetWebStatusString - Get a WebExceptionStatus-specific resource string This method takes an input string and a WebExceptionStatus. We use the input string as a key to find a status message and the webStatus to produce a status-specific message, then we combine the two. Input: Res - Id for resource string. Status - The WebExceptionStatus to be formatted. Returns: string for localized message. --*/ public static string GetWebStatusString(string Res, WebExceptionStatus Status) { string Msg; string StatusMsg; StatusMsg = SR.GetString(WebExceptionMapping.GetWebStatusString(Status)); // Get the base status. Msg = SR.GetString(Res); // Format the status specific message into the base status and return // that return String.Format(CultureInfo.CurrentCulture, Msg, StatusMsg); } public static string GetWebStatusString(WebExceptionStatus Status) { return SR.GetString(WebExceptionMapping.GetWebStatusString(Status)); } /*++ GetWebStatusCodeString - Get a StatusCode-specific resource string This method is used to map a HTTP status code to a specific user readable error code. Input: statusCode - Id for resource string. Status - The WebExceptionStatus to be formatted. Returns: string for localized message. --*/ public static string GetWebStatusCodeString(HttpStatusCode statusCode, string statusDescription) { string webStatusCode = "(" + ((int)statusCode).ToString(NumberFormatInfo.InvariantInfo) + ")"; string statusMessage = null; // // Now combine the label with the base enum key and look up the status msg. // try { // // convert the HttpStatusCode to its label and look it up. // statusMessage = SR.GetString("net_httpstatuscode_" + statusCode.ToString(), null); } catch { } if (statusMessage!=null && statusMessage.Length>0) { webStatusCode += " " + statusMessage; } else { // // Otherwise try to map the base status. // if (statusDescription!=null && statusDescription.Length>0) { webStatusCode += " " + statusDescription; } } return webStatusCode; } public static string GetWebStatusCodeString(FtpStatusCode statusCode, string statusDescription) { string webStatusCode = "(" + ((int)statusCode).ToString(NumberFormatInfo.InvariantInfo) + ")"; string statusMessage = null; // // Now combine the label with the base enum key and look up the status msg. // try { // // convert the HttpStatusCode to its label and look it up. // statusMessage = SR.GetString("net_ftpstatuscode_" + statusCode.ToString(), null); } catch { } if (statusMessage!=null && statusMessage.Length>0) { webStatusCode += " " + statusMessage; } else { // // Otherwise try to map the base status. // if (statusDescription!=null && statusDescription.Length>0) { webStatusCode += " " + statusDescription; } } return webStatusCode; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net { using System.Diagnostics; using System.Globalization; internal class NetRes { /*++ Constructor This is the constructor, marked private because this class shouldn't be instantiated. --*/ private NetRes() { } /*++ GetWebStatusString - Get a WebExceptionStatus-specific resource string This method takes an input string and a WebExceptionStatus. We use the input string as a key to find a status message and the webStatus to produce a status-specific message, then we combine the two. Input: Res - Id for resource string. Status - The WebExceptionStatus to be formatted. Returns: string for localized message. --*/ public static string GetWebStatusString(string Res, WebExceptionStatus Status) { string Msg; string StatusMsg; StatusMsg = SR.GetString(WebExceptionMapping.GetWebStatusString(Status)); // Get the base status. Msg = SR.GetString(Res); // Format the status specific message into the base status and return // that return String.Format(CultureInfo.CurrentCulture, Msg, StatusMsg); } public static string GetWebStatusString(WebExceptionStatus Status) { return SR.GetString(WebExceptionMapping.GetWebStatusString(Status)); } /*++ GetWebStatusCodeString - Get a StatusCode-specific resource string This method is used to map a HTTP status code to a specific user readable error code. Input: statusCode - Id for resource string. Status - The WebExceptionStatus to be formatted. Returns: string for localized message. --*/ public static string GetWebStatusCodeString(HttpStatusCode statusCode, string statusDescription) { string webStatusCode = "(" + ((int)statusCode).ToString(NumberFormatInfo.InvariantInfo) + ")"; string statusMessage = null; // // Now combine the label with the base enum key and look up the status msg. // try { // // convert the HttpStatusCode to its label and look it up. // statusMessage = SR.GetString("net_httpstatuscode_" + statusCode.ToString(), null); } catch { } if (statusMessage!=null && statusMessage.Length>0) { webStatusCode += " " + statusMessage; } else { // // Otherwise try to map the base status. // if (statusDescription!=null && statusDescription.Length>0) { webStatusCode += " " + statusDescription; } } return webStatusCode; } public static string GetWebStatusCodeString(FtpStatusCode statusCode, string statusDescription) { string webStatusCode = "(" + ((int)statusCode).ToString(NumberFormatInfo.InvariantInfo) + ")"; string statusMessage = null; // // Now combine the label with the base enum key and look up the status msg. // try { // // convert the HttpStatusCode to its label and look it up. // statusMessage = SR.GetString("net_ftpstatuscode_" + statusCode.ToString(), null); } catch { } if (statusMessage!=null && statusMessage.Length>0) { webStatusCode += " " + statusMessage; } else { // // Otherwise try to map the base status. // if (statusDescription!=null && statusDescription.Length>0) { webStatusCode += " " + statusDescription; } } return webStatusCode; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SimpleFieldTemplateUserControl.cs
- LinqDataSourceSelectEventArgs.cs
- StorageInfo.cs
- SizeConverter.cs
- Baml2006ReaderContext.cs
- StylusDownEventArgs.cs
- coordinatorscratchpad.cs
- SqlDataSourceDesigner.cs
- ApplicationFileCodeDomTreeGenerator.cs
- FacetDescriptionElement.cs
- SiteMapNodeItemEventArgs.cs
- SHA256Managed.cs
- ExpressionBuilderContext.cs
- CallbackBehaviorAttribute.cs
- ExtensionWindowHeader.cs
- ListManagerBindingsCollection.cs
- PropertyMap.cs
- VersionedStream.cs
- UserUseLicenseDictionaryLoader.cs
- SqlMultiplexer.cs
- IntellisenseTextBox.designer.cs
- JsonFormatWriterGenerator.cs
- ZipIOLocalFileBlock.cs
- UserControlParser.cs
- KeyNotFoundException.cs
- ProtocolsConfigurationEntry.cs
- MSAAWinEventWrap.cs
- OdbcParameter.cs
- AnnotationResource.cs
- IProvider.cs
- HyperLinkStyle.cs
- NoResizeHandleGlyph.cs
- BindingNavigator.cs
- MobileErrorInfo.cs
- OneOfScalarConst.cs
- WorkflowItemPresenter.cs
- ComPlusDiagnosticTraceSchemas.cs
- InputLangChangeEvent.cs
- ServiceDurableInstanceContextProvider.cs
- ToolStripMenuItem.cs
- WebMessageFormatHelper.cs
- SystemIPAddressInformation.cs
- __ComObject.cs
- Misc.cs
- COM2ExtendedUITypeEditor.cs
- ListViewDataItem.cs
- _LoggingObject.cs
- SQLMembershipProvider.cs
- Classification.cs
- RoutedEvent.cs
- Drawing.cs
- MeasurementDCInfo.cs
- VirtualPath.cs
- SlotInfo.cs
- WindowHideOrCloseTracker.cs
- FieldDescriptor.cs
- StatusBarPanel.cs
- Empty.cs
- Processor.cs
- StateMachineHelpers.cs
- DbMetaDataColumnNames.cs
- BorderGapMaskConverter.cs
- Behavior.cs
- SafeFileMapViewHandle.cs
- KerberosSecurityTokenProvider.cs
- SchemaTableColumn.cs
- EventLog.cs
- OrderByExpression.cs
- StyleTypedPropertyAttribute.cs
- InternalControlCollection.cs
- TextBox.cs
- UnsafeNativeMethods.cs
- OleDbParameter.cs
- DataKey.cs
- XPathNodeList.cs
- ReadingWritingEntityEventArgs.cs
- XmlSignificantWhitespace.cs
- SessionParameter.cs
- Point3DAnimationBase.cs
- FrameworkEventSource.cs
- CursorConverter.cs
- TabControl.cs
- HelpInfo.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- RangeValuePattern.cs
- DataGridViewCellValueEventArgs.cs
- ToolStripPanelSelectionGlyph.cs
- ZipIOCentralDirectoryFileHeader.cs
- FacetChecker.cs
- BitmapCache.cs
- CompositeControlDesigner.cs
- AppDomainProtocolHandler.cs
- EqualityComparer.cs
- MailDefinition.cs
- NodeLabelEditEvent.cs
- OrderByBuilder.cs
- SharedPerformanceCounter.cs
- TextTreeTextElementNode.cs
- ConvertersCollection.cs
- InstanceCompleteException.cs