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
- DriveInfo.cs
- controlskin.cs
- MetadataWorkspace.cs
- EventLogTraceListener.cs
- MenuItem.cs
- MatrixTransform3D.cs
- ActivityTypeResolver.xaml.cs
- InfoCardTrace.cs
- Context.cs
- MailSettingsSection.cs
- DayRenderEvent.cs
- TreeViewItemAutomationPeer.cs
- ConnectionProviderAttribute.cs
- UpdateEventArgs.cs
- ReachNamespaceInfo.cs
- WindowsEditBoxRange.cs
- WorkflowRuntimeBehavior.cs
- FormsIdentity.cs
- BrushMappingModeValidation.cs
- RefExpr.cs
- ConnectionInterfaceCollection.cs
- SqlConnectionPoolGroupProviderInfo.cs
- Registry.cs
- Drawing.cs
- TextRangeSerialization.cs
- SerializerWriterEventHandlers.cs
- SapiGrammar.cs
- UiaCoreApi.cs
- ImageEditor.cs
- QueryCursorEventArgs.cs
- DockPatternIdentifiers.cs
- XmlRawWriter.cs
- DesignerActionUIStateChangeEventArgs.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- PolyBezierSegmentFigureLogic.cs
- CheckBoxField.cs
- CookieHandler.cs
- ColorConverter.cs
- ResizeGrip.cs
- RegistrationProxy.cs
- SignatureHelper.cs
- PenCursorManager.cs
- ActivityXRefConverter.cs
- Renderer.cs
- Compress.cs
- XmlSerializationGeneratedCode.cs
- SelectionProviderWrapper.cs
- StaticSiteMapProvider.cs
- SqlMethodAttribute.cs
- DataDocumentXPathNavigator.cs
- ConnectivityStatus.cs
- EntityDataSourceChangingEventArgs.cs
- WebConfigurationManager.cs
- DeflateEmulationStream.cs
- SimpleBitVector32.cs
- VisualTreeHelper.cs
- VerificationException.cs
- ToolStripOverflow.cs
- EntityDataSourceDesignerHelper.cs
- SiteMapNodeItem.cs
- SeekStoryboard.cs
- BasicHttpSecurityElement.cs
- IImplicitResourceProvider.cs
- webbrowsersite.cs
- StrokeFIndices.cs
- Parameter.cs
- XmlNullResolver.cs
- ToolStripItemCollection.cs
- NamespaceImport.cs
- PolyBezierSegment.cs
- XamlToRtfWriter.cs
- TypedAsyncResult.cs
- SplashScreenNativeMethods.cs
- RectValueSerializer.cs
- TCPClient.cs
- WebPartConnectionsConfigureVerb.cs
- IndexOutOfRangeException.cs
- MediaContext.cs
- TextEditorThreadLocalStore.cs
- ZipIOLocalFileHeader.cs
- DesignerActionVerbList.cs
- PropertyCondition.cs
- _AuthenticationState.cs
- TextEffectResolver.cs
- ServiceAuthorizationManager.cs
- FontFamilyValueSerializer.cs
- EpmSourcePathSegment.cs
- RectangleF.cs
- DesigntimeLicenseContextSerializer.cs
- HttpCachePolicy.cs
- CodeIndexerExpression.cs
- DocumentReferenceCollection.cs
- SafeTimerHandle.cs
- TextElementCollection.cs
- SizeAnimationUsingKeyFrames.cs
- FixedSchema.cs
- SecurityTokenTypes.cs
- XsltContext.cs
- SectionInformation.cs
- SerializerWriterEventHandlers.cs