Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Tools / xws_reg / System / ServiceModel / Install / Configuration / BuildProviderInstallComponent.cs / 1 / BuildProviderInstallComponent.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Install.Configuration
{
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Web.Configuration;
using System.Xml;
internal class BuildProviderInstallComponent : ServiceModelInstallComponent
{
ConfigurationLoader configLoader;
string displayString;
BuildProviderInstallComponent(ConfigurationLoader configLoader)
{
this.configLoader = configLoader;
}
internal override string DisplayName
{
get {return this.displayString; }
}
protected override string InstallActionMessage
{
get {return SR.GetString(SR.BuildProviderInstall, ServiceModelInstallStrings.BuildProvidersType); }
}
internal override string[] InstalledVersions
{
get
{
List installedVersions = new List();
if (null != configLoader.SystemWebSectionGroup)
{
foreach (string buildProviderExtension in ServiceModelInstallStrings.BuildProviderExtensionValues)
{
BuildProvider buildProvider = configLoader.SystemWebSectionGroup.Compilation.BuildProviders[buildProviderExtension];
if (null != buildProvider)
{
string versionString = InstallHelper.GetVersionStringFromTypeString(buildProvider.Type);
if (!String.IsNullOrEmpty(versionString))
{
installedVersions.Add(versionString);
}
}
}
}
return installedVersions.ToArray();
}
}
internal override bool IsInstalled
{
get
{
if (null != configLoader.SystemWebSectionGroup)
{
foreach (string buildProviderExtension in ServiceModelInstallStrings.BuildProviderExtensionValues)
{
BuildProvider buildProvider = configLoader.SystemWebSectionGroup.Compilation.BuildProviders[buildProviderExtension];
if (null != buildProvider)
{
return true;
}
}
}
return false;
}
}
protected override string ReinstallActionMessage
{
get {return SR.GetString(SR.BuildProviderInstall, ServiceModelInstallStrings.BuildProvidersType); }
}
protected override string UninstallActionMessage
{
get {return SR.GetString(SR.BuildProviderUninstall, ServiceModelInstallStrings.BuildProvidersType); }
}
internal static BuildProviderInstallComponent CreateNativeBuildProviderInstallComponent()
{
BuildProviderInstallComponent buildProvider = new BuildProviderInstallComponent(new NativeConfigurationLoader());
buildProvider.displayString = SR.GetString(SR.BuildProviderName);
return buildProvider;
}
internal static BuildProviderInstallComponent CreateWow64BuildProviderInstallComponent()
{
if (!InstallHelper.Is64BitMachine() || String.IsNullOrEmpty(InstallHelper.Wow64WebConfigFileName))
{
throw new InvalidOperationException(SR.GetString(SR.Wow64NotInstalled));
}
BuildProviderInstallComponent buildProvider = new BuildProviderInstallComponent(new Wow64ConfigurationLoader());
buildProvider.displayString = SR.GetString(SR.BuildProviderNameWow64);
return buildProvider;
}
internal override void Install(OutputLevel outputLevel)
{
if (!this.IsInstalled)
{
if (null != configLoader.SystemWebSectionGroup)
{
foreach (string extensionValue in ServiceModelInstallStrings.BuildProviderExtensionValues)
{
BuildProvider buildProvider = new BuildProvider(extensionValue, ServiceModelInstallStrings.BuildProvidersType);
configLoader.SystemWebSectionGroup.Compilation.BuildProviders.Add(buildProvider);
configLoader.Save();
}
}
else
{
throw new InvalidOperationException(SR.GetString(SR.ConfigurationSectionNotInstalled,
configLoader.SystemWebSectionGroupPath,
configLoader.RootWebConfigurationFilePath));
}
}
else
{
EventLogger.LogWarning(SR.GetString(SR.BuildProviderAlreadyExists, ServiceModelInstallStrings.BuildProvidersType), (OutputLevel.Verbose == outputLevel));
}
}
internal override void Uninstall(OutputLevel outputLevel)
{
if (this.IsInstalled)
{
// Now, remove the other nodes
foreach (string extensionValue in ServiceModelInstallStrings.BuildProviderExtensionValues)
{
configLoader.SystemWebSectionGroup.Compilation.BuildProviders.Remove(extensionValue);
configLoader.Save();
}
}
else
{
EventLogger.LogWarning(SR.GetString(SR.BuildProviderNotInstalled, ServiceModelInstallStrings.BuildProvidersType), (OutputLevel.Verbose == outputLevel));
}
}
internal override InstallationState VerifyInstall()
{
InstallationState installState = InstallationState.Unknown;
if (this.IsInstalled)
{
if (null != configLoader.SystemWebSectionGroup)
{
foreach (string extensionValue in ServiceModelInstallStrings.BuildProviderExtensionValues)
{
BuildProvider buildProvider = new BuildProvider(extensionValue, ServiceModelInstallStrings.BuildProvidersType);
BuildProvider installedBuildProvider = configLoader.SystemWebSectionGroup.Compilation.BuildProviders[extensionValue];
if (installedBuildProvider.Equals(buildProvider))
{
installState = InstallationState.InstalledDefaults;
}
else
{
installState = InstallationState.InstalledCustom;
break;
}
}
}
}
else
{
installState = InstallationState.NotInstalled;
}
return installState;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SafeRegistryHandle.cs
- AppDomainShutdownMonitor.cs
- AddInIpcChannel.cs
- ControlDesigner.cs
- HealthMonitoringSectionHelper.cs
- MetadataSource.cs
- ImageSourceValueSerializer.cs
- Geometry3D.cs
- TypefaceMap.cs
- Misc.cs
- FontUnitConverter.cs
- basevalidator.cs
- ListenDesigner.cs
- HttpFileCollectionBase.cs
- TreeNodeClickEventArgs.cs
- Style.cs
- RoleManagerSection.cs
- GAC.cs
- FontFamilyConverter.cs
- ActiveXHost.cs
- ISFClipboardData.cs
- FixedSOMPageElement.cs
- PasswordDeriveBytes.cs
- ConnectionConsumerAttribute.cs
- OdbcCommand.cs
- PanelStyle.cs
- IResourceProvider.cs
- EmptyEnumerator.cs
- ComponentCollection.cs
- LiteralDesigner.cs
- SelectionProcessor.cs
- TopClause.cs
- DataGridViewTopRowAccessibleObject.cs
- EventNotify.cs
- DataSourceExpressionCollection.cs
- RecognizerBase.cs
- DataGridViewHitTestInfo.cs
- TextTrailingWordEllipsis.cs
- TextBounds.cs
- EpmTargetTree.cs
- PasswordBoxAutomationPeer.cs
- XmlSecureResolver.cs
- StylusPointPropertyInfo.cs
- ProviderConnectionPoint.cs
- WebColorConverter.cs
- AudioBase.cs
- _UriTypeConverter.cs
- EventToken.cs
- Win32.cs
- XmlDataProvider.cs
- CacheOutputQuery.cs
- XmlNodeReader.cs
- ClusterUtils.cs
- EpmSyndicationContentSerializer.cs
- DefinitionBase.cs
- CqlQuery.cs
- ExeConfigurationFileMap.cs
- SafeLibraryHandle.cs
- DesignerTransactionCloseEvent.cs
- ResourceAttributes.cs
- CachingHintValidation.cs
- DelayedRegex.cs
- GroupJoinQueryOperator.cs
- ILGenerator.cs
- TransactedBatchingElement.cs
- Convert.cs
- SocketInformation.cs
- ListBoxDesigner.cs
- SingleBodyParameterMessageFormatter.cs
- TextRangeSerialization.cs
- DataRecordObjectView.cs
- SettingsAttributes.cs
- EDesignUtil.cs
- TreeViewHitTestInfo.cs
- IImplicitResourceProvider.cs
- FamilyTypeface.cs
- PackagePartCollection.cs
- String.cs
- TransformerTypeCollection.cs
- If.cs
- StickyNote.cs
- WebReferenceOptions.cs
- ExpressionConverter.cs
- TextDecoration.cs
- FontWeights.cs
- DataControlPagerLinkButton.cs
- TextRunTypographyProperties.cs
- SoapAttributeOverrides.cs
- ByteStorage.cs
- ChangeInterceptorAttribute.cs
- Compensate.cs
- DocumentXmlWriter.cs
- DataTableMappingCollection.cs
- DataGridViewTextBoxColumn.cs
- ContentValidator.cs
- TextStore.cs
- DiffuseMaterial.cs
- TreeNodeEventArgs.cs
- XmlSchemaAnnotated.cs
- DialogResultConverter.cs