Exemplo n.º 1
0
        internal static ServiceInfo CreateServiceInfo(XPathNavigator nav)
        {
            Uri    platformUrl     = null;
            string platformVersion = null;
            Dictionary <string, string> configValues;
            XPathNavigator platformNav = nav.SelectSingleNode("platform");

            if (platformNav != null)
            {
                platformUrl     = new Uri(platformNav.SelectSingleNode("url").Value);
                platformVersion = platformNav.SelectSingleNode("version").Value;
                configValues    = GetConfigurationValues(platformNav.Select("configuration"));
            }
            else
            {
                configValues = new Dictionary <string, string>();
            }

            HealthServiceShellInfo shellInfo = null;
            XPathNavigator         shellNav  = nav.SelectSingleNode("shell");

            if (shellNav != null)
            {
                shellInfo = HealthServiceShellInfo.CreateShellInfo(
                    nav.SelectSingleNode("shell"));
            }

            Collection <HealthServiceMethodInfo> methods = GetMethods(nav);
            Collection <Uri> includes = GetIncludes(nav);

            string currentInstanceId;
            Dictionary <string, HealthServiceInstance> instances =
                GetServiceInstances(nav, out currentInstanceId);

            Instant lastUpdated = SDKHelper.InstantFromUnmarkedXml(nav.SelectSingleNode("updated-date").Value);

            ServiceInfo serviceInfo =
                new ServiceInfo(
                    platformUrl,
                    platformVersion,
                    shellInfo,
                    methods,
                    includes,
                    configValues,
                    instances,
                    currentInstanceId,
                    lastUpdated);

            return(serviceInfo);
        }