Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / WinForms / Managed / System / WinForms / FeatureSupport.cs / 1 / FeatureSupport.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System.Configuration.Assemblies; using System.Diagnostics; using System; using System.Reflection; using System.Security; using System.Security.Permissions; ////// /// public abstract class FeatureSupport : IFeatureSupport { ///Provides ///methods for retrieving feature information from the /// current system. /// /// public static bool IsPresent(string featureClassName, string featureConstName) { return IsPresent(featureClassName, featureConstName, new Version(0, 0, 0, 0)); } ///Determines whether any version of the specified feature /// is installed in the system. This method is ///. /// /// public static bool IsPresent(string featureClassName, string featureConstName, Version minimumVersion) { object featureId = null; IFeatureSupport featureSupport = null; //APPCOMPAT: If Type.GetType() throws, we want to return //null to preserve Everett behavior. Type c = null; try { c = Type.GetType(featureClassName); } catch (ArgumentException) {} if (c != null) { FieldInfo fi = c.GetField(featureConstName); if (fi != null) { featureId = fi.GetValue(null); } } if (featureId != null && typeof(IFeatureSupport).IsAssignableFrom(c)) { featureSupport = (IFeatureSupport) SecurityUtils.SecureCreateInstance(c); if (featureSupport != null) { return featureSupport.IsPresent(featureId, minimumVersion); } } return false; } ///Determines whether the specified or newer version of the specified feature is /// installed in the system. This method is ///. /// /// public static Version GetVersionPresent(string featureClassName, string featureConstName) { object featureId = null; IFeatureSupport featureSupport = null; //APPCOMPAT: If Type.GetType() throws, we want to return //null to preserve Everett behavior. Type c = null; try { c = Type.GetType(featureClassName); } catch (ArgumentException) {} if (c != null) { FieldInfo fi = c.GetField(featureConstName); if (fi != null) { featureId = fi.GetValue(null); } } if (featureId != null) { featureSupport = (IFeatureSupport) SecurityUtils.SecureCreateInstance(c); if (featureSupport != null) { return featureSupport.GetVersionPresent(featureId); } } return null; } ///Gets the version of the specified feature that is available on the system. ////// /// public virtual bool IsPresent(object feature) { return IsPresent(feature, new Version(0, 0, 0, 0)); } ///Determines whether any version of the specified feature /// is installed in the system. ////// /// public virtual bool IsPresent(object feature, Version minimumVersion) { Version ver = GetVersionPresent(feature); if (ver != null) { return ver.CompareTo(minimumVersion) >= 0; } return false; } ///Determines whether the specified or newer version of the /// specified feature is installed in the system. ////// /// public abstract Version GetVersionPresent(object feature); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.When overridden in a derived class, gets the version of the specified /// feature that is available on the system. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ICspAsymmetricAlgorithm.cs
- MissingSatelliteAssemblyException.cs
- DataGridViewDataConnection.cs
- DataKeyPropertyAttribute.cs
- Menu.cs
- CharacterBuffer.cs
- GestureRecognitionResult.cs
- ConfigXmlWhitespace.cs
- TraceUtility.cs
- BoundField.cs
- KeyboardEventArgs.cs
- StorageAssociationTypeMapping.cs
- SerializationAttributes.cs
- HttpWriter.cs
- IResourceProvider.cs
- infer.cs
- MessageFormatterConverter.cs
- MouseGesture.cs
- SecurityContext.cs
- RelationshipWrapper.cs
- PriorityBinding.cs
- ScriptManagerProxy.cs
- Listbox.cs
- ContextConfiguration.cs
- ThreadSafeList.cs
- RankException.cs
- DependencyPropertyChangedEventArgs.cs
- FixedLineResult.cs
- NavigationExpr.cs
- ByteStorage.cs
- DateTimeOffsetAdapter.cs
- OptimisticConcurrencyException.cs
- AssemblyHash.cs
- SyndicationContent.cs
- XmlBufferReader.cs
- ScriptBehaviorDescriptor.cs
- ReadOnlyState.cs
- StateChangeEvent.cs
- FieldValue.cs
- TransformDescriptor.cs
- SecondaryIndexList.cs
- Formatter.cs
- OpCellTreeNode.cs
- ParentControlDesigner.cs
- IconHelper.cs
- DbDeleteCommandTree.cs
- TextServicesCompartmentEventSink.cs
- SignatureDescription.cs
- FrameSecurityDescriptor.cs
- LineBreakRecord.cs
- InternalConfigEventArgs.cs
- EventToken.cs
- ProgressChangedEventArgs.cs
- XmlILAnnotation.cs
- TextContainerChangeEventArgs.cs
- WizardStepBase.cs
- BehaviorDragDropEventArgs.cs
- ProviderUtil.cs
- TrackingServices.cs
- SqlBooleanMismatchVisitor.cs
- ViewService.cs
- XPathNodeHelper.cs
- DeclarationUpdate.cs
- CodeBlockBuilder.cs
- AutomationPatternInfo.cs
- CollectionContainer.cs
- SafeTimerHandle.cs
- ErrorWrapper.cs
- XmlElementAttributes.cs
- HwndStylusInputProvider.cs
- RsaSecurityTokenAuthenticator.cs
- RestClientProxyHandler.cs
- WebResourceUtil.cs
- AliasGenerator.cs
- DbModificationCommandTree.cs
- ResourcePool.cs
- SvcMapFileSerializer.cs
- TranslateTransform3D.cs
- Timeline.cs
- CodeTypeDeclarationCollection.cs
- Encoder.cs
- CodeDomConfigurationHandler.cs
- ButtonFlatAdapter.cs
- OdbcHandle.cs
- RichTextBox.cs
- HtmlTableRowCollection.cs
- ConstantSlot.cs
- CommonDialog.cs
- HttpResponseWrapper.cs
- SizeKeyFrameCollection.cs
- NoneExcludedImageIndexConverter.cs
- SuppressIldasmAttribute.cs
- Oid.cs
- Scripts.cs
- XmlWrappingReader.cs
- ListenerConnectionModeReader.cs
- Registry.cs
- FontFamilyValueSerializer.cs
- BuildResultCache.cs
- MobileControlsSectionHelper.cs