Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / Mobile / DeviceFilterDictionary.cs / 1305376 / DeviceFilterDictionary.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Mobile { using System.Web; using System.Collections; using System.Reflection; using System.Diagnostics; using System.ComponentModel; [Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")] internal class DeviceFilterDictionary { internal class ComparisonEvaluator { internal readonly String capabilityName; internal readonly String capabilityArgument; internal ComparisonEvaluator(String name, String argument) { Debug.Assert(name != null); capabilityName = name; capabilityArgument = argument; } } private Hashtable _comparisonEvaluators = null; private Hashtable _delegateEvaluators = null; internal DeviceFilterDictionary() { _comparisonEvaluators = new Hashtable(); _delegateEvaluators = new Hashtable(); } internal DeviceFilterDictionary(DeviceFilterDictionary original) { _comparisonEvaluators = (Hashtable)original._comparisonEvaluators.Clone(); _delegateEvaluators = (Hashtable)original._delegateEvaluators.Clone(); } internal void AddCapabilityDelegate(String delegateName, MobileCapabilities.EvaluateCapabilitiesDelegate evaluator) { _delegateEvaluators[delegateName] = evaluator; } private void CheckForComparisonDelegateLoops(String delegateName) { String nextDelegateName = delegateName; Hashtable alreadyReferencedDelegates = new Hashtable(); while(true) { ComparisonEvaluator nextComparisonEvaluator = (ComparisonEvaluator)_comparisonEvaluators[nextDelegateName]; if(nextComparisonEvaluator == null) { break; } if(alreadyReferencedDelegates.Contains(nextDelegateName)) { String msg = SR.GetString(SR.DevFiltDict_FoundLoop, nextComparisonEvaluator.capabilityName, delegateName); throw new Exception(msg); } alreadyReferencedDelegates[nextDelegateName] = null; nextDelegateName = nextComparisonEvaluator.capabilityName; } } internal void AddComparisonDelegate(String delegateName, String comparisonName, String argument) { _comparisonEvaluators[delegateName] = new ComparisonEvaluator(comparisonName, argument); CheckForComparisonDelegateLoops(delegateName); } internal bool FindComparisonEvaluator(String evaluatorName, out String capabilityName, out String capabilityArgument) { capabilityName = null; capabilityArgument = null; ComparisonEvaluator evaluator = (ComparisonEvaluator)_comparisonEvaluators[evaluatorName]; if(evaluator == null) { return false; } capabilityName = evaluator.capabilityName; capabilityArgument = evaluator.capabilityArgument; return true; } internal bool FindDelegateEvaluator(String evaluatorName, out MobileCapabilities.EvaluateCapabilitiesDelegate evaluatorDelegate) { evaluatorDelegate = null; MobileCapabilities.EvaluateCapabilitiesDelegate evaluator; evaluator = (MobileCapabilities.EvaluateCapabilitiesDelegate) _delegateEvaluators[evaluatorName]; if(evaluator == null) { return false; } evaluatorDelegate = evaluator; return true; } internal bool IsComparisonEvaluator(String evaluatorName) { return _comparisonEvaluators.Contains(evaluatorName); } internal bool IsDelegateEvaluator(String evaluatorName) { return _delegateEvaluators.Contains(evaluatorName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Mobile { using System.Web; using System.Collections; using System.Reflection; using System.Diagnostics; using System.ComponentModel; [Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")] internal class DeviceFilterDictionary { internal class ComparisonEvaluator { internal readonly String capabilityName; internal readonly String capabilityArgument; internal ComparisonEvaluator(String name, String argument) { Debug.Assert(name != null); capabilityName = name; capabilityArgument = argument; } } private Hashtable _comparisonEvaluators = null; private Hashtable _delegateEvaluators = null; internal DeviceFilterDictionary() { _comparisonEvaluators = new Hashtable(); _delegateEvaluators = new Hashtable(); } internal DeviceFilterDictionary(DeviceFilterDictionary original) { _comparisonEvaluators = (Hashtable)original._comparisonEvaluators.Clone(); _delegateEvaluators = (Hashtable)original._delegateEvaluators.Clone(); } internal void AddCapabilityDelegate(String delegateName, MobileCapabilities.EvaluateCapabilitiesDelegate evaluator) { _delegateEvaluators[delegateName] = evaluator; } private void CheckForComparisonDelegateLoops(String delegateName) { String nextDelegateName = delegateName; Hashtable alreadyReferencedDelegates = new Hashtable(); while(true) { ComparisonEvaluator nextComparisonEvaluator = (ComparisonEvaluator)_comparisonEvaluators[nextDelegateName]; if(nextComparisonEvaluator == null) { break; } if(alreadyReferencedDelegates.Contains(nextDelegateName)) { String msg = SR.GetString(SR.DevFiltDict_FoundLoop, nextComparisonEvaluator.capabilityName, delegateName); throw new Exception(msg); } alreadyReferencedDelegates[nextDelegateName] = null; nextDelegateName = nextComparisonEvaluator.capabilityName; } } internal void AddComparisonDelegate(String delegateName, String comparisonName, String argument) { _comparisonEvaluators[delegateName] = new ComparisonEvaluator(comparisonName, argument); CheckForComparisonDelegateLoops(delegateName); } internal bool FindComparisonEvaluator(String evaluatorName, out String capabilityName, out String capabilityArgument) { capabilityName = null; capabilityArgument = null; ComparisonEvaluator evaluator = (ComparisonEvaluator)_comparisonEvaluators[evaluatorName]; if(evaluator == null) { return false; } capabilityName = evaluator.capabilityName; capabilityArgument = evaluator.capabilityArgument; return true; } internal bool FindDelegateEvaluator(String evaluatorName, out MobileCapabilities.EvaluateCapabilitiesDelegate evaluatorDelegate) { evaluatorDelegate = null; MobileCapabilities.EvaluateCapabilitiesDelegate evaluator; evaluator = (MobileCapabilities.EvaluateCapabilitiesDelegate) _delegateEvaluators[evaluatorName]; if(evaluator == null) { return false; } evaluatorDelegate = evaluator; return true; } internal bool IsComparisonEvaluator(String evaluatorName) { return _comparisonEvaluators.Contains(evaluatorName); } internal bool IsDelegateEvaluator(String evaluatorName) { return _delegateEvaluators.Contains(evaluatorName); } } } // 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
- TextLine.cs
- SourceChangedEventArgs.cs
- XomlDesignerLoader.cs
- AnnotationResourceChangedEventArgs.cs
- CookielessHelper.cs
- COM2ExtendedBrowsingHandler.cs
- Compiler.cs
- CodeAttributeDeclarationCollection.cs
- DoubleLinkListEnumerator.cs
- xml.cs
- ProfileElement.cs
- MenuStrip.cs
- MatchAttribute.cs
- BulletedList.cs
- DefaultBindingPropertyAttribute.cs
- UxThemeWrapper.cs
- SQLInt16.cs
- PersonalizationStateInfo.cs
- SimpleHandlerBuildProvider.cs
- DataSourceHelper.cs
- DiscoveryMessageSequence.cs
- Blend.cs
- DeclarativeCatalogPartDesigner.cs
- KnownTypesProvider.cs
- Decoder.cs
- ComponentRenameEvent.cs
- MimeFormReflector.cs
- LineGeometry.cs
- SafeViewOfFileHandle.cs
- PointHitTestResult.cs
- CharEnumerator.cs
- SingleConverter.cs
- ThreadStaticAttribute.cs
- XsltException.cs
- _SingleItemRequestCache.cs
- ObjectStateEntry.cs
- ComponentSerializationService.cs
- XslAstAnalyzer.cs
- AuthenticationConfig.cs
- RequestQueryProcessor.cs
- PolyBezierSegment.cs
- IdnElement.cs
- DataKeyArray.cs
- ManagementPath.cs
- DeferredReference.cs
- UInt64Storage.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- UInt16Storage.cs
- InputLanguageSource.cs
- LabelLiteral.cs
- XmlObjectSerializerReadContextComplexJson.cs
- ScrollViewer.cs
- ButtonChrome.cs
- PeerResolverBindingElement.cs
- Matrix.cs
- SafeWaitHandle.cs
- keycontainerpermission.cs
- XmlStringTable.cs
- QueryOperationResponseOfT.cs
- IPHostEntry.cs
- ThemeInfoAttribute.cs
- TypeViewSchema.cs
- UserControl.cs
- Tokenizer.cs
- CompilerParameters.cs
- EventOpcode.cs
- DetailsViewInsertEventArgs.cs
- NavigateEvent.cs
- SymbolPair.cs
- DataGridViewRowConverter.cs
- FormViewUpdateEventArgs.cs
- XmlDocumentType.cs
- TrustManagerPromptUI.cs
- SiteIdentityPermission.cs
- OrthographicCamera.cs
- AdornerLayer.cs
- messageonlyhwndwrapper.cs
- GeneralTransform.cs
- LineMetrics.cs
- ComNativeDescriptor.cs
- Completion.cs
- DbMetaDataColumnNames.cs
- LocatorPartList.cs
- GridViewCellAutomationPeer.cs
- PropertiesTab.cs
- IntSecurity.cs
- WebPartEditorOkVerb.cs
- Maps.cs
- SelectionItemProviderWrapper.cs
- CreateUserWizardStep.cs
- DecimalConverter.cs
- SmiGettersStream.cs
- CommandPlan.cs
- SingleAnimationUsingKeyFrames.cs
- ChannelManager.cs
- StorageComplexTypeMapping.cs
- SplineKeyFrames.cs
- RectAnimationClockResource.cs
- DocumentApplication.cs
- ExpressionVisitor.cs