From c79e8e88865d5e42148f349a89fbf00f7b721a98 Mon Sep 17 00:00:00 2001 From: Hisham Bin Ateya Date: Sat, 24 Oct 2015 04:36:46 +0300 Subject: [PATCH] Remove CultureInfoGenerator --- .../CultureInfoGenerator.xproj | 20 ---- src/CultureInfoGenerator/Program.cs | 110 ------------------ src/CultureInfoGenerator/project.json | 17 --- 3 files changed, 147 deletions(-) delete mode 100644 src/CultureInfoGenerator/CultureInfoGenerator.xproj delete mode 100644 src/CultureInfoGenerator/Program.cs delete mode 100644 src/CultureInfoGenerator/project.json diff --git a/src/CultureInfoGenerator/CultureInfoGenerator.xproj b/src/CultureInfoGenerator/CultureInfoGenerator.xproj deleted file mode 100644 index 6e980d08c1..0000000000 --- a/src/CultureInfoGenerator/CultureInfoGenerator.xproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - bd22ae1c-6631-4da6-874d-0dc0f803ceab - CultureInfoGenerator - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ - - - - 2.0 - - - diff --git a/src/CultureInfoGenerator/Program.cs b/src/CultureInfoGenerator/Program.cs deleted file mode 100644 index 7161e646a4..0000000000 --- a/src/CultureInfoGenerator/Program.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Globalization; -using System.IO; -using System.Linq; -using Microsoft.Extensions.PlatformAbstractions; -using Microsoft.Win32; - -namespace CultureInfoGenerator -{ - public class Program - { - private readonly string _appName; - private readonly string _appPath; - - public Program(IApplicationEnvironment appEnvironment) - { - _appName = appEnvironment.ApplicationName; - _appPath = appEnvironment.ApplicationBasePath; - } - - public void Main(string[] args) - { - var outputFilePath = Path.GetFullPath(args.Length > 0 ? args[0] : Path.Combine(_appPath, "../Microsoft.Extensions.Globalization.CultureInfoCache/CultureInfoList.cs")); - var netFxVersion = Get45or451FromRegistry(); - var windowsVersion = Environment.OSVersion; - - using (var writer = new StreamWriter(outputFilePath, false)) - { - writer.WriteLine($@"// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -// *************************** THIS FILE IS GENERATED BY A TOOL *************************** -// To make changes to this file look at the CultureInfoGenerator project in this solution. - -using System; -using System.Collections.Generic; - -namespace Microsoft.Extensions.Globalization -{{ - /// - /// Contains a list of known culture names that can be used to create a . - /// - public static partial class CultureInfoCache - {{ - /// - /// This list of known cultures was generated by {_appName} using .NET Framework {netFxVersion} on - /// {windowsVersion}. - /// As new versions of .NET Framework and Windows are released, this list should be regenerated to ensure it - /// contains the latest culture names. - /// - public static readonly HashSet KnownCultureNames = new HashSet(StringComparer.OrdinalIgnoreCase) - {{" - ); - - var cultures = CultureInfo.GetCultures( - CultureTypes.NeutralCultures - | CultureTypes.InstalledWin32Cultures - | CultureTypes.SpecificCultures); - - writer.WriteLine(string.Join($",{Environment.NewLine}", cultures.Select(c => $" \"{c.Name}\""))); - writer.WriteLine( -@" }; - } -}"); - - Console.WriteLine($"{cultures.Length} culture names written to {outputFilePath}"); - } - } - - // .NET Framework detection code copied from https://msdn.microsoft.com/en-us/library/hh925568%28v=vs.110%29.aspx#net_d - private static string Get45or451FromRegistry() - { - using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32) - .OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\")) - { - var releaseKey = Convert.ToInt32(ndpKey.GetValue("Release")); - return CheckFor45DotVersion(releaseKey); - } - } - - // Checking the version using >= will enable forward compatibility, - // however you should always compile your code on newer versions of - // the framework to ensure your app works the same. - private static string CheckFor45DotVersion(int releaseKey) - { - if (releaseKey >= 393273) - { - return "4.6 RC or later"; - } - if (releaseKey >= 379893) - { - return "4.5.2 or later"; - } - if (releaseKey >= 378675) - { - return "4.5.1 or later"; - } - if (releaseKey >= 378389) - { - return "4.5 or later"; - } - // This line should never execute. A non-null release key should mean - // that 4.5 or later is installed. - return "No 4.5 or later version detected"; - } - } -} diff --git a/src/CultureInfoGenerator/project.json b/src/CultureInfoGenerator/project.json deleted file mode 100644 index 040b74451b..0000000000 --- a/src/CultureInfoGenerator/project.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0-*", - "description": "Generates a list of known culture names from the OS using CultureInfo.GetCultures. This tool is intended to be run on Windows using full .NET Framework.", - "repository": { - "type": "git", - "url": "https://github.com/aspnet/localization" - }, - "dependencies": { - "Microsoft.Extensions.PlatformAbstractions": "1.0.0-*" - }, - "commands": { - "CultureInfoGenerator": "CultureInfoGenerator" - }, - "frameworks": { - "dnx451": { } - } -} \ No newline at end of file