private static void LoadOperationArguments(OperationArguments operationArguments)
        {
            Debug.Assert(operationArguments != null, "The operationsArguments parameter is null.");

            Trace.WriteLine("Program::LoadOperationArguments");

            Configuration config = new Configuration();
            Configuration.Entry entry;

            if (config.TryGetEntry(ConfigPrefix, operationArguments.TargetUri, ConfigAuthortyKey, out entry))
            {
                Trace.WriteLine("   " + ConfigAuthortyKey + " = " + entry.Value);

                if (String.Equals(entry.Value, "MSA", StringComparison.OrdinalIgnoreCase)
                    || String.Equals(entry.Value, "Microsoft", StringComparison.OrdinalIgnoreCase)
                    || String.Equals(entry.Value, "MicrosoftAccount", StringComparison.OrdinalIgnoreCase)
                    || String.Equals(entry.Value, "Live", StringComparison.OrdinalIgnoreCase)
                    || String.Equals(entry.Value, "LiveConnect", StringComparison.OrdinalIgnoreCase)
                    || String.Equals(entry.Value, "LiveID", StringComparison.OrdinalIgnoreCase))
                {
                    operationArguments.Authority = AuthorityType.MicrosoftAccount;
                }
                else if (String.Equals(entry.Value, "AAD", StringComparison.OrdinalIgnoreCase)
                         || String.Equals(entry.Value, "Azure", StringComparison.OrdinalIgnoreCase)
                         || String.Equals(entry.Value, "AzureDirectory", StringComparison.OrdinalIgnoreCase))
                {
                    operationArguments.Authority = AuthorityType.AzureDirectory;
                }
                else if (String.Equals(entry.Value, "Integrated", StringComparison.OrdinalIgnoreCase)
                         || String.Equals(entry.Value, "NTLM", StringComparison.OrdinalIgnoreCase)
                         || String.Equals(entry.Value, "Kerberos", StringComparison.OrdinalIgnoreCase)
                         || String.Equals(entry.Value, "SSO", StringComparison.OrdinalIgnoreCase))
                {
                    operationArguments.Authority = AuthorityType.Integrated;
                }
                else
                {
                    operationArguments.Authority = AuthorityType.Basic;
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.TargetUri, ConfigInteractiveKey, out entry))
            {
                Trace.WriteLine("   " + ConfigInteractiveKey + " = " + entry.Value);

                if (String.Equals("always", entry.Value, StringComparison.OrdinalIgnoreCase)
                    || String.Equals("true", entry.Value, StringComparison.OrdinalIgnoreCase)
                    || String.Equals("force", entry.Value, StringComparison.OrdinalIgnoreCase))
                {
                    operationArguments.Interactivity = Interactivity.Always;
                }
                else if (String.Equals("never", entry.Value, StringComparison.OrdinalIgnoreCase)
                         || String.Equals("false", entry.Value, StringComparison.OrdinalIgnoreCase))
                {
                    operationArguments.Interactivity = Interactivity.Never;
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.TargetUri, ConfigValidateKey, out entry))
            {
                Trace.WriteLine("   " + ConfigValidateKey + " = " + entry.Value);

                bool validate = operationArguments.ValidateCredentials;
                if (Boolean.TryParse(entry.Value, out validate))
                {
                    operationArguments.ValidateCredentials = validate;
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.TargetUri, ConfigWritelogKey, out entry))
            {
                Trace.WriteLine("   " + ConfigWritelogKey + " = " + entry.Value);

                bool writelog = operationArguments.WriteLog;
                if (Boolean.TryParse(entry.Value, out writelog))
                {
                    operationArguments.WriteLog = writelog;
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.TargetUri, ConfigUseModalUi, out entry))
            {
                Trace.WriteLine("   " + ConfigUseModalUi + " = " + entry.Value);

                bool usemodel = operationArguments.WriteLog;
                if (Boolean.TryParse(entry.Value, out usemodel))
                {
                    operationArguments.UseModalUi = usemodel;
                }
            }
        }
        private static void LoadOperationArguments(OperationArguments operationArguments)
        {
            Debug.Assert(operationArguments != null, "The operationsArguments parameter is null.");

            Trace.WriteLine("Program::LoadOperationArguments");

            if (operationArguments.TargetUri == null)
            {
                Console.Error.WriteLine("fatal: no host information, unable to continue.");
                Environment.Exit(-1);
            }

            Configuration config = new Configuration();
            Configuration.Entry entry;

            if (config.TryGetEntry(ConfigPrefix, operationArguments.QueryUri, ConfigAuthortyKey, out entry))
            {
                Trace.WriteLine("   " + ConfigAuthortyKey + " = " + entry.Value);

                if (ConfigStringComparer.Equals(entry.Value, "MSA")
                    || ConfigStringComparer.Equals(entry.Value, "Microsoft")
                    || ConfigStringComparer.Equals(entry.Value, "MicrosoftAccount")
                    || ConfigStringComparer.Equals(entry.Value, "Live")
                    || ConfigStringComparer.Equals(entry.Value, "LiveConnect")
                    || ConfigStringComparer.Equals(entry.Value, "LiveID"))
                {
                    operationArguments.Authority = AuthorityType.MicrosoftAccount;
                }
                else if (ConfigStringComparer.Equals(entry.Value, "AAD")
                         || ConfigStringComparer.Equals(entry.Value, "Azure")
                         || ConfigStringComparer.Equals(entry.Value, "AzureDirectory"))
                {
                    operationArguments.Authority = AuthorityType.AzureDirectory;
                }
                else if (ConfigStringComparer.Equals(entry.Value, "Integrated")
                         || ConfigStringComparer.Equals(entry.Value, "NTLM")
                         || ConfigStringComparer.Equals(entry.Value, "Kerberos")
                         || ConfigStringComparer.Equals(entry.Value, "SSO"))
                {
                    operationArguments.Authority = AuthorityType.Integrated;
                }
                else
                {
                    operationArguments.Authority = AuthorityType.Basic;
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.QueryUri, ConfigInteractiveKey, out entry))
            {
                Trace.WriteLine("   " + ConfigInteractiveKey + " = " + entry.Value);

                if (ConfigStringComparer.Equals(entry.Value, "always")
                    || ConfigStringComparer.Equals(entry.Value, "true")
                    || ConfigStringComparer.Equals(entry.Value, "force"))
                {
                    operationArguments.Interactivity = Interactivity.Always;
                }
                else if (ConfigStringComparer.Equals(entry.Value, "never")
                         || ConfigStringComparer.Equals(entry.Value, "false"))
                {
                    operationArguments.Interactivity = Interactivity.Never;
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.QueryUri, ConfigValidateKey, out entry))
            {
                Trace.WriteLine("   " + ConfigValidateKey + " = " + entry.Value);

                bool validate = operationArguments.ValidateCredentials;
                if (Boolean.TryParse(entry.Value, out validate))
                {
                    operationArguments.ValidateCredentials = validate;
                }
                else
                {
                    if (ConfigStringComparer.Equals(validate, "no"))
                    {
                        operationArguments.ValidateCredentials = false;
                    }
                    else if (ConfigStringComparer.Equals(validate, "yes"))
                    {
                        operationArguments.ValidateCredentials = true;
                    }
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.QueryUri, ConfigWritelogKey, out entry))
            {
                Trace.WriteLine("   " + ConfigWritelogKey + " = " + entry.Value);

                bool writelog = operationArguments.WriteLog;
                if (Boolean.TryParse(entry.Value, out writelog))
                {
                    operationArguments.WriteLog = writelog;
                }
                else
                {
                    if (ConfigStringComparer.Equals(writelog, "no"))
                    {
                        operationArguments.WriteLog = false;
                    }
                    else if (ConfigStringComparer.Equals(writelog, "yes"))
                    {
                        operationArguments.WriteLog = true;
                    }
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.QueryUri, ConfigUseModalPromptKey, out entry))
            {
                Trace.WriteLine("   " + ConfigUseModalPromptKey + " = " + entry.Value);

                bool usemodel = operationArguments.UseModalUi;
                if (Boolean.TryParse(entry.Value, out usemodel))
                {
                    operationArguments.UseModalUi = usemodel;
                }
                else
                {
                    if (ConfigStringComparer.Equals(usemodel, "no"))
                    {
                        operationArguments.UseModalUi = false;
                    }
                    else if (ConfigStringComparer.Equals(usemodel, "yes"))
                    {
                        operationArguments.UseModalUi = true;
                    }
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.QueryUri, ConfigPreserveCredentialsKey, out entry))
            {
                Trace.WriteLine("   " + ConfigPreserveCredentialsKey + " = " + entry.Value);

                bool preserveCredentials = operationArguments.UseModalUi;
                if (Boolean.TryParse(entry.Value, out preserveCredentials))
                {
                    operationArguments.PreserveCredentials = preserveCredentials;
                }
                else
                {
                    if (ConfigStringComparer.Equals(preserveCredentials, "no"))
                    {
                        operationArguments.PreserveCredentials = false;
                    }
                    else if (ConfigStringComparer.Equals(preserveCredentials, "yes"))
                    {
                        operationArguments.PreserveCredentials = true;
                    }
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.QueryUri, ConfigUseHttpPathKey, out entry))
            {
                Trace.WriteLine("   " + ConfigUseHttpPathKey + " = " + entry.Value);

                bool useHttPath = operationArguments.UseHttpPath;
                if (Boolean.TryParse(entry.Value, out useHttPath))
                {
                    operationArguments.UseHttpPath = true;
                }
            }

            if (config.TryGetEntry(ConfigPrefix, operationArguments.QueryUri, ConfigHttpProxyKey, out entry)
                || config.TryGetEntry("http", operationArguments.QueryUri, "proxy", out entry))
            {
                Trace.WriteLine("   " + ConfigHttpProxyKey + " = " + entry.Value);

                operationArguments.SetProxy(entry.Value);
            }
        }