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
- ByteRangeDownloader.cs
- DataReceivedEventArgs.cs
- CatalogPartChrome.cs
- TransportDefaults.cs
- UnconditionalPolicy.cs
- KeyedCollection.cs
- PersonalizationProvider.cs
- DetailsViewUpdateEventArgs.cs
- SiteMapNodeItemEventArgs.cs
- XmlSchemaSimpleContentRestriction.cs
- DictionaryEntry.cs
- HttpCookiesSection.cs
- DetailsViewPageEventArgs.cs
- IsolatedStorageSecurityState.cs
- CriticalHandle.cs
- DbDataAdapter.cs
- KeyboardDevice.cs
- ProfileModule.cs
- ValueProviderWrapper.cs
- ActivityTypeResolver.xaml.cs
- QueryOptionExpression.cs
- SafeNativeMethods.cs
- PopupEventArgs.cs
- Vector3DCollectionConverter.cs
- InstanceData.cs
- SamlConditions.cs
- TablePatternIdentifiers.cs
- LocatorBase.cs
- PeerNameRecordCollection.cs
- BrowserCapabilitiesCompiler.cs
- DoubleLinkList.cs
- TextBlockAutomationPeer.cs
- QilReference.cs
- DbConnectionPoolGroupProviderInfo.cs
- MarginCollapsingState.cs
- List.cs
- PropertyFilter.cs
- ArgumentOutOfRangeException.cs
- HtmlInputImage.cs
- CutCopyPasteHelper.cs
- ToolStripContainer.cs
- DefinitionBase.cs
- HttpConfigurationContext.cs
- SerializationException.cs
- GridViewColumn.cs
- TextBlock.cs
- EventSetter.cs
- TraversalRequest.cs
- NamedObject.cs
- Compiler.cs
- ServiceModelSectionGroup.cs
- AVElementHelper.cs
- LinkArea.cs
- PrimarySelectionAdorner.cs
- ProtocolElement.cs
- ManagedCodeMarkers.cs
- XmlSchemaDocumentation.cs
- ThemeDirectoryCompiler.cs
- PrimarySelectionGlyph.cs
- WebResourceAttribute.cs
- ToolStripContentPanelRenderEventArgs.cs
- AuthenticationModulesSection.cs
- WeakHashtable.cs
- TabRenderer.cs
- WSHttpBindingBase.cs
- MouseBinding.cs
- TypeDelegator.cs
- ReceiveParametersContent.cs
- SettingsSavedEventArgs.cs
- IDispatchConstantAttribute.cs
- Label.cs
- UIElement3DAutomationPeer.cs
- TransformerConfigurationWizardBase.cs
- PreviewKeyDownEventArgs.cs
- ToolStripPanelRow.cs
- QilStrConcatenator.cs
- OracleEncoding.cs
- ProviderSettings.cs
- EdmProperty.cs
- ZeroOpNode.cs
- MethodBuilder.cs
- DragDropHelper.cs
- CodeExpressionCollection.cs
- ImmutableAssemblyCacheEntry.cs
- DisplayInformation.cs
- WebPartMinimizeVerb.cs
- Matrix3DConverter.cs
- RectangleF.cs
- FtpWebRequest.cs
- recordstatefactory.cs
- Contracts.cs
- _Semaphore.cs
- DefaultValidator.cs
- SimpleHandlerFactory.cs
- SQLBytes.cs
- TextFormatter.cs
- StreamingContext.cs
- ConstantCheck.cs
- PageParser.cs
- OlePropertyStructs.cs