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
- SimpleMailWebEventProvider.cs
- ColumnResizeUndoUnit.cs
- SpeechEvent.cs
- IncrementalHitTester.cs
- UInt16Storage.cs
- TextElement.cs
- QueueProcessor.cs
- Track.cs
- ConfigurationSettings.cs
- ManagedFilter.cs
- ValidatorCompatibilityHelper.cs
- XmlProcessingInstruction.cs
- ArrayWithOffset.cs
- _FtpDataStream.cs
- XhtmlBasicLinkAdapter.cs
- SqlWriter.cs
- LogStream.cs
- FormsAuthenticationConfiguration.cs
- EncryptedPackageFilter.cs
- SpecularMaterial.cs
- ImagingCache.cs
- WebPageTraceListener.cs
- TypeUnloadedException.cs
- ExclusiveNamedPipeTransportManager.cs
- SamlAction.cs
- EncryptedData.cs
- PatternMatcher.cs
- BuildManagerHost.cs
- OptimizedTemplateContentHelper.cs
- CredentialCache.cs
- SqlCrossApplyToCrossJoin.cs
- ApplicationServiceManager.cs
- IUnknownConstantAttribute.cs
- EmbeddedMailObjectCollectionEditor.cs
- ToolStripDropDownMenu.cs
- AdapterUtil.cs
- MenuItemStyle.cs
- DataPager.cs
- HyperLinkDesigner.cs
- GroupBox.cs
- ReadOnlyAttribute.cs
- PointHitTestParameters.cs
- Image.cs
- Part.cs
- NegotiationTokenAuthenticatorStateCache.cs
- AnnouncementSendsAsyncResult.cs
- TextReader.cs
- ConnectionStringsExpressionBuilder.cs
- StandardCommands.cs
- GeneralTransform3DTo2DTo3D.cs
- RSAOAEPKeyExchangeDeformatter.cs
- Underline.cs
- Convert.cs
- ResourceSetExpression.cs
- xdrvalidator.cs
- MimeMapping.cs
- XmlSerializerSection.cs
- DefaultHttpHandler.cs
- GroupBox.cs
- TypeBuilder.cs
- ConstantCheck.cs
- XmlEnumAttribute.cs
- ResetableIterator.cs
- TypefaceCollection.cs
- X509Chain.cs
- AudioFileOut.cs
- ThumbAutomationPeer.cs
- WebPartConnectionsCloseVerb.cs
- SHA512Managed.cs
- EntityDataSourceQueryBuilder.cs
- UnsafeCollabNativeMethods.cs
- FlowDocumentReader.cs
- InternalConfigConfigurationFactory.cs
- ProgressBarAutomationPeer.cs
- RequestCacheValidator.cs
- Debug.cs
- ResourceSetExpression.cs
- GZipDecoder.cs
- AuthenticationSection.cs
- DataContract.cs
- SqlClientWrapperSmiStreamChars.cs
- ApplicationException.cs
- PathGradientBrush.cs
- ExtenderProviderService.cs
- MetadataReference.cs
- OrderByQueryOptionExpression.cs
- SpotLight.cs
- TemplateNodeContextMenu.cs
- FrugalList.cs
- SmtpFailedRecipientsException.cs
- TailPinnedEventArgs.cs
- TokenFactoryBase.cs
- SqlGenericUtil.cs
- HyperlinkAutomationPeer.cs
- SettingsSection.cs
- HtmlHistory.cs
- LazyTextWriterCreator.cs
- TypeLoader.cs
- FontStretch.cs
- UshortList2.cs