Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- TrackingDataItemValue.cs
- PathFigure.cs
- OracleRowUpdatingEventArgs.cs
- InstanceData.cs
- DocumentSchemaValidator.cs
- CompilerTypeWithParams.cs
- GeneralTransform2DTo3DTo2D.cs
- MobileCategoryAttribute.cs
- InvalidateEvent.cs
- Wizard.cs
- _UncName.cs
- SqlGenericUtil.cs
- CellLabel.cs
- PenContext.cs
- PerformanceCounters.cs
- PackWebRequestFactory.cs
- CacheOutputQuery.cs
- BulletChrome.cs
- Panel.cs
- MemoryMappedViewAccessor.cs
- CriticalExceptions.cs
- WebUtil.cs
- BitmapSource.cs
- StateManagedCollection.cs
- WindowsPen.cs
- AxHost.cs
- ApplicationException.cs
- TypeForwardedToAttribute.cs
- AsnEncodedData.cs
- OutputCacheEntry.cs
- DataControlCommands.cs
- FaultDesigner.cs
- SqlCacheDependencyDatabase.cs
- AttachedPropertyInfo.cs
- ZipIOCentralDirectoryBlock.cs
- DbParameterCollectionHelper.cs
- CookieHandler.cs
- ResourcePart.cs
- SimpleFieldTemplateFactory.cs
- DataGridCell.cs
- CompilerCollection.cs
- Highlights.cs
- FrameDimension.cs
- AnimationException.cs
- SqlFormatter.cs
- TaskFactory.cs
- MeasureData.cs
- XPathParser.cs
- PipelineDeploymentState.cs
- DataMisalignedException.cs
- DateTimeValueSerializer.cs
- RegexCompilationInfo.cs
- _ConnectOverlappedAsyncResult.cs
- InvalidateEvent.cs
- ChildTable.cs
- XmlSchemaSimpleContentRestriction.cs
- TagPrefixInfo.cs
- ExceptionHelpers.cs
- Hash.cs
- SafeReversePInvokeHandle.cs
- UmAlQuraCalendar.cs
- templategroup.cs
- SizeF.cs
- DesignerTextWriter.cs
- XmlSignatureProperties.cs
- HtmlControl.cs
- LinkDescriptor.cs
- InternalBase.cs
- MetadataArtifactLoaderCompositeFile.cs
- ZoneButton.cs
- SecurityTokenAuthenticator.cs
- ConstantExpression.cs
- ModelVisual3D.cs
- InternalMappingException.cs
- MonthCalendar.cs
- TargetPerspective.cs
- IdentityNotMappedException.cs
- Slider.cs
- XmlUTF8TextReader.cs
- ImageDrawing.cs
- ClientSponsor.cs
- NativeMethods.cs
- NGCPageContentCollectionSerializerAsync.cs
- DrawingDrawingContext.cs
- PropertyGrid.cs
- Command.cs
- DbConnectionPoolGroup.cs
- Stylesheet.cs
- HtmlElementErrorEventArgs.cs
- GcSettings.cs
- ComponentManagerBroker.cs
- DataGridViewComboBoxColumn.cs
- GridViewHeaderRowPresenter.cs
- DataListAutoFormat.cs
- OpenFileDialog.cs
- NamedPipeHostedTransportConfiguration.cs
- XMLSyntaxException.cs
- UpdatePanelTrigger.cs
- ToolBarButtonClickEvent.cs
- GuidTagList.cs