Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / FeatureSupport.cs / 1305376 / 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
- DataGridTableCollection.cs
- TextInfo.cs
- InlineCollection.cs
- CommandBindingCollection.cs
- MenuItemBinding.cs
- ReflectionTypeLoadException.cs
- SchemaTableColumn.cs
- DocumentOrderComparer.cs
- BitmapEffectCollection.cs
- AppDomainCompilerProxy.cs
- sqlstateclientmanager.cs
- UserPreferenceChangingEventArgs.cs
- InheritanceAttribute.cs
- TemplateXamlParser.cs
- BevelBitmapEffect.cs
- CollectionBuilder.cs
- IgnorePropertiesAttribute.cs
- Flowchart.cs
- XmlDataSource.cs
- PrivateFontCollection.cs
- SQLByteStorage.cs
- DeclarationUpdate.cs
- BrowserDefinition.cs
- EntityModelBuildProvider.cs
- CopyOnWriteList.cs
- Operator.cs
- DebugController.cs
- LazyTextWriterCreator.cs
- AtomMaterializerLog.cs
- CodeDirectoryCompiler.cs
- OracleEncoding.cs
- CreateDataSourceDialog.cs
- wmiprovider.cs
- WebPartDisplayModeEventArgs.cs
- DoubleLinkListEnumerator.cs
- DataGridViewCellConverter.cs
- RtfToken.cs
- MissingMemberException.cs
- SystemFonts.cs
- PointHitTestParameters.cs
- ListViewPagedDataSource.cs
- ChtmlTextWriter.cs
- GenericTypeParameterBuilder.cs
- NativeMethodsCLR.cs
- HashCryptoHandle.cs
- SymmetricAlgorithm.cs
- CaseExpr.cs
- GlyphsSerializer.cs
- CharConverter.cs
- IDictionary.cs
- RightsManagementEncryptionTransform.cs
- JulianCalendar.cs
- CompoundFileStreamReference.cs
- CapabilitiesPattern.cs
- Trustee.cs
- RequestCachePolicyConverter.cs
- ListSortDescriptionCollection.cs
- InnerItemCollectionView.cs
- unsafeIndexingFilterStream.cs
- ResXFileRef.cs
- ManageRequest.cs
- SoapObjectReader.cs
- CompilerError.cs
- SkinBuilder.cs
- securitymgrsite.cs
- TransactionsSectionGroup.cs
- CodeTryCatchFinallyStatement.cs
- SqlStream.cs
- SqlMetaData.cs
- DetailsViewInsertEventArgs.cs
- OleDbSchemaGuid.cs
- WarningException.cs
- _Events.cs
- AvTraceDetails.cs
- XmlProcessingInstruction.cs
- DbParameterHelper.cs
- TaiwanLunisolarCalendar.cs
- DataGridViewMethods.cs
- AppDomainManager.cs
- XmlTextWriter.cs
- ActivityExecutorOperation.cs
- PropertyItem.cs
- SEHException.cs
- NamedPipeProcessProtocolHandler.cs
- _SpnDictionary.cs
- StringAnimationBase.cs
- BCryptNative.cs
- LinqTreeNodeEvaluator.cs
- HandlerBase.cs
- HttpResponseHeader.cs
- TemplateControlCodeDomTreeGenerator.cs
- dbdatarecord.cs
- OdbcReferenceCollection.cs
- RuleConditionDialog.cs
- LocalizabilityAttribute.cs
- CodeMemberMethod.cs
- ValidationUtility.cs
- PropertyKey.cs
- DrawingState.cs
- LogFlushAsyncResult.cs