Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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. // Copyright (c) Microsoft Corporation. All rights reserved.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
- FullTextState.cs
- BrowserTree.cs
- XmlSubtreeReader.cs
- DataGridRow.cs
- DataColumnCollection.cs
- SafeCertificateContext.cs
- TreeNodeStyle.cs
- ColumnWidthChangedEvent.cs
- SmtpNtlmAuthenticationModule.cs
- DropDownButton.cs
- DynamicMethod.cs
- ServiceDefaults.cs
- Table.cs
- GridViewPageEventArgs.cs
- ContentElement.cs
- ContainerCodeDomSerializer.cs
- _AuthenticationState.cs
- SchemaMapping.cs
- AnimatedTypeHelpers.cs
- FileLogRecord.cs
- FtpWebRequest.cs
- StorageRoot.cs
- SiteOfOriginPart.cs
- CommandExpr.cs
- DatePicker.cs
- TextTreeUndoUnit.cs
- Certificate.cs
- MissingManifestResourceException.cs
- ListControl.cs
- RegexMatchCollection.cs
- SectionVisual.cs
- XsltQilFactory.cs
- CFStream.cs
- Trace.cs
- FocusTracker.cs
- addressfiltermode.cs
- ObjectToken.cs
- BitmapFrameEncode.cs
- UDPClient.cs
- IntSecurity.cs
- VirtualizingStackPanel.cs
- DataObject.cs
- TextSpanModifier.cs
- UmAlQuraCalendar.cs
- WebPartDisplayModeEventArgs.cs
- WindowsEditBox.cs
- InputLanguageManager.cs
- newinstructionaction.cs
- CngUIPolicy.cs
- LocalizabilityAttribute.cs
- Region.cs
- SrgsDocument.cs
- PromptEventArgs.cs
- SharedPerformanceCounter.cs
- SecurityStandardsManager.cs
- MenuBase.cs
- SqlClientWrapperSmiStreamChars.cs
- XmlEncodedRawTextWriter.cs
- GridToolTip.cs
- DupHandleConnectionReader.cs
- SafeFileMapViewHandle.cs
- SafeSecurityHandles.cs
- PropertyGridView.cs
- QilDataSource.cs
- ObjectSet.cs
- SchemaImporterExtensionElementCollection.cs
- DaylightTime.cs
- NetStream.cs
- SqlCacheDependencyDatabaseCollection.cs
- ClientRolePrincipal.cs
- ReceiveSecurityHeader.cs
- SafePEFileHandle.cs
- TemplateManager.cs
- Rotation3DAnimationUsingKeyFrames.cs
- CaretElement.cs
- TextTreeTextElementNode.cs
- SliderAutomationPeer.cs
- NavigationProgressEventArgs.cs
- EnumValidator.cs
- PageCodeDomTreeGenerator.cs
- OleDbError.cs
- MatrixTransform.cs
- TextSchema.cs
- PropertyGridEditorPart.cs
- ServerIdentity.cs
- LogWriteRestartAreaAsyncResult.cs
- GCHandleCookieTable.cs
- DynamicResourceExtension.cs
- BamlRecordWriter.cs
- DocumentReference.cs
- TextEditorParagraphs.cs
- XmlSchemaExporter.cs
- RichTextBox.cs
- EventWaitHandleSecurity.cs
- WmpBitmapEncoder.cs
- ApplicationFileCodeDomTreeGenerator.cs
- MarshalByValueComponent.cs
- RegistryExceptionHelper.cs
- BadImageFormatException.cs
- CodeNamespaceImport.cs