Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- ForwardPositionQuery.cs
- PageCodeDomTreeGenerator.cs
- Handle.cs
- PointCollectionValueSerializer.cs
- UnaryNode.cs
- documentsequencetextview.cs
- XmlSchemaParticle.cs
- DBDataPermissionAttribute.cs
- InternalTypeHelper.cs
- DispatcherTimer.cs
- QuotedPrintableStream.cs
- TextParagraphView.cs
- GridViewUpdateEventArgs.cs
- EditBehavior.cs
- NumericUpDownAccelerationCollection.cs
- InputManager.cs
- NativeWindow.cs
- FrameDimension.cs
- BehaviorDragDropEventArgs.cs
- CodeAttributeArgument.cs
- Base64Encoding.cs
- BitmapScalingModeValidation.cs
- ReachFixedPageSerializerAsync.cs
- WebDescriptionAttribute.cs
- DecimalAnimation.cs
- RowUpdatingEventArgs.cs
- PageCodeDomTreeGenerator.cs
- Stylus.cs
- GrammarBuilderBase.cs
- SchemaTypeEmitter.cs
- DataGridItem.cs
- RootDesignerSerializerAttribute.cs
- Validator.cs
- ThicknessAnimation.cs
- GPStream.cs
- Timeline.cs
- Setter.cs
- PersonalizationProvider.cs
- WindowsIdentity.cs
- WCFServiceClientProxyGenerator.cs
- EventSinkHelperWriter.cs
- CustomErrorsSectionWrapper.cs
- GridViewDeleteEventArgs.cs
- CDSsyncETWBCLProvider.cs
- FixedSchema.cs
- HierarchicalDataBoundControl.cs
- Peer.cs
- BindValidator.cs
- PeerResolverElement.cs
- OciHandle.cs
- XmlElement.cs
- XmlSerializationWriter.cs
- ExpressionWriter.cs
- storepermission.cs
- BindingValueChangedEventArgs.cs
- DebugControllerThread.cs
- BufferedGraphics.cs
- ViewStateModeByIdAttribute.cs
- XPathNavigator.cs
- Lease.cs
- StringArrayConverter.cs
- TargetControlTypeAttribute.cs
- Domain.cs
- CompiledELinqQueryState.cs
- Int32.cs
- CallbackHandler.cs
- XNodeValidator.cs
- GAC.cs
- _AutoWebProxyScriptHelper.cs
- SmiMetaData.cs
- Base64Stream.cs
- XpsFilter.cs
- Ray3DHitTestResult.cs
- AsyncOperationManager.cs
- SimpleFileLog.cs
- SafeNativeMethods.cs
- StackBuilderSink.cs
- CodeAssignStatement.cs
- _CacheStreams.cs
- UseManagedPresentationBindingElementImporter.cs
- ExpressionEditor.cs
- AnnouncementService.cs
- Vars.cs
- ResizeBehavior.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- EntityDataSourceStatementEditorForm.cs
- SHA1.cs
- SafeHandles.cs
- MemberAccessException.cs
- cookieexception.cs
- BasePropertyDescriptor.cs
- ChannelServices.cs
- QueryCacheEntry.cs
- ComponentChangedEvent.cs
- OptimisticConcurrencyException.cs
- BinaryMethodMessage.cs
- DataGridColumnHeaderCollection.cs
- ProfileSettingsCollection.cs
- WindowClosedEventArgs.cs
- Hashtable.cs