Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ReachIDocumentPaginatorSerializer.cs
- DbConnectionStringBuilder.cs
- WindowsListViewSubItem.cs
- TextTreeInsertElementUndoUnit.cs
- VScrollProperties.cs
- Html32TextWriter.cs
- counter.cs
- XamlClipboardData.cs
- SelectingProviderEventArgs.cs
- HwndMouseInputProvider.cs
- TimeSpanOrInfiniteConverter.cs
- WebServiceFaultDesigner.cs
- ActivationArguments.cs
- RemotingAttributes.cs
- GridPattern.cs
- StatusBar.cs
- UpDownEvent.cs
- ControlAdapter.cs
- InputBinding.cs
- PolyQuadraticBezierSegment.cs
- ImageList.cs
- QuaternionAnimation.cs
- Pkcs7Recipient.cs
- DoubleStorage.cs
- IsolatedStorageException.cs
- MaterialGroup.cs
- CounterSampleCalculator.cs
- ActivityCodeDomSerializationManager.cs
- RecipientInfo.cs
- MemberJoinTreeNode.cs
- OutOfMemoryException.cs
- Button.cs
- TransformerInfoCollection.cs
- Hex.cs
- GraphicsContainer.cs
- ThreadStaticAttribute.cs
- ConstantSlot.cs
- InstancePersistenceCommand.cs
- DataKeyArray.cs
- PropertyGeneratedEventArgs.cs
- XmlException.cs
- XpsViewerException.cs
- TextFragmentEngine.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- InputLanguage.cs
- CodeNamespaceImport.cs
- BCLDebug.cs
- UnregisterInfo.cs
- ListViewTableCell.cs
- DesignerToolboxInfo.cs
- StringValidator.cs
- XsdCachingReader.cs
- WebServiceMethodData.cs
- SqlUdtInfo.cs
- ExtensionDataReader.cs
- TemplatePagerField.cs
- ClientFormsIdentity.cs
- XamlDesignerSerializationManager.cs
- StorageRoot.cs
- FontCacheUtil.cs
- ApplicationTrust.cs
- SQLStringStorage.cs
- ImageIndexConverter.cs
- XmlMtomReader.cs
- PerformanceCountersElement.cs
- LZCodec.cs
- FigureHelper.cs
- SqlUtil.cs
- Roles.cs
- SessionStateItemCollection.cs
- LayoutTable.cs
- sqlnorm.cs
- BamlRecordHelper.cs
- SpoolingTask.cs
- PrintPreviewDialog.cs
- MetadataCache.cs
- DesignBindingValueUIHandler.cs
- ACE.cs
- ObjectAssociationEndMapping.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- RectangleHotSpot.cs
- StaticContext.cs
- DBCommand.cs
- ChangeTracker.cs
- ContextMenuStrip.cs
- ColumnMapCopier.cs
- ConditionalDesigner.cs
- UrlAuthorizationModule.cs
- DefaultBinder.cs
- DummyDataSource.cs
- SequentialUshortCollection.cs
- FramingChannels.cs
- SystemColorTracker.cs
- EntitySqlQueryCacheEntry.cs
- UITypeEditor.cs
- DbMetaDataCollectionNames.cs
- DiscreteKeyFrames.cs
- ExpressionBindingCollection.cs
- OracleBFile.cs
- RelationHandler.cs