Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- cryptoapiTransform.cs
- BinaryObjectReader.cs
- ReferenceSchema.cs
- SqlTopReducer.cs
- Style.cs
- ReadContentAsBinaryHelper.cs
- Stack.cs
- OracleLob.cs
- SrgsElementFactoryCompiler.cs
- ThousandthOfEmRealDoubles.cs
- FragmentQuery.cs
- InternalException.cs
- SharedPerformanceCounter.cs
- HttpCachePolicyBase.cs
- bidPrivateBase.cs
- HtmlCommandAdapter.cs
- NaturalLanguageHyphenator.cs
- Profiler.cs
- JapaneseLunisolarCalendar.cs
- DesignerActionItemCollection.cs
- Header.cs
- WorkflowMarkupElementEventArgs.cs
- SerializationFieldInfo.cs
- XsdBuilder.cs
- StaticFileHandler.cs
- PKCS1MaskGenerationMethod.cs
- TrackingValidationObjectDictionary.cs
- HttpModuleAction.cs
- CurrentTimeZone.cs
- PartitionerQueryOperator.cs
- StreamingContext.cs
- DataGridViewTextBoxCell.cs
- SqlDataSourceEnumerator.cs
- WrapPanel.cs
- HttpListenerResponse.cs
- SystemNetworkInterface.cs
- DescendantQuery.cs
- WindowHideOrCloseTracker.cs
- StandardCommandToolStripMenuItem.cs
- ScriptIgnoreAttribute.cs
- WebCategoryAttribute.cs
- HtmlInputPassword.cs
- DocumentPageHost.cs
- VisualBrush.cs
- PasswordRecovery.cs
- SafeRegistryKey.cs
- CodeSnippetStatement.cs
- InfoCardAsymmetricCrypto.cs
- QueryCacheKey.cs
- ComponentCommands.cs
- TextMetrics.cs
- QilUnary.cs
- Ticks.cs
- ClientOperation.cs
- FixedFlowMap.cs
- DataGridAddNewRow.cs
- LinqDataSourceView.cs
- ErrorRuntimeConfig.cs
- DataObjectEventArgs.cs
- StyleSheetDesigner.cs
- DebugView.cs
- HighlightComponent.cs
- Page.cs
- Path.cs
- XmlQueryStaticData.cs
- CacheRequest.cs
- WrappedReader.cs
- DeferredTextReference.cs
- SystemColors.cs
- RepeatButton.cs
- StreamGeometry.cs
- VariableExpressionConverter.cs
- ProcessHostServerConfig.cs
- ObfuscationAttribute.cs
- WebRequestModulesSection.cs
- BuildManager.cs
- DodSequenceMerge.cs
- AdCreatedEventArgs.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- DbConnectionPool.cs
- QuaternionRotation3D.cs
- codemethodreferenceexpression.cs
- ObjectListItemCollection.cs
- Pen.cs
- CustomCategoryAttribute.cs
- RegexCaptureCollection.cs
- OdbcCommandBuilder.cs
- Tuple.cs
- DropSource.cs
- RequestCachingSection.cs
- FontWeightConverter.cs
- Size3DValueSerializer.cs
- WindowsListBox.cs
- XmlTextWriter.cs
- MutexSecurity.cs
- MetadataItem.cs
- InvokeProviderWrapper.cs
- TextEditorMouse.cs
- DelegatedStream.cs
- BitVector32.cs