Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Tools / xws_reg / CommandArguments.cs / 3 / CommandArguments.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.Tools.ServiceModel { using System; using System.DirectoryServices; using System.Globalization; using System.ServiceModel.Install; internal class CommandArguments { bool applyToConfig; bool applyToScriptMaps; bool displayHelp; bool displayLogo; InstallAction installAction; bool installServices; OutputLevel outputLevel; bool recursive; bool requireConfirmation; bool runInstallScript; string scriptMapPath; bool updateScriptMaps; internal CommandArguments(string[] args) { bool installScriptMaps = false; bool removeScriptMaps = false; this.updateScriptMaps = false; this.recursive = false; this.scriptMapPath = null; this.displayHelp = false; this.displayLogo = true; this.requireConfirmation = true; this.outputLevel = OutputLevel.Normal; this.installAction = InstallAction.None; this.applyToConfig = false; this.applyToScriptMaps = false; this.runInstallScript = false; this.installServices = true; if (0 == args.Length) { this.displayHelp = true; return; } foreach (string arg in args) { if (arg.StartsWith("/", StringComparison.Ordinal) || arg.StartsWith("-", StringComparison.Ordinal)) { string key = arg.Substring(1); string value = null; int delim = key.IndexOf(':'); if (-1 != delim) { value = key.Substring(delim + 1); key = key.Substring(0, delim); } switch (key.ToLower(CultureInfo.CurrentCulture)) { case ("i"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Install; this.updateScriptMaps = false; this.applyToConfig = true; // Apply to script maps if not on an IIS7. this.applyToScriptMaps = !IisHelper.ShouldInstallWas; break; case ("ir"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Install; this.updateScriptMaps = false; this.applyToConfig = true; this.applyToScriptMaps = false; break; case ("iru"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Install; this.updateScriptMaps = false; this.applyToConfig = true; // Apply to script maps if not on an IIS7. this.applyToScriptMaps = !IisHelper.ShouldInstallWas; break; case ("u"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Uninstall; this.updateScriptMaps = true; this.recursive = true; this.applyToConfig = true; // Apply to script maps if not on an IIS7. this.applyToScriptMaps = !IisHelper.ShouldInstallWas; break; case ("ua"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Uninstall; this.updateScriptMaps = false; this.recursive = true; this.applyToConfig = true; // Apply to script maps if not on an IIS7. this.applyToScriptMaps = !IisHelper.ShouldInstallWas; break; case ("r"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Reinstall; this.updateScriptMaps = true; this.applyToConfig = true; // Apply to script maps if not on an IIS7. this.applyToScriptMaps = !IisHelper.ShouldInstallWas; break; case ("s"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Install; installScriptMaps = true; this.recursive = true; this.scriptMapPath = value; this.applyToConfig = false; this.applyToScriptMaps = true; break; case ("sn"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Install; installScriptMaps = true; this.recursive = false; this.scriptMapPath = value; this.applyToConfig = false; this.applyToScriptMaps = true; break; case ("k"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Uninstall; removeScriptMaps = true; this.recursive = true; this.scriptMapPath = value; this.applyToConfig = false; this.applyToScriptMaps = true; break; case ("kn"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.Uninstall; removeScriptMaps = true; this.recursive = false; this.scriptMapPath = value; this.applyToConfig = false; this.applyToScriptMaps = true; break; case ("lv"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.ListVersions; this.applyToConfig = true; // Apply to script maps if not on an IIS7. this.applyToScriptMaps = !IisHelper.ShouldInstallWas; this.recursive = true; break; case ("lk"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.ListScriptMaps; this.applyToConfig = false; this.applyToScriptMaps = true; this.recursive = true; break; case ("vi"): if (InstallAction.None != this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOptionError)); } this.installAction = InstallAction.VerifyInstall; this.applyToConfig = true; // Apply to script maps if not on an IIS7. this.applyToScriptMaps = !IisHelper.ShouldInstallWas; break; case("x"): this.runInstallScript = true; break; case ("q"): if (OutputLevel.Normal != this.outputLevel && OutputLevel.Quiet != this.outputLevel) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOutputError)); } this.outputLevel = OutputLevel.Quiet; break; case ("v"): if (OutputLevel.Normal != this.outputLevel && OutputLevel.Verbose != this.outputLevel) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegExclusiveOutputError)); } this.outputLevel = OutputLevel.Verbose; break; case ("y"): this.requireConfirmation = false; break; case ("nologo"): this.displayLogo = false; break; case ("noservices"): this.installServices = false; break; case ("?"): case ("h"): case ("help"): this.displayHelp = true; return; default: throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegUnknownOptionError, key)); } } else { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegUnknownOptionError, arg)); } } if (InstallAction.None == this.installAction) { throw new ApplicationException(SR2.GetString(SR2.ServiceModelRegNoOptionsError)); } if (installScriptMaps || removeScriptMaps) { // If IIS is not installed, let error bubble through. IIS installation will be checked // and handled properly at a later time. if (IisHelper.ShouldInstallIis || IisHelper.ShouldInstallWas) { if (null == this.scriptMapPath) { throw new NullReferenceException(SR2.GetString(SR2.ServiceModelRegNullScriptMapPath)); } } } } internal bool ApplyToConfig { get {return applyToConfig; } } internal bool ApplyToScriptMaps { get {return applyToScriptMaps; } } internal bool DisplayHelp { get {return this.displayHelp; } } internal bool DisplayLogo { get {return this.displayLogo; } } internal InstallAction InstallAction { get {return this.installAction; } } internal bool InstallServices { get {return this.installServices; } } internal OutputLevel OutputLevel { get {return this.outputLevel; } } internal bool Recursive { get {return this.recursive; } } internal bool RequireConfirmation { get {return this.requireConfirmation; } } internal bool RunInstallScript { get { return this.runInstallScript; } } internal string ScriptMapPath { get {return this.scriptMapPath; } } internal bool UpdateScriptMaps { get {return this.updateScriptMaps; } } internal static void DisplayUsage() { Console.WriteLine(SR2.GetString(SR2.HelpDescription)); // ThisAssembly conflicts with one imported from System.ServiceModel.Install.dll (friend assembly) // build uses the correct one (local)... #pragma warning disable 436 Console.WriteLine(SR2.GetString(SR2.HelpUsage, ThisAssembly.Title)); #pragma warning restore 436 Console.WriteLine(SR2.GetString(SR2.HelpInstall, "-i")); Console.WriteLine(SR2.GetString(SR2.HelpInstallRegister, "-ir")); Console.WriteLine(SR2.GetString(SR2.HelpInstallNoUpdate, "-iru")); Console.WriteLine(SR2.GetString(SR2.HelpUninstall, "-u")); Console.WriteLine(SR2.GetString(SR2.HelpUninstallAll, "-ua")); Console.WriteLine(SR2.GetString(SR2.HelpReinstall, "-r")); Console.WriteLine(SR2.GetString(SR2.HelpInstallRunWCFInstaller, "-x")); Console.WriteLine(SR2.GetString(SR2.HelpInstallScriptMapsRecursively, "-s")); Console.WriteLine(SR2.GetString(SR2.HelpInstallScriptMapsNonRecursively, "-sn")); Console.WriteLine(SR2.GetString(SR2.HelpRemoveScriptMapsRecursively, "-k")); Console.WriteLine(SR2.GetString(SR2.HelpRemoveScriptMapsNonRecursively, "-kn")); Console.WriteLine(SR2.GetString(SR2.HelpListVersions, "-lv")); Console.WriteLine(SR2.GetString(SR2.HelpListScriptMaps, "-lk")); Console.WriteLine(SR2.GetString(SR2.HelpVerify, "-vi")); Console.WriteLine(SR2.GetString(SR2.HelpConfirmation, "-y")); Console.WriteLine(SR2.GetString(SR2.HelpQuiet, "-q")); Console.WriteLine(SR2.GetString(SR2.HelpVerbose, "-v")); Console.WriteLine(SR2.GetString(SR2.HelpNoLogo, "-nologo")); Console.WriteLine(SR2.GetString(SR2.HelpDisplayHelp, "-?")); } } } // 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
- Int32Rect.cs
- Int16Converter.cs
- Bits.cs
- PathBox.cs
- XsdCachingReader.cs
- PackageFilter.cs
- DecoderReplacementFallback.cs
- GridViewActionList.cs
- ColumnMapCopier.cs
- InternalConfigSettingsFactory.cs
- InvokeMethodActivityDesigner.cs
- HttpListenerRequestUriBuilder.cs
- InternalConfigEventArgs.cs
- ProfileModule.cs
- XMLUtil.cs
- TypeLibConverter.cs
- ConfigXmlAttribute.cs
- TextElement.cs
- UIElementAutomationPeer.cs
- GenericTypeParameterBuilder.cs
- ConnectionPoolRegistry.cs
- KeyConstraint.cs
- WebPartPersonalization.cs
- TreeIterators.cs
- TransformerInfo.cs
- ConnectionStringsExpressionBuilder.cs
- RichTextBox.cs
- BuildProvidersCompiler.cs
- EncodingInfo.cs
- WizardSideBarListControlItemEventArgs.cs
- CaseInsensitiveComparer.cs
- RpcCryptoRequest.cs
- DefaultTextStore.cs
- ListItemCollection.cs
- PixelShader.cs
- XmlSchemaAnyAttribute.cs
- Property.cs
- UpdateProgress.cs
- XmlSchemaAnnotation.cs
- ItemCollection.cs
- QueuePathEditor.cs
- NameValueSectionHandler.cs
- InstanceHandle.cs
- messageonlyhwndwrapper.cs
- BinaryQueryOperator.cs
- EmptyEnumerable.cs
- TextCharacters.cs
- ToolStripCustomTypeDescriptor.cs
- CustomAssemblyResolver.cs
- DelegateOutArgument.cs
- StorageTypeMapping.cs
- GlyphManager.cs
- IntellisenseTextBox.cs
- CustomAttributeBuilder.cs
- CornerRadius.cs
- DecimalKeyFrameCollection.cs
- EditableRegion.cs
- SelectionProviderWrapper.cs
- Substitution.cs
- MouseGesture.cs
- BindingCollection.cs
- FormView.cs
- List.cs
- ErrorHandler.cs
- ConstructorBuilder.cs
- ExclusiveCanonicalizationTransform.cs
- ResourceWriter.cs
- TreeViewEvent.cs
- CharacterBufferReference.cs
- ResXResourceSet.cs
- ImportContext.cs
- TypeGenericEnumerableViewSchema.cs
- infer.cs
- ContentWrapperAttribute.cs
- MappingItemCollection.cs
- XmlSignatureProperties.cs
- InputBindingCollection.cs
- WindowsListViewGroup.cs
- BinaryWriter.cs
- BamlRecordHelper.cs
- InstanceDataCollection.cs
- SqlDataSourceView.cs
- MatcherBuilder.cs
- UserControl.cs
- StructureChangedEventArgs.cs
- MenuItem.cs
- BaseTreeIterator.cs
- SymDocumentType.cs
- CssClassPropertyAttribute.cs
- ImageAttributes.cs
- DescendantQuery.cs
- PointLightBase.cs
- MediaPlayer.cs
- AxisAngleRotation3D.cs
- LocalizedNameDescriptionPair.cs
- SpinWait.cs
- XmlElementAttributes.cs
- Journal.cs
- LeaseManager.cs
- BrowserCapabilitiesFactory.cs