Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Serialization / System / Text / SurrogateChar.cs / 1305376 / SurrogateChar.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Text { using System.Globalization; using System.Runtime.Serialization; // Just for SR struct SurrogateChar { char lowChar; char highChar; public const int MinValue = 0x10000; public const int MaxValue = MinValue + (1 << 20) - 1; const char surHighMin = (char) 0xd800; const char surHighMax = (char) 0xdbff; const char surLowMin = (char) 0xdc00; const char surLowMax = (char) 0xdfff; public SurrogateChar(int ch) { if (ch < MinValue || ch > MaxValue) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.XmlInvalidSurrogate, ch.ToString("X", CultureInfo.InvariantCulture)), "ch")); const int mask = ((1 << 10) - 1); this.lowChar = (char) (((ch - MinValue) & mask) + surLowMin); this.highChar = (char) ((((ch - MinValue) >> 10) & mask) + surHighMin); } public SurrogateChar(char lowChar, char highChar) { if (lowChar < surLowMin || lowChar > surLowMax) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.XmlInvalidLowSurrogate, ((int)lowChar).ToString("X", CultureInfo.InvariantCulture)), "lowChar")); if (highChar < surHighMin || highChar > surHighMax) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.XmlInvalidHighSurrogate, ((int)highChar).ToString("X", CultureInfo.InvariantCulture)), "highChar")); this.lowChar = lowChar; this.highChar = highChar; } public char LowChar { get { return lowChar; } } public char HighChar { get { return highChar; } } public int Char { get { return (lowChar - surLowMin) | ((highChar - surHighMin) << 10) + MinValue; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Text { using System.Globalization; using System.Runtime.Serialization; // Just for SR struct SurrogateChar { char lowChar; char highChar; public const int MinValue = 0x10000; public const int MaxValue = MinValue + (1 << 20) - 1; const char surHighMin = (char) 0xd800; const char surHighMax = (char) 0xdbff; const char surLowMin = (char) 0xdc00; const char surLowMax = (char) 0xdfff; public SurrogateChar(int ch) { if (ch < MinValue || ch > MaxValue) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.XmlInvalidSurrogate, ch.ToString("X", CultureInfo.InvariantCulture)), "ch")); const int mask = ((1 << 10) - 1); this.lowChar = (char) (((ch - MinValue) & mask) + surLowMin); this.highChar = (char) ((((ch - MinValue) >> 10) & mask) + surHighMin); } public SurrogateChar(char lowChar, char highChar) { if (lowChar < surLowMin || lowChar > surLowMax) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.XmlInvalidLowSurrogate, ((int)lowChar).ToString("X", CultureInfo.InvariantCulture)), "lowChar")); if (highChar < surHighMin || highChar > surHighMax) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.XmlInvalidHighSurrogate, ((int)highChar).ToString("X", CultureInfo.InvariantCulture)), "highChar")); this.lowChar = lowChar; this.highChar = highChar; } public char LowChar { get { return lowChar; } } public char HighChar { get { return highChar; } } public int Char { get { return (lowChar - surLowMin) | ((highChar - surHighMin) << 10) + MinValue; } } } } // 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
- WebBrowserSiteBase.cs
- StreamResourceInfo.cs
- ScalarConstant.cs
- DelimitedListTraceListener.cs
- TypeSystem.cs
- EventProvider.cs
- DefaultSerializationProviderAttribute.cs
- TextSimpleMarkerProperties.cs
- DropSourceBehavior.cs
- ScrollEvent.cs
- ArrayTypeMismatchException.cs
- RadioButtonDesigner.cs
- StorageFunctionMapping.cs
- TextEmbeddedObject.cs
- ResizeBehavior.cs
- AssemblyAssociatedContentFileAttribute.cs
- ObjectDataSourceSelectingEventArgs.cs
- StaticFileHandler.cs
- MergablePropertyAttribute.cs
- ActivationServices.cs
- Base64Decoder.cs
- HostVisual.cs
- CopyOfAction.cs
- StrokeNodeOperations2.cs
- PeerNameRegistration.cs
- XmlRawWriterWrapper.cs
- Int64Animation.cs
- EventManager.cs
- CultureSpecificStringDictionary.cs
- Solver.cs
- IPEndPoint.cs
- GridViewDesigner.cs
- CustomAttributeFormatException.cs
- SessionStateSection.cs
- QilGeneratorEnv.cs
- Bezier.cs
- StorageAssociationTypeMapping.cs
- BamlMapTable.cs
- OutputWindow.cs
- QilFactory.cs
- StrokeSerializer.cs
- ThicknessKeyFrameCollection.cs
- NonNullItemCollection.cs
- SineEase.cs
- DbDeleteCommandTree.cs
- MembershipPasswordException.cs
- TypedMessageConverter.cs
- AppLevelCompilationSectionCache.cs
- WSDualHttpSecurityMode.cs
- FormViewInsertedEventArgs.cs
- SqlUserDefinedTypeAttribute.cs
- ConfigurationException.cs
- VBIdentifierName.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- Funcletizer.cs
- RedBlackList.cs
- ClientApiGenerator.cs
- XhtmlBasicValidatorAdapter.cs
- SearchForVirtualItemEventArgs.cs
- RectIndependentAnimationStorage.cs
- SelectionRangeConverter.cs
- HtmlWindow.cs
- InfoCardTraceRecord.cs
- CLRBindingWorker.cs
- CallSiteBinder.cs
- XmlToDatasetMap.cs
- AutoResetEvent.cs
- PropertyEmitterBase.cs
- ZipPackagePart.cs
- ImageMap.cs
- PartialCachingAttribute.cs
- DefaultPrintController.cs
- PhysicalAddress.cs
- DataConnectionHelper.cs
- SettingsBase.cs
- Int32Animation.cs
- QueryOperator.cs
- NavigationExpr.cs
- TypefaceMetricsCache.cs
- FullTextLine.cs
- Oci.cs
- AuthenticateEventArgs.cs
- InvokeGenerator.cs
- TabControl.cs
- ToolStripComboBox.cs
- FlowDocumentReader.cs
- StyleHelper.cs
- Native.cs
- _LoggingObject.cs
- UrlPropertyAttribute.cs
- MouseGestureValueSerializer.cs
- ProfilePropertySettings.cs
- DynamicPhysicalDiscoSearcher.cs
- Roles.cs
- SqlStream.cs
- FormsAuthenticationEventArgs.cs
- FixedDSBuilder.cs
- HttpPostLocalhostServerProtocol.cs
- MetadataAssemblyHelper.cs
- WriteableBitmap.cs