Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / MS / Internal / FontCache / ElementFactory.cs / 1 / ElementFactory.cs
//---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.Diagnostics; using System.IO; using System.Net; using System.Security; using MS.Internal.PresentationCore; // Since we disable PreSharp warnings in this file, we first need to disable warnings about unknown message numbers and unknown pragmas. #pragma warning disable 1634, 1691 // Disable PreSharp warning about empty catch bodies. // We have many situations in this file where the service needs to robust against external data, // and empty catch bodies allow for uniform error handling code paths. #pragma warning disable 6502 namespace MS.Internal.FontCache { ////// Critical - The class is used by the server to construct font cache elements. /// It is unaware of what method will be used to communicate the data to the server. /// [SecurityCritical(SecurityCriticalScope.Everything)] [FriendAccessAllowed] internal static class ElementFactory { ////// Creates an element from a miss report key. Checks for errors in element construction /// that could arise if either key or font file is corrupt. Returns the element if successful /// or null to indicate an error. /// internal static IFontCacheElement CreateElementFromKey(int type, CheckedPointer key) { try { switch (type) { case 2: return new FamilyCollection(key); case 3: return new FontFaceLayoutInfo(key); case 1: return new GlyphBitmapElement(key); case 4: return new GlyphPathElement(key); default: return null; } } catch (ArgumentOutOfRangeException) { // The cache element key is malformed. } catch (UriFormatException) { // Font file Uri is malformed. } catch (IOException) { // Font file doesn't exist or cannot be read due to an I/O error. } catch (UnauthorizedAccessException) { // Font file cannot be accessed by the service account. } catch (WebException) { //This error can happen if the miss report specifies a web address for the font file. //(This is not a subclass of I/O exception). } return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.Diagnostics; using System.IO; using System.Net; using System.Security; using MS.Internal.PresentationCore; // Since we disable PreSharp warnings in this file, we first need to disable warnings about unknown message numbers and unknown pragmas. #pragma warning disable 1634, 1691 // Disable PreSharp warning about empty catch bodies. // We have many situations in this file where the service needs to robust against external data, // and empty catch bodies allow for uniform error handling code paths. #pragma warning disable 6502 namespace MS.Internal.FontCache { ////// Critical - The class is used by the server to construct font cache elements. /// It is unaware of what method will be used to communicate the data to the server. /// [SecurityCritical(SecurityCriticalScope.Everything)] [FriendAccessAllowed] internal static class ElementFactory { ////// Creates an element from a miss report key. Checks for errors in element construction /// that could arise if either key or font file is corrupt. Returns the element if successful /// or null to indicate an error. /// internal static IFontCacheElement CreateElementFromKey(int type, CheckedPointer key) { try { switch (type) { case 2: return new FamilyCollection(key); case 3: return new FontFaceLayoutInfo(key); case 1: return new GlyphBitmapElement(key); case 4: return new GlyphPathElement(key); default: return null; } } catch (ArgumentOutOfRangeException) { // The cache element key is malformed. } catch (UriFormatException) { // Font file Uri is malformed. } catch (IOException) { // Font file doesn't exist or cannot be read due to an I/O error. } catch (UnauthorizedAccessException) { // Font file cannot be accessed by the service account. } catch (WebException) { //This error can happen if the miss report specifies a web address for the font file. //(This is not a subclass of I/O exception). } return null; } } } // 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
- PageContent.cs
- Utils.cs
- FormattedText.cs
- AuthenticatedStream.cs
- KnownTypesHelper.cs
- AuthenticationService.cs
- CodeIdentifiers.cs
- DbLambda.cs
- RoleServiceManager.cs
- Viewport3DAutomationPeer.cs
- ListViewTableRow.cs
- LocatorBase.cs
- TailCallAnalyzer.cs
- DataGridTextBoxColumn.cs
- HttpAsyncResult.cs
- DispatchChannelSink.cs
- ProcessModelSection.cs
- FormViewModeEventArgs.cs
- BitmapCodecInfo.cs
- RoutedEventArgs.cs
- EntityClientCacheEntry.cs
- OracleDataReader.cs
- MobileComponentEditorPage.cs
- OleDbConnection.cs
- XmlTextReaderImplHelpers.cs
- CodeAttributeDeclarationCollection.cs
- UMPAttributes.cs
- SmiTypedGetterSetter.cs
- XmlCharType.cs
- IntranetCredentialPolicy.cs
- VoiceObjectToken.cs
- WSTrustDec2005.cs
- ScriptRegistrationManager.cs
- NativeMethods.cs
- Logging.cs
- EntryWrittenEventArgs.cs
- Transactions.cs
- DocumentPageView.cs
- Base64Stream.cs
- ActiveXHelper.cs
- SlipBehavior.cs
- SharedTcpTransportManager.cs
- SafeEventLogReadHandle.cs
- WinEventWrap.cs
- UIElementIsland.cs
- ResXFileRef.cs
- ConnectionPoolManager.cs
- NativeMethods.cs
- XPathEmptyIterator.cs
- COM2Properties.cs
- ExceptionHandler.cs
- RoutedPropertyChangedEventArgs.cs
- PerformanceCounterPermissionEntryCollection.cs
- ImageIndexConverter.cs
- XamlPoint3DCollectionSerializer.cs
- BitmapInitialize.cs
- ContentFileHelper.cs
- VectorCollectionConverter.cs
- ScrollEventArgs.cs
- _ListenerResponseStream.cs
- ModuleBuilder.cs
- TabletDevice.cs
- TagPrefixCollection.cs
- PointLight.cs
- HebrewCalendar.cs
- EtwTrace.cs
- SerialReceived.cs
- SimplePropertyEntry.cs
- GroupedContextMenuStrip.cs
- DefaultPrintController.cs
- PrimitiveCodeDomSerializer.cs
- WsatAdminException.cs
- __Error.cs
- ProcessManager.cs
- ImmComposition.cs
- CustomErrorsSection.cs
- ZipIOExtraFieldZip64Element.cs
- AbstractExpressions.cs
- MonthCalendar.cs
- ReceiveContent.cs
- BufferModeSettings.cs
- PageCodeDomTreeGenerator.cs
- PartialCachingControl.cs
- XmlSortKey.cs
- XmlSerializerVersionAttribute.cs
- ImageAnimator.cs
- EvidenceTypeDescriptor.cs
- TextServicesCompartmentContext.cs
- BrowserCapabilitiesFactory.cs
- SchemaAttDef.cs
- DispatcherTimer.cs
- GridErrorDlg.cs
- DockingAttribute.cs
- QilLiteral.cs
- DataGridViewTextBoxColumn.cs
- __ComObject.cs
- AnnotationAuthorChangedEventArgs.cs
- WCFServiceClientProxyGenerator.cs
- EdmToObjectNamespaceMap.cs
- Storyboard.cs