Initial version of getdotnet app
This commit is contained in:
108
framework-versions.json
Normal file
108
framework-versions.json
Normal file
@@ -0,0 +1,108 @@
|
||||
{
|
||||
"frameworkVersions" :
|
||||
[
|
||||
{
|
||||
"target" : ".NETFramework,Version=v4.6",
|
||||
"version" : "4.6",
|
||||
"info":"http://blogs.msdn.com/b/dotnet/archive/2015/07/20/announcing-net-framework-4-6.aspx",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkId=528259",
|
||||
"webInstaller" : "http://go.microsoft.com/fwlink/?LinkId=528222",
|
||||
"offlineInstaller" : "http://go.microsoft.com/fwlink/?LinkId=528232",
|
||||
"targetingPack" : "http://go.microsoft.com/fwlink/?LinkId=528261",
|
||||
"languagePack" : "https://support.microsoft.com/en-us/kb/3045556"
|
||||
},
|
||||
{
|
||||
"target" : ".NETFramework,Version=v4.5.2",
|
||||
"info":"http://blogs.msdn.com/b/dotnet/archive/2014/05/05/announcing-the-net-framework-4-5-2-release.aspx",
|
||||
"version" : "4.5.2",
|
||||
"preferVersion" : "4.6",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkId=397674",
|
||||
"webInstaller" : "http://go.microsoft.com/fwlink/?LinkId=397674",
|
||||
"offlineInstaller" : "http://go.microsoft.com/fwlink/?LinkId=328856",
|
||||
"targetingPack" : "http://go.microsoft.com/fwlink/?LinkId=328857",
|
||||
"languagePack" : "http://go.microsoft.com/fwlink/?LinkId=328858"
|
||||
},
|
||||
{
|
||||
"target" : ".NETFramework,Version=v4.5.1",
|
||||
"version" : "4.5.1",
|
||||
"preferVersion" : "4.6",
|
||||
"info" : "http://blogs.msdn.com/b/dotnet/archive/2013/10/17/net-framework-4-5-1-rtm-gt-start-coding.aspx",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkId=308918"
|
||||
},
|
||||
{
|
||||
"target" : ".NETFramework,Version=v4.5",
|
||||
"version" : "4.5",
|
||||
"preferVersion" : "4.6",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkId=229538"
|
||||
},
|
||||
{
|
||||
"target" : ".NETFramework,Version=v4.0.3",
|
||||
"aliases" : [".NETFramework,Version=v4.0.3,Profile=Client"],
|
||||
"version" : "4.0.3",
|
||||
"preferVersion" : "4.6",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkID=229541"
|
||||
},
|
||||
{
|
||||
"target" : ".NETFramework,Version=v4.0.2",
|
||||
"aliases" : [".NETFramework,Version=v4.0.2,Profile=Client"],
|
||||
"version" : "4.0.2",
|
||||
"preferVersion" : "4.6",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkID=229539"
|
||||
},
|
||||
{
|
||||
"target" : ".NETFramework,Version=v4.0.1",
|
||||
"aliases" : [".NETFramework,Version=v4.0.1,Profile=Client"],
|
||||
"version" : "4.0.1",
|
||||
"preferVersion" : "4.6",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkID=213996"
|
||||
},
|
||||
{
|
||||
"target" : ".NETFramework,Version=v4.0",
|
||||
"aliases": ["v4.0", "v4.0.30319",".NETFramework,Version=v4.0,Profile=Client"],
|
||||
"version" : "4",
|
||||
"preferVersion" : "4.6",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkId=213834"
|
||||
},
|
||||
{
|
||||
"target" : "3.5",
|
||||
"aliases" : ["Client"],
|
||||
"version" : "3.5",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkId=213828",
|
||||
"webInstaller" : "http://download.microsoft.com/download/2/0/E/20E90413-712F-438C-988E-FDAA79A8AC3D/dotnetfx35.exe"
|
||||
},
|
||||
{
|
||||
"target" : "v2.0.50727",
|
||||
"version" : "2",
|
||||
"preferVersion" : "3.5",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkId=213823"
|
||||
},
|
||||
{
|
||||
"target" : "v1.1.4322",
|
||||
"version" : "1.1",
|
||||
"preferVersion" : "3.5",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkID=213810"
|
||||
},
|
||||
{
|
||||
"target" : "v1.0.3705",
|
||||
"version" : "1",
|
||||
"preferVersion" : "3.5",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkId=214025"
|
||||
}
|
||||
],
|
||||
"help" :
|
||||
[
|
||||
{
|
||||
"name" : "dotnet-45-xp",
|
||||
"info" : "http://getdotnet.azurewebsites.net/help/dotnet45-xp.html"
|
||||
},
|
||||
{
|
||||
"name" : "dotnet-4-xp",
|
||||
"info" : "http://getdotnet.azurewebsites.net/help/dotnet4-xp.html"
|
||||
},
|
||||
{
|
||||
"name" : "dotnet-versions",
|
||||
"info" : "http://getdotnet.azurewebsites.net/install-dotnet.html"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
110
tellver/Controllers/VersionController.cs
Normal file
110
tellver/Controllers/VersionController.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using GetDotnet.Models;
|
||||
|
||||
namespace GetDotnet.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
public class VersionController : Controller
|
||||
{
|
||||
static string s_dotnetVersions = Path.Combine("../","framework-versions.json");
|
||||
static List<FrameworkVersion> s_frameworkVersions;
|
||||
static List<Dictionary<string,string>> s_help;
|
||||
|
||||
static VersionController()
|
||||
{
|
||||
using (var stream = new FileStream(s_dotnetVersions,FileMode.Open))
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
var json = reader.ReadToEnd();
|
||||
var jsonObj = JsonConvert.DeserializeObject<Dictionary<string,JToken>>(json);
|
||||
s_frameworkVersions = jsonObj["frameworkVersions"].ToObject<List<FrameworkVersion>>();
|
||||
s_help = jsonObj["help"].ToObject<List<Dictionary<string,string>>>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpDeleteAttribute]
|
||||
public IEnumerable<string> GetAll()
|
||||
{
|
||||
return from version in s_frameworkVersions
|
||||
select version.Target;
|
||||
}
|
||||
|
||||
|
||||
public FrameworkVersion GetVersion44WithPolicy(string inputVersion, string os = "7")
|
||||
{
|
||||
|
||||
var version = (from v in s_frameworkVersions
|
||||
where v.Target == inputVersion || (v.Aliases!=null && v.Aliases.Contains(inputVersion))
|
||||
select v).First();
|
||||
|
||||
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public FrameworkVersion GetVersionWithPolicy(string inputVersion, string OS = "7")
|
||||
{
|
||||
|
||||
var version = (from v in s_frameworkVersions
|
||||
where v.Target == inputVersion || (v.Aliases!=null && v.Aliases.Contains(inputVersion))
|
||||
select v).First();
|
||||
|
||||
if (OS.ToLowerInvariant() == "xp")
|
||||
{
|
||||
var stringEmpty = string.IsNullOrEmpty(version.Version);
|
||||
var majVersion = 0;
|
||||
var minVersion = 0;
|
||||
|
||||
if (!stringEmpty && version.Version.Length > 0)
|
||||
{
|
||||
majVersion = version.Version[0] - '0';
|
||||
}
|
||||
|
||||
if (!stringEmpty && version.Version.Length > 2 && version.Version[1] == '.')
|
||||
{
|
||||
minVersion = version.Version[2] - '0';
|
||||
}
|
||||
|
||||
if (majVersion == 4)
|
||||
{
|
||||
if (minVersion >= 5)
|
||||
{
|
||||
version.HelpInfo = (from page in s_help
|
||||
where page["name"] == "dotnet-45-xp"
|
||||
select page).First()["info"];
|
||||
}
|
||||
else
|
||||
{
|
||||
version.HelpInfo = (from page in s_help
|
||||
where page["name"] == "dotnet-4-xp"
|
||||
select page).First()["info"];
|
||||
}
|
||||
return version;
|
||||
}
|
||||
else if (majVersion <0 || majVersion >4)
|
||||
{
|
||||
version.HelpInfo = (from page in s_help
|
||||
where page["name"] == "dotnet-versions"
|
||||
select page).First()["info"];
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(version.PreferVersion))
|
||||
{
|
||||
version = (from v in s_frameworkVersions
|
||||
where v.Version == version.PreferVersion
|
||||
select v).First();
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
}
|
||||
}
|
||||
30
tellver/Models/FrameworkVersion.cs
Normal file
30
tellver/Models/FrameworkVersion.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GetDotnet.Models
|
||||
{
|
||||
public class FrameworkVersion
|
||||
{
|
||||
public string Target {get;set;}
|
||||
public List<string> Aliases {get;set;}
|
||||
public string Version {get;set;}
|
||||
public string PreferVersion {get;set;}
|
||||
public string Info {get;set;}
|
||||
public string HelpInfo {get;set;}
|
||||
public string Download {get;set;}
|
||||
public string WebInstaller {get;set;}
|
||||
public string OfflineInstaller {get;set;}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
"target" : ".NETFramework,Version=v4.6",
|
||||
"version" : "4.6",
|
||||
"info":"http://blogs.msdn.com/b/dotnet/archive/2015/07/20/announcing-net-framework-4-6.aspx",
|
||||
"download" : "http://go.microsoft.com/fwlink/?LinkId=528259",
|
||||
"webInstaller" : "http://go.microsoft.com/fwlink/?LinkId=528222",
|
||||
"offlineInstaller" : "http://go.microsoft.com/fwlink/?LinkId=528232",
|
||||
"targetingPack" : "http://go.microsoft.com/fwlink/?LinkId=528261",
|
||||
"languagePack" : "https://support.microsoft.com/en-us/kb/3045556"
|
||||
}
|
||||
*/
|
||||
25
tellver/Startup.cs
Normal file
25
tellver/Startup.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Logging;
|
||||
|
||||
namespace GetDotnet
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddMvc();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
|
||||
{
|
||||
loggerFactory.AddConsole();
|
||||
|
||||
app.UseErrorPage();
|
||||
|
||||
app.UseMvcWithDefaultRoute();
|
||||
|
||||
app.UseWelcomePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
20
tellver/project.json
Normal file
20
tellver/project.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"System.Runtime.Extensions": "4.0.10-beta-*",
|
||||
"Microsoft.AspNet.Diagnostics": "1.0.0-*",
|
||||
"Microsoft.AspNet.Mvc": "6.0.0-*",
|
||||
"Microsoft.AspNet.Server.IIS": "1.0.0-*",
|
||||
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
|
||||
"Microsoft.Framework.Logging.Console": "1.0.0-*",
|
||||
"Kestrel": "1.0.0-*",
|
||||
"Newtonsoft.Json": "7.0.1"
|
||||
},
|
||||
"commands": {
|
||||
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001",
|
||||
"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
||||
6171
tellver/project.lock.json
Normal file
6171
tellver/project.lock.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user