Esempio n. 1
0
        /// <summary>
        /// Gets the Uri of the specified module.
        /// </summary>
        /// <param name="moduleInfo">The module info.</param>
        /// <returns>The uri of the module.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="moduleInfo"/> is <c>null</c>.</exception>
        private Uri GetModuleUri(ModuleInfo moduleInfo)
        {
            Argument.IsNotNull("moduleInfo", moduleInfo);

            Uri uri;

            if (string.IsNullOrWhiteSpace(moduleInfo.Ref))
            {
                Log.Debug("Ref property of module '{0}' is null or whitespace, automatically falling back to host", moduleInfo.ModuleName);

                var fullyQualifiedAssemblyName = TypeHelper.GetAssemblyName(moduleInfo.ModuleType);
                var assemblyName = TypeHelper.GetAssemblyNameWithoutOverhead(fullyQualifiedAssemblyName);
                var url          = HostHelper.GetHostUrl(string.Format("/ClientBin/{0}.xap", assemblyName));

                Log.Debug("Falling back to host url '{0}'", url);

                uri = new Uri(url);
            }
            else
            {
                uri = new Uri(moduleInfo.Ref);
            }

            return(uri);
        }