private void ParseRuntimeSection(XDocument doc)
            {
                var loggingNode = doc.Root.Element("runtime") != null?
                                  doc.Root.Element("runtime")?.Element("logging") : null;

                this.instance.LogLevel = loggingNode != null ?
                                         (LogLevel)Enum.Parse(typeof(LogLevel), loggingNode.Attribute("level").Value)
                    : LogLevel.Normal;

                var rateLimitElement = doc.Root.Element("runtime")?.Element("rateLimiting");

                if (rateLimitElement != null)
                {
                    var rateLimit = new RateLimit()
                    {
                        Changes  = int.Parse(rateLimitElement.Attribute("changes").Value),
                        Interval = TimeSpan.Parse(rateLimitElement.Attribute("interval").Value)
                    };
                    this.instance.RateLimit = rateLimit;
                }
                else
                {
                    this.instance.RateLimit = null;
                }

                var runtimeNode = doc.Root.Element("runtime") ?? null;
                var debugvalue  = runtimeNode?.Attribute("debug")?.Value;

                this.instance.Debug = debugvalue != null && bool.Parse(debugvalue);
                var whatifvalue = runtimeNode?.Attribute("whatIf")?.Value;

                this.instance.WhatIf = whatifvalue != null && bool.Parse(whatifvalue);

                var authenticationNode = doc.Root.Element("runtime") != null?
                                         doc.Root.Element("runtime")?.Element("authentication") : null;

                this.instance.AutoImpersonate = authenticationNode != null &&
                                                bool.Parse(authenticationNode.Attribute("autoImpersonate").Value);
                this.instance.PersonalToken =
                    authenticationNode?.Attribute("personalToken")?.Value;
                this.instance.BasicUsername = authenticationNode?.Attribute("username")?.Value;
                this.instance.BasicPassword = authenticationNode?.Attribute("password")?.Value;

                var scriptNode = doc.Root.Element("runtime") != null?
                                 doc.Root.Element("runtime")?.Element("script") : null;

                this.instance.ScriptLanguage = scriptNode?.Attribute("language").Value ?? "C#";

                var serverNode = doc.Root.Element("runtime") != null?
                                 doc.Root.Element("runtime")?.Element("server") : null;

                string baseUrl = serverNode?.Attribute("baseUrl")?.Value;

                this.instance.ServerBaseUrl = string.IsNullOrWhiteSpace(baseUrl)
                    ? null
                    : new Uri(new Uri(baseUrl).GetLeftPart(UriPartial.Authority));
                this.instance.IgnoreSslErrors = serverNode != null &&
                                                bool.Parse(serverNode.Attribute("ignoreSslErrors")?.Value);
            }
            private void ParseRuntimeSection(XDocument doc)
            {
                var loggingNode = doc.Root.Element("runtime") != null?
                                  doc.Root.Element("runtime")?.Element("logging") : null;

                this.instance.LogLevel = loggingNode != null ?
                                         (LogLevel)Enum.Parse(typeof(LogLevel), loggingNode.Attribute("level").Value)
                    : LogLevel.Normal;

                var rateLimitElement = doc.Root.Element("runtime")?.Element("rateLimiting");

                if (rateLimitElement != null)
                {
                    var rateLimit = new RateLimit();
                    rateLimit.Changes       = int.Parse(rateLimitElement.Attribute("changes").Value);
                    rateLimit.Interval      = TimeSpan.Parse(rateLimitElement.Attribute("interval").Value);
                    this.instance.RateLimit = rateLimit;
                }
                else
                {
                    this.instance.RateLimit = null;
                }

                var runtimeNode = doc.Root.Element("runtime") ?? null;
                var debugvalue  = runtimeNode?.Attribute("debug")?.Value;

                this.instance.Debug = debugvalue != null && bool.Parse(debugvalue);

                var authenticationNode = doc.Root.Element("runtime") != null?
                                         doc.Root.Element("runtime")?.Element("authentication") : null;

                this.instance.AutoImpersonate = authenticationNode != null &&
                                                bool.Parse(authenticationNode.Attribute("autoImpersonate").Value);

                var scriptNode = doc.Root.Element("runtime") != null?
                                 doc.Root.Element("runtime")?.Element("script") : null;

                this.instance.ScriptLanguage = scriptNode?.Attribute("language").Value ?? "C#";
            }
            private void ParseRuntimeSection(XDocument doc)
            {
                var loggingNode = doc.Root.Element("runtime") != null ?
                    doc.Root.Element("runtime")?.Element("logging") : null;
                this.instance.LogLevel = loggingNode != null ?
                    (LogLevel)Enum.Parse(typeof(LogLevel), loggingNode.Attribute("level").Value)
                    : LogLevel.Normal;

                var rateLimitElement = doc.Root.Element("runtime")?.Element("rateLimiting");
                if (rateLimitElement != null)
                {
                    var rateLimit = new RateLimit();
                    rateLimit.Changes = int.Parse(rateLimitElement.Attribute("changes").Value);
                    rateLimit.Interval = TimeSpan.Parse(rateLimitElement.Attribute("interval").Value);
                    this.instance.RateLimit = rateLimit;
                }
                else
                {
                    this.instance.RateLimit = null;
                }

                var runtimeNode = doc.Root.Element("runtime") ?? null;
                var debugvalue = runtimeNode?.Attribute("debug")?.Value;
                this.instance.Debug = debugvalue != null && bool.Parse(debugvalue);

                var authenticationNode = doc.Root.Element("runtime") != null ?
                    doc.Root.Element("runtime")?.Element("authentication") : null;
                this.instance.AutoImpersonate = authenticationNode != null
                    && bool.Parse(authenticationNode.Attribute("autoImpersonate").Value);

                var scriptNode = doc.Root.Element("runtime") != null ?
                    doc.Root.Element("runtime")?.Element("script") : null;

                this.instance.ScriptLanguage = scriptNode?.Attribute("language").Value ?? "C#";
            }