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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- configsystem.cs
- xamlnodes.cs
- BuiltInExpr.cs
- MobileControl.cs
- TraceSection.cs
- CompletedAsyncResult.cs
- __TransparentProxy.cs
- CatalogPartChrome.cs
- FontInfo.cs
- CodeDomConfigurationHandler.cs
- NamespaceQuery.cs
- SupportingTokenListenerFactory.cs
- DropDownHolder.cs
- ContentHostHelper.cs
- EarlyBoundInfo.cs
- ParameterCollectionEditor.cs
- XmlExceptionHelper.cs
- ProviderUtil.cs
- MessageSmuggler.cs
- ResourcePool.cs
- TreeBuilderXamlTranslator.cs
- SystemIcmpV6Statistics.cs
- CallTemplateAction.cs
- CapabilitiesPattern.cs
- ExceptionHelpers.cs
- Rfc2898DeriveBytes.cs
- TextElementEnumerator.cs
- InheritedPropertyDescriptor.cs
- ProfileService.cs
- RSAOAEPKeyExchangeDeformatter.cs
- FlowDocument.cs
- DiagnosticsConfiguration.cs
- OutOfProcStateClientManager.cs
- SynchronizedDisposablePool.cs
- AsymmetricKeyExchangeDeformatter.cs
- MultiPageTextView.cs
- SchemaCollectionCompiler.cs
- TraceSource.cs
- StrongNameSignatureInformation.cs
- ObjectContext.cs
- CompositeCollectionView.cs
- GrammarBuilderPhrase.cs
- WindowsListViewGroupHelper.cs
- ParameterEditorUserControl.cs
- ResourcePool.cs
- Size3D.cs
- ObjectConverter.cs
- AttachedPropertyBrowsableAttribute.cs
- WebControl.cs
- EntityViewContainer.cs
- OleDbErrorCollection.cs
- ContainsRowNumberChecker.cs
- SystemUdpStatistics.cs
- BadImageFormatException.cs
- CursorInteropHelper.cs
- CultureMapper.cs
- SystemFonts.cs
- RequestReplyCorrelator.cs
- ExpressionContext.cs
- Conditional.cs
- InkSerializer.cs
- ValidatingReaderNodeData.cs
- LocalizationComments.cs
- QueueProcessor.cs
- MsmqIntegrationInputChannel.cs
- SaveFileDialog.cs
- TextControl.cs
- MulticastNotSupportedException.cs
- DebugHandleTracker.cs
- BaseDataList.cs
- DecimalAnimationUsingKeyFrames.cs
- DataGridTextBox.cs
- EventBuilder.cs
- Root.cs
- ToolTip.cs
- MaterialGroup.cs
- ProvidersHelper.cs
- WebPartCancelEventArgs.cs
- CodeGotoStatement.cs
- ConfigXmlText.cs
- StringExpressionSet.cs
- SupportingTokenParameters.cs
- DesignerRegionMouseEventArgs.cs
- ViewCellRelation.cs
- SqlTopReducer.cs
- EnumValidator.cs
- XmlQualifiedName.cs
- SecurityPolicySection.cs
- ClientBuildManagerCallback.cs
- SecurityTokenException.cs
- ProviderManager.cs
- SoapExtensionImporter.cs
- VisualCollection.cs
- ExtensionWindowHeader.cs
- DataControlFieldTypeEditor.cs
- MsmqHostedTransportManager.cs
- XmlSerializerImportOptions.cs
- ListViewItem.cs
- CompilerGlobalScopeAttribute.cs
- ColumnWidthChangingEvent.cs