Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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. //------------------------------------------------------------------------------ //When overridden in a derived class, gets the version of the specified /// feature that is available on the system. ///// 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.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
- BitmapEffectOutputConnector.cs
- ComponentCommands.cs
- LicenseProviderAttribute.cs
- CqlGenerator.cs
- ParserExtension.cs
- UndirectedGraph.cs
- PropertyEntry.cs
- StandardCommands.cs
- ToolStripComboBox.cs
- _TransmitFileOverlappedAsyncResult.cs
- XLinq.cs
- IApplicationTrustManager.cs
- HwndStylusInputProvider.cs
- ConfigurationLockCollection.cs
- ObjectManager.cs
- IdnMapping.cs
- Rect3DConverter.cs
- HopperCache.cs
- NonBatchDirectoryCompiler.cs
- Int32.cs
- DeploymentExceptionMapper.cs
- NaturalLanguageHyphenator.cs
- FileDetails.cs
- ListViewContainer.cs
- HandleRef.cs
- DataPointer.cs
- InstanceStoreQueryResult.cs
- XmlDictionaryReader.cs
- FormView.cs
- BridgeDataRecord.cs
- ModelServiceImpl.cs
- StylusPointProperties.cs
- ToolStripOverflowButton.cs
- SpeechSynthesizer.cs
- SByteStorage.cs
- Filter.cs
- XmlSchemaException.cs
- Formatter.cs
- CryptoHelper.cs
- ContextMenu.cs
- TraceHandler.cs
- SafeHandle.cs
- XmlnsPrefixAttribute.cs
- PolicyUnit.cs
- TextViewBase.cs
- CryptoApi.cs
- PrivateFontCollection.cs
- DataGridPagerStyle.cs
- Hex.cs
- SoapSchemaImporter.cs
- DataGridViewTextBoxCell.cs
- ParamArrayAttribute.cs
- CapabilitiesPattern.cs
- GeneralTransform3DTo2D.cs
- CommandTreeTypeHelper.cs
- SizeAnimationBase.cs
- DataGridCell.cs
- PreviewKeyDownEventArgs.cs
- GroupBoxAutomationPeer.cs
- ICollection.cs
- PerformanceCounterManager.cs
- WhitespaceRuleReader.cs
- HtmlLink.cs
- MultiSelector.cs
- wgx_sdk_version.cs
- InteropEnvironment.cs
- DetailsViewModeEventArgs.cs
- HtmlElementCollection.cs
- SelectionPattern.cs
- ControlPager.cs
- CommandEventArgs.cs
- MessageQueueCriteria.cs
- ErrorFormatterPage.cs
- BinaryMethodMessage.cs
- ZeroOpNode.cs
- Variable.cs
- TextModifier.cs
- TypeInitializationException.cs
- AttributeEmitter.cs
- ColorAnimationUsingKeyFrames.cs
- DependencyPropertyAttribute.cs
- TableLayoutPanelBehavior.cs
- CollectionAdapters.cs
- ScriptingScriptResourceHandlerSection.cs
- VisualBasic.cs
- VectorKeyFrameCollection.cs
- objectresult_tresulttype.cs
- StaticFileHandler.cs
- SimpleBitVector32.cs
- DSACryptoServiceProvider.cs
- ConfigXmlComment.cs
- QuadraticBezierSegment.cs
- ReadOnlyCollection.cs
- PartialArray.cs
- DBPropSet.cs
- SamlConditions.cs
- HostedNamedPipeTransportManager.cs
- DnsPermission.cs
- SpecularMaterial.cs
- XmlValidatingReaderImpl.cs