//=====================================================================

        /// <summary>
        /// This is used to load the settings for a .NET Framework version from an XML element
        /// </summary>
        /// <param name="framework">The XML element containing the settings</param>
        /// <returns>The new framework settings item</returns>
        internal static FrameworkSettings FromXml(XElement framework)
        {
            FrameworkSettings fs = new FrameworkSettings
            {
                Title    = framework.Attribute("Title").Value,
                Platform = framework.Attribute("Platform").Value,
                Version  = new Version(framework.Attribute("Version").Value),
                Redirect = (string)framework.Attribute("Redirect")
            };

            foreach (var location in framework.Descendants("Location"))
            {
                fs.assemblyLocations.Add(AssemblyLocation.FromXml(location));
            }

            return(fs);
        }
Esempio n. 2
0
        //=====================================================================

        /// <summary>
        /// This is used to load the settings for an assembly location from an XML element
        /// </summary>
        /// <param name="location">The XML element containing the settings</param>
        /// <returns>The new assembly location item</returns>
        /// <remarks>If the location element is empty, the assembly details will be created by scanning the
        /// location for assemblies.</remarks>
        internal static AssemblyLocation FromXml(XElement location)
        {
            string path = Environment.ExpandEnvironmentVariables(location.Attribute("Path").Value);

            // If x86 but it didn't exist, assume it's a 32-bit system and change the name
            if (path.IndexOf("%ProgramFiles(x86)%", StringComparison.Ordinal) != -1)
            {
                path = Environment.ExpandEnvironmentVariables(path.Replace("(x86)", String.Empty));
            }

            AssemblyLocation al = new AssemblyLocation
            {
                Path           = path,
                IsCoreLocation = ((bool?)location.Attribute("IsCore") ?? false)
            };

            foreach (var a in location.Descendants("AssemblyDetails"))
            {
                al.assemblyDetails.Add(AssemblyDetails.FromXml(path, a));
            }

            return(al);
        }
Esempio n. 3
0
        /// <summary>
        /// This is used to see if any comments files exist in a culture-specific framework location folder
        /// </summary>
        /// <param name="location">The framework location</param>
        /// <param name="language">The language used to check for a culture-specific folder</param>
        /// <returns>True if files were</returns>
        private static string CultureSpecificCommentsFileFolder(AssemblyLocation location, CultureInfo language)
        {
            string path = location.Path;

            if(language == null)
                return null;

            if(Directory.Exists(Path.Combine(path, language.Name)))
                path = Path.Combine(path, language.Name);
            else
                if(Directory.Exists(Path.Combine(path, language.TwoLetterISOLanguageName)))
                    path = Path.Combine(path, language.TwoLetterISOLanguageName);
                else
                    path = null;

            if(path != null && !location.Assemblies.Any(a => File.Exists(Path.ChangeExtension(
              Path.Combine(path, Path.GetFileName(a.Filename)), ".xml"))))
                path = null;

            return path;
        }
Esempio n. 4
0
        //=====================================================================

        /// <summary>
        /// This is used to load the settings for an assembly location from an XML element
        /// </summary>
        /// <param name="location">The XML element containing the settings</param>
        /// <returns>The new assembly location item</returns>
        /// <remarks>If the location element is empty, the assembly details will be created by scanning the
        /// location for assemblies.</remarks>
        internal static AssemblyLocation FromXml(XElement location)
        {
            string path = Environment.ExpandEnvironmentVariables(location.Attribute("Path").Value);

            // If x86 but it didn't exist, assume it's a 32-bit system and change the name
            if(path.IndexOf("%ProgramFiles(x86)%", StringComparison.Ordinal) != -1)
                path = Environment.ExpandEnvironmentVariables(path.Replace("(x86)", String.Empty));

            AssemblyLocation al = new AssemblyLocation
            {
                Path = path,
                IsCoreLocation = ((bool?)location.Attribute("IsCore") ?? false)
            };

            foreach(var a in location.Descendants("AssemblyDetails"))
                al.assemblyDetails.Add(AssemblyDetails.FromXml(path, a));

            return al;
        }