From 1befc2e053720e3cb081483972db833d21de4011 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sat, 9 Apr 2022 19:53:26 +0100 Subject: [PATCH] ... --- .vs/isn/xs/UserPrefs.xml | 27 +--- .vscode/settings.json | 26 +++- isn.sln | 15 +++ isntest.session.sql | 1 + src/isn.abst/ApiIndexViewModel.cs | 13 ++ src/isn.abst/Constants.cs | 8 ++ .../Controllers => isn.abst}/Resource.cs | 32 ++--- src/isn.abst/isn.abst.csproj | 11 ++ src/isn/IsnSourceSettings.cs | 9 ++ src/isn/IsndErrorMessage.cs | 8 ++ src/isn/Program.Commands.cs | 126 ------------------ src/isn/Program.cs | 57 ++++++++ src/isn/PushCommand.cs | 13 +- src/isn/SourceHelpers.cs | 21 +++ src/isn/UploadFilesToServerUsingWebRequest.cs | 7 +- src/isn/commands/push.cs | 35 +++++ src/isn/commands/set-api-key.cs | 66 +++++++++ src/isn/commands/show.config.cs | 19 +++ src/isn/commands/sources.add.cs | 25 ++++ src/isn/commands/sources.list.cs | 23 ++++ src/isn/isn.1.0.0.nupkg | Bin 10522 -> 0 bytes src/isn/isn.csproj | 19 ++- src/isnd/Constants.cs | 2 +- src/isnd/Controllers/AccountController.cs | 4 +- src/isnd/Controllers/NewUpdateController.cs | 2 +- src/isnd/Controllers/PackagesController.cs | 3 +- src/isnd/Interfaces/IPackageManager.cs | 1 + src/isnd/Services/PackageManager.cs | 4 +- src/isnd/Startup.cs | 6 +- src/isnd/isnd.csproj | 4 + test/isn.tests/Engine.cs | 17 --- test/isn.tests/IBody.cs | 12 -- test/isn.tests/IRing.cs | 11 -- test/isn.tests/Ring.cs | 29 ---- test/isn.tests/UnitTest1.cs | 61 ++------- test/isn.tests/isn.tests.csproj | 2 +- test/isnd.tests/UnitTestWebHost.cs | 13 +- test/isnd.tests/isnd.tests.csproj | 4 +- 38 files changed, 427 insertions(+), 309 deletions(-) create mode 100644 isntest.session.sql create mode 100644 src/isn.abst/ApiIndexViewModel.cs create mode 100644 src/isn.abst/Constants.cs rename src/{isnd/Controllers => isn.abst}/Resource.cs (87%) create mode 100644 src/isn.abst/isn.abst.csproj create mode 100644 src/isn/IsnSourceSettings.cs create mode 100644 src/isn/IsndErrorMessage.cs delete mode 100644 src/isn/Program.Commands.cs create mode 100644 src/isn/SourceHelpers.cs create mode 100644 src/isn/commands/push.cs create mode 100644 src/isn/commands/set-api-key.cs create mode 100644 src/isn/commands/show.config.cs create mode 100644 src/isn/commands/sources.add.cs create mode 100644 src/isn/commands/sources.list.cs delete mode 100644 src/isn/isn.1.0.0.nupkg delete mode 100644 test/isn.tests/Engine.cs delete mode 100644 test/isn.tests/IBody.cs delete mode 100644 test/isn.tests/IRing.cs delete mode 100644 test/isn.tests/Ring.cs diff --git a/.vs/isn/xs/UserPrefs.xml b/.vs/isn/xs/UserPrefs.xml index d3ad2cc..835aae7 100644 --- a/.vs/isn/xs/UserPrefs.xml +++ b/.vs/isn/xs/UserPrefs.xml @@ -1,34 +1,19 @@  - + - - - + - - - - - - - - - - - - - - - - + + - + + diff --git a/.vscode/settings.json b/.vscode/settings.json index 604ccae..8298106 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,5 +10,29 @@ "dotnetCoreExplorer.runEnvVars": { "ASPNETCORE_ENVIRONMENT": "Testing" }, - "dotnetCoreExplorer.searchpatterns": "test/**/bin/**/*.tests.{dll,exe}" + "dotnetCoreExplorer.searchpatterns": "test/**/bin/**/*.tests.{dll,exe}", + "sqltools.connections": [ + { + "previewLimit": 50, + "server": "localhost", + "port": 5432, + "driver": "PostgreSQL", + "name": "isntest", + "group": "isn", + "database": "nugettest", + "username": "paul", + "password": "R1vJa=y8#b/tfg" + }, + { + "previewLimit": 50, + "server": "localhost", + "port": 5432, + "driver": "PostgreSQL", + "name": "isndev", + "group": "isn", + "database": "dotnetmvc", + "username": "dotnetmvc", + "password": "RvJa=y#b/tfg" + } + ] } \ No newline at end of file diff --git a/isn.sln b/isn.sln index 68c3c7d..1e20c9f 100644 --- a/isn.sln +++ b/isn.sln @@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn", "src\isn\isn.csproj", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn.tests", "test\isn.tests\isn.tests.csproj", "{305F640E-11BA-44F9-95E0-C6882E9CD151}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isn.abst", "src\isn.abst\isn.abst.csproj", "{4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -76,11 +78,24 @@ Global {305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x64.Build.0 = Release|Any CPU {305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x86.ActiveCfg = Release|Any CPU {305F640E-11BA-44F9-95E0-C6882E9CD151}.Release|x86.Build.0 = Release|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x64.ActiveCfg = Debug|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x64.Build.0 = Debug|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x86.ActiveCfg = Debug|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Debug|x86.Build.0 = Debug|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|Any CPU.Build.0 = Release|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x64.ActiveCfg = Release|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x64.Build.0 = Release|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x86.ActiveCfg = Release|Any CPU + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {9D758F00-17FF-433D-B088-F9C2D97C9BD1} = {3C312E42-9A47-4BED-8265-A405FCA6AFFF} {468DB0E4-6221-4E01-BEFF-F452865E59C1} = {E8A2DF68-847A-4D88-B002-64FB666F696C} {910E800A-59AE-46C4-B7C7-879986179246} = {E8A2DF68-847A-4D88-B002-64FB666F696C} {305F640E-11BA-44F9-95E0-C6882E9CD151} = {3C312E42-9A47-4BED-8265-A405FCA6AFFF} + {4EFA7D3E-8B31-4BF7-96D1-B9F2867735C7} = {E8A2DF68-847A-4D88-B002-64FB666F696C} EndGlobalSection EndGlobal diff --git a/isntest.session.sql b/isntest.session.sql new file mode 100644 index 0000000..1350503 --- /dev/null +++ b/isntest.session.sql @@ -0,0 +1 @@ +select * from ApiKLeys; \ No newline at end of file diff --git a/src/isn.abst/ApiIndexViewModel.cs b/src/isn.abst/ApiIndexViewModel.cs new file mode 100644 index 0000000..505cb35 --- /dev/null +++ b/src/isn.abst/ApiIndexViewModel.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; + +namespace isn.Abstract +{ + public class ApiIndexViewModel + { + [JsonProperty("version")] + public string Version { get; set; } + + [JsonProperty("resources")] + public Resource[] Resources { get; set; } + } +} \ No newline at end of file diff --git a/src/isn.abst/Constants.cs b/src/isn.abst/Constants.cs new file mode 100644 index 0000000..bc5cf0a --- /dev/null +++ b/src/isn.abst/Constants.cs @@ -0,0 +1,8 @@ +namespace isn.abst +{ + public static class Constants + { + public const string PublishCommandId = "PackagePublish/2.0.0"; + + } +} \ No newline at end of file diff --git a/src/isnd/Controllers/Resource.cs b/src/isn.abst/Resource.cs similarity index 87% rename from src/isnd/Controllers/Resource.cs rename to src/isn.abst/Resource.cs index c1950c2..235690d 100644 --- a/src/isnd/Controllers/Resource.cs +++ b/src/isn.abst/Resource.cs @@ -1,17 +1,17 @@ -using Newtonsoft.Json; - -namespace isnd.Controllers -{ - public class Resource - { - [JsonProperty("@id")] - public string Id {get; set; } - - [JsonProperty("@type")] - public string Type {get; set; } - - [JsonProperty("comment")] - public string Comment {get; set; } - - } +using Newtonsoft.Json; + +namespace isn.Abstract +{ + public class Resource + { + [JsonProperty("@id")] + public string Id {get; set; } + + [JsonProperty("@type")] + public string Type {get; set; } + + [JsonProperty("comment")] + public string Comment {get; set; } + + } } \ No newline at end of file diff --git a/src/isn.abst/isn.abst.csproj b/src/isn.abst/isn.abst.csproj new file mode 100644 index 0000000..8f24508 --- /dev/null +++ b/src/isn.abst/isn.abst.csproj @@ -0,0 +1,11 @@ + + + + net4.7.2 + + + + + + + diff --git a/src/isn/IsnSourceSettings.cs b/src/isn/IsnSourceSettings.cs new file mode 100644 index 0000000..bc2491c --- /dev/null +++ b/src/isn/IsnSourceSettings.cs @@ -0,0 +1,9 @@ +namespace isn +{ + public class IsnSourceSettings + { + internal string Source { get; set; } + + internal string[] Keys { get; set; } + } +} \ No newline at end of file diff --git a/src/isn/IsndErrorMessage.cs b/src/isn/IsndErrorMessage.cs new file mode 100644 index 0000000..fa6b062 --- /dev/null +++ b/src/isn/IsndErrorMessage.cs @@ -0,0 +1,8 @@ +namespace isn +{ + public class IsndErrorMessage + { + public int ecode { get; set; } + public string msg { get; set; } + } +} \ No newline at end of file diff --git a/src/isn/Program.Commands.cs b/src/isn/Program.Commands.cs deleted file mode 100644 index 897d144..0000000 --- a/src/isn/Program.Commands.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; -using Mono.Options; -using Newtonsoft.Json; - -namespace isn -{ - - partial class Program - { - private static void SourceList(IEnumerable sargs) - { - throw new NotImplementedException(); - } - - private static object SourceAdd(IEnumerable str) - { - throw new NotImplementedException(); - } - - private static object Add(IEnumerable str) - { - throw new NotImplementedException(); - } - - private static async Task> PushPkgAsync(IEnumerable pkgs) - { - List pushReports = new List(); - - foreach (string pkg in pkgs) - { - var report = await PushCommand.RunAsync(pkg, source, apiKey); - - pushReports.Add(report); - } - if (storApiKey) - { - EnsureKeyStored(); - } - return pushReports; - } - static OptionSet storeoptions = new OptionSet { - { "s|source=", "use source", val => source = source ?? val }, - { "h|help", "show this message and exit", h => shouldShowPushHelp = h != null }, - }; - private static string _configFileName = - Path.Combine( - Path.Combine(Environment.GetFolderPath( - Environment.SpecialFolder.UserProfile), ".isn"), - "config.json") - ; - - public class IsnSourceSettings - { - internal string Source { get; set; } - - internal string[] Keys { get; set; } - } - public static IEnumerable Sources { get; protected set; } - - private static void StoreApiKey(IEnumerable storeArgs) - { - var args = storeoptions.Parse(storeArgs); - if (shouldShowPushHelp) - { - // output the options - Console.Error.WriteLine("Push Options:"); - storeoptions.WriteOptionDescriptions(Console.Out); - } - else - { - apiKey = args[0]; - EnsureKeyStored(); - } - } - - public static void EnsureKeyStored() - { - if (source == null) return; - - if (Settings.Sources.ContainsKey(source)) - { - if (apiKey == null) - { - // Une suppression - Settings.Sources.Remove(source); - if (Settings.DefaultSource == source) Settings.DefaultSource = null; - } - else - { - // Une mise À jour - string ptd = Protector.Protect(apiKey); - Settings.Sources[source].ApiKey = ptd; - if (Settings.DefaultSource == null) Settings.DefaultSource = source; - } - } - else if (apiKey != null) - { - // une addition - string ptd = Protector.Protect(apiKey); - Settings.Sources.Add(source, new SourceSettings { ApiKey = ptd }); - } - else return; - FileInfo cfgSettingIf = new FileInfo(_configFileName); - if (!cfgSettingIf.Directory.Exists) cfgSettingIf.Directory.Create(); - File.WriteAllText( - cfgSettingIf.FullName, - JsonConvert.SerializeObject( - Settings, - Formatting.Indented - )); - } - - public static void LoadConfig() - { - FileInfo cfgSettingIf = new FileInfo(_configFileName); - if (cfgSettingIf.Exists) - { - var json = File.ReadAllText(cfgSettingIf.FullName); - settings = JsonConvert.DeserializeObject(json); - } - } - } -} \ No newline at end of file diff --git a/src/isn/Program.cs b/src/isn/Program.cs index 6173011..0d9b387 100644 --- a/src/isn/Program.cs +++ b/src/isn/Program.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using Mono.Options; using Newtonsoft.Json; @@ -8,6 +9,29 @@ namespace isn { partial class Program { + + public static IEnumerable Sources { get; protected set; } + + public static void LoadConfig() + { + FileInfo cfgSettingIf = new FileInfo(_configFileName); + if (cfgSettingIf.Exists) + { + var json = File.ReadAllText(cfgSettingIf.FullName); + settings = JsonConvert.DeserializeObject(json); + } + } + static OptionSet storeoptions = new OptionSet { + { "s|source=", "use source", val => source = source ?? val }, + { "h|help", "show this message and exit", h => shouldShowPushHelp = h != null }, + }; + private static string _configFileName = + Path.Combine( + Path.Combine(Environment.GetFolderPath( + Environment.SpecialFolder.UserProfile), ".isn"), + "config.json") + ; + public const string push = "push"; static OptionSet options = new OptionSet { { "h|help", "show this message and exit", h => shouldShowHelp = h != null }, @@ -23,6 +47,9 @@ namespace isn { "h|help", "show this message and exit", h => shouldShowSourceHelp = h != null }, }; + static OptionSet showOptions = new OptionSet { + { "h|help", "show this message and exit", h => shouldShowSourceHelp = h != null }, + }; private static bool shouldShowHelp; private static bool shouldShowSourceHelp; @@ -59,10 +86,37 @@ namespace isn { Run = sargs => SourceList(sargs) }; + + var showconfig = new Command("config") + { + Run = sargs => ShowConfig() + }; + var srcadd = new Command("add") { Run = sargs => SourceAdd(sargs) }; + + var showCommand = new Command("show") + { + Run = sargs => + { + var showCommandSet = new CommandSet("show") + { + showconfig + }; + var pargs = showOptions.Parse(sargs); + if (shouldShowSourceHelp) + { + // output the options + Console.WriteLine("Sources Options:"); + showOptions.WriteOptionDescriptions(Console.Out); + return; + } + showCommandSet.Run(pargs); + } + }; + var srcCmd = new Command("sources") { Run = sargs => @@ -73,6 +127,8 @@ namespace isn srclst, srcadd }; + + var pargs = sourceoptions.Parse(sargs); if (shouldShowSourceHelp) { @@ -116,6 +172,7 @@ namespace isn }; commandSet.Add(setapikey); commandSet.Add(srcCmd); + commandSet.Add(showCommand); List extra; try diff --git a/src/isn/PushCommand.cs b/src/isn/PushCommand.cs index 12e2ea7..7c61b39 100644 --- a/src/isn/PushCommand.cs +++ b/src/isn/PushCommand.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using System.Net; using System.Threading.Tasks; using Newtonsoft.Json; @@ -28,10 +29,16 @@ namespace isn if (source == null) { source = Program.Settings.DefaultSource; - apikey = Program.Settings.Sources[source].ApiKey; + if (apikey is null) if (source!=null) + apikey = Program.Protector.UnProtect(Program.Settings.Sources[source].ApiKey); } + if (apikey is null) if (source!=null) if (Program.Settings.Sources.ContainsKey(source)) - if (apikey is null) apikey = Program.Protector.UnProtect(Program.Settings.Sources[source].ApiKey); + apikey = Program.Protector.UnProtect(Program.Settings.Sources[source].ApiKey); + if (source == null) throw new InvalidOperationException("source is null"); + var resources = await SourceHelpers.GetServerResourcesAsync(source); + if (resources.Resources==null || resources.Resources.Any(res => res.Id == "" )) + throw new InvalidOperationException("Source won't serve the expected push command"); wrqueryHandler.UploadFilesToServer(report, new Uri(source), fi, apikey); } catch (WebException ex) @@ -43,7 +50,7 @@ namespace isn { StreamReader sr = new StreamReader(respStream); string json = sr.ReadToEnd(); - var res = JsonConvert.DeserializeObject(json); + var res = JsonConvert.DeserializeObject(json); // ecode == 1 => package already present server side. report.AlreadyPresent = res.ecode == 1; report.Message = res.msg; diff --git a/src/isn/SourceHelpers.cs b/src/isn/SourceHelpers.cs new file mode 100644 index 0000000..0202937 --- /dev/null +++ b/src/isn/SourceHelpers.cs @@ -0,0 +1,21 @@ +using System.Net.Http; +using System.Threading.Tasks; +using isn.Abstract; +using Newtonsoft.Json; + +namespace isn +{ + public static class SourceHelpers + { + public static async Task GetServerResourcesAsync(string url) + { + HttpClient client = new HttpClient(); + client.DefaultRequestHeaders.Add("content-type","application/json; utf-8"); + using (var indexResponse = await client.GetAsync(url)) + { + var json = await indexResponse.Content.ReadAsStringAsync(); + return JsonConvert.DeserializeObject(json); + } + } + } +} \ No newline at end of file diff --git a/src/isn/UploadFilesToServerUsingWebRequest.cs b/src/isn/UploadFilesToServerUsingWebRequest.cs index 70ea75d..7720390 100644 --- a/src/isn/UploadFilesToServerUsingWebRequest.cs +++ b/src/isn/UploadFilesToServerUsingWebRequest.cs @@ -7,12 +7,7 @@ using Newtonsoft.Json; namespace isn { - public class NugetdErrorMessage - { - public string versionId { get; set; } - public int ecode { get; set; } - public string msg { get; set; } - } + public class UploadFilesToServerUsingWebRequest { internal void UploadFilesToServer(PushReport report, Uri uri, FileInfo fi, diff --git a/src/isn/commands/push.cs b/src/isn/commands/push.cs new file mode 100644 index 0000000..906ca5c --- /dev/null +++ b/src/isn/commands/push.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Newtonsoft.Json; + + +namespace isn +{ + + partial class Program + { + private static async Task> PushPkgAsync(IEnumerable pkgs) + { + List pushReports = new List(); + + foreach (string pkg in pkgs) + { + var report = await PushCommand.RunAsync(pkg, source, apiKey); + + pushReports.Add(report); + } + if (storApiKey) + { + EnsureKeyStored(); + } + return pushReports; + } + + private static object Add(IEnumerable str) + { + throw new NotImplementedException(); + } + + } +} \ No newline at end of file diff --git a/src/isn/commands/set-api-key.cs b/src/isn/commands/set-api-key.cs new file mode 100644 index 0000000..6a54461 --- /dev/null +++ b/src/isn/commands/set-api-key.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Newtonsoft.Json; + + +namespace isn +{ + + partial class Program + { + + private static void StoreApiKey(IEnumerable storeArgs) + { + var args = storeoptions.Parse(storeArgs); + if (shouldShowPushHelp) + { + // output the options + Console.Error.WriteLine("Push Options:"); + storeoptions.WriteOptionDescriptions(Console.Out); + } + else + { + apiKey = args[0]; + EnsureKeyStored(); + } + } + + public static void EnsureKeyStored() + { + if (source == null) return; + + if (Settings.Sources.ContainsKey(source)) + { + if (apiKey == null) + { + // Une suppression + Settings.Sources.Remove(source); + if (Settings.DefaultSource == source) Settings.DefaultSource = null; + } + else + { + // Une mise À jour + string ptd = Protector.Protect(apiKey); + Settings.Sources[source].ApiKey = ptd; + if (Settings.DefaultSource == null) Settings.DefaultSource = source; + } + } + else if (apiKey != null) + { + // une addition + string ptd = Protector.Protect(apiKey); + Settings.Sources.Add(source, new SourceSettings { ApiKey = ptd }); + } + else return; + FileInfo cfgSettingIf = new FileInfo(_configFileName); + if (!cfgSettingIf.Directory.Exists) cfgSettingIf.Directory.Create(); + File.WriteAllText( + cfgSettingIf.FullName, + JsonConvert.SerializeObject( + Settings, + Formatting.Indented + )); + } + } +} \ No newline at end of file diff --git a/src/isn/commands/show.config.cs b/src/isn/commands/show.config.cs new file mode 100644 index 0000000..f3a347f --- /dev/null +++ b/src/isn/commands/show.config.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + + +namespace isn +{ + + partial class Program + { + + private static void ShowConfig() + { + Console.WriteLine(JsonConvert.SerializeObject(Settings)); + + } + + } +} \ No newline at end of file diff --git a/src/isn/commands/sources.add.cs b/src/isn/commands/sources.add.cs new file mode 100644 index 0000000..90d2aed --- /dev/null +++ b/src/isn/commands/sources.add.cs @@ -0,0 +1,25 @@ + +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace isn +{ + + partial class Program + { + private static void SourceAdd(IEnumerable str) + { + foreach (string arg in str) + { + if (Settings.Sources.ContainsKey(arg)) + { + SourceSettings setting = Settings.Sources[arg]; + throw new InvalidOperationException + (setting.Alias); + } + throw new NotImplementedException(); + } + } + } +} \ No newline at end of file diff --git a/src/isn/commands/sources.list.cs b/src/isn/commands/sources.list.cs new file mode 100644 index 0000000..d25c683 --- /dev/null +++ b/src/isn/commands/sources.list.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; + + +namespace isn +{ + + partial class Program + { + private static void SourceList(IEnumerable sargs) + { + IEnumerable spec = sargs.Count()>0 ? sargs : Settings.Sources.Keys; + foreach (string arg in spec) + { + SourceSettings setting = Settings.Sources[arg]; + Console.WriteLine(JsonConvert.SerializeObject(setting)); + } + } + + } +} \ No newline at end of file diff --git a/src/isn/isn.1.0.0.nupkg b/src/isn/isn.1.0.0.nupkg deleted file mode 100644 index 39ff9a76f513ae82fef0cca41cdf9d5cb849c03b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10522 zcmcI~Ra70#wlxXv?jAI_Zrt5nf&})4jk~+My9Rf6cXuavaQEN@2tViPJNNwOKHlz8 zy;gURSvA(|Sr5I&RF;E;!h(Q+fP-i++*h@os&+>F1OajJF%UnV8aRNh9GRK^bxn?+ zu^3=M3cd11*z??@R5&-LWE5zuwLC%Oj!8)S>07%|-}Q!cmJ3E|E{N+^`jcn#Xv4G* z^QoypfU*7uM(ud?+O$B|u=%gqUoJnhw!at=^htP9hS#kuP)WY`rijF($JqM34#=FU-Y^BA@}dUi@XF1t9?E#M__ zzOu01oTL0dILl{diQf6(%IAYKgpX+MXv1XV>}Urza*h*G9ArU~cyx@Q^*lu(M3ZF~ z&7evRBXT8}qb64jX(L388N?oqO92jyKf7-&we$!I{@kgb+?5a4zYg4R?ZVn;)jm=R zWN`2FOoHuFo7=A7i7&O83H;#@qXZF!$r#cx1VkVj-T-Rnx}QO`UOfujp>88e^9W2J5ao z8jK1j134xI-!`i|PL)bM$XR4AE5>xt%++EZ(PmlYZ89CjK(_Vvr(#RMWNGuPZuz_C zMbq-;%Vb!0#pP#g2)(E0YcanP5y6g~#2kJf(TN`H02;5FN;jRm?s|~j7qCP_F{=$V zb-|c8wb6clfyd&HadEZu<4rNhIT<7QSS|G@tySJXkDu-kurvPN`M!#XT)CHq`kAFj zx=~%sp+l*>5;av7w12rMmZInAR+>Li**PxxRQ@DX!hrLt7w&=Tzo@&H?Heb;;B%$p z*SFPAG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}vN&O`FXa6D-ILWJ~;OO3|P7H_#~ zOZ9B{PkxH3z>OSTW2=@>UP*y@0N)v=rqW@My&l(Dfm+$Lv1&_gpiy{Z(Rv_=O5s*p zjisw>^5LO49}~^imX5n=FCXfG^!+5&7x(u{wNldS`;2ez(fj9rY$*ToFl7Xz*iU`f zPbNP6IG7(%SIpMN32ftJpzdx5cGPEbv$o2L7qI#8G6g^W5S`Uoao~lL0P=~=6W)FP ztgtR>9f5Yz+vc5=QzpESPw~6!vD^RNCyU0hpOReFs09p0#u#Lpon4W5*`2yvS9o(b z!AfkPj3(B2{>9^uZpsWcE|mY1W>WJkA83SX;3NE~qrnFok0pcHWwYX9B=0@A$()!G z%bD20yFLxwD(Frz2VqoSmjD8vGXLId+zZI6(wj1X# z@7Yo|nXSQ2Kx3d2klD!A0nBLUU~30PTL+gH_Py2x#HMeLH!0t_=Lu_in*Y%}xJWUuzy5PN= zQbBF~1o^>}p@Vd6H_7xEGAdc8NF*%u)90b4IEx&ZqIKlrzJLdeYUIjjre1D%9QXKo z_P&MfZ9P_sLRy88rd7;7c;mQ0hm;_0N|6y~Lx-1|ToK;GvGEuU4eaXt5H11~v72r$ zpB>oIRbjfbwB6Zq-e7CP$TziQDVMeV$<^UJ!`IOVWxgRw*byklsKrF&2%AQ~2Q*oz z9DB$~b1_6s6ZkgT##V@lXoeqKgk3K@T#Is*MRGe@UtBSek{=?SRmx?o;TBE(LgAmg zmuAtYlL7tnK~5v>*{o+Ng7jD9Hq%ZTf&pg*Er2Qbn696tu{INv$uO$WMeGb`1(Gf&b}D`v=AGp^$%kYX6S=Z$_?vZ~`By`u}ZR x|BnA}JMbU;AmxAEkN-Kre~S2@3Hqu24 + Exe - net472 + net6 nuget_cli 45b74c62-05bc-4603-95b4-3e80ae2fdf50 1.0.1 @@ -9,10 +10,16 @@ WTFPL true + - - - - - + + + + + + + + + + diff --git a/src/isnd/Constants.cs b/src/isnd/Constants.cs index 0f1d372..f748334 100644 --- a/src/isnd/Constants.cs +++ b/src/isnd/Constants.cs @@ -1,6 +1,6 @@ namespace isnd { - public static class Constants + public static class IsndConstants { public const string AdministratorRoleName = "Admin"; public const string RequireAdminPolicyName = "RequireAdministratorRole"; diff --git a/src/isnd/Controllers/AccountController.cs b/src/isnd/Controllers/AccountController.cs index 2b728c7..e367166 100644 --- a/src/isnd/Controllers/AccountController.cs +++ b/src/isnd/Controllers/AccountController.cs @@ -245,9 +245,9 @@ namespace isnd.Controllers { var user = await _userManager.FindByNameAsync(username); var roles = await _userManager.GetRolesAsync(user); - if (!roles.Contains(Constants.AdministratorRoleName)) + if (!roles.Contains(IsndConstants.AdministratorRoleName)) { - await _userManager.AddToRoleAsync(user, Constants.AdministratorRoleName); + await _userManager.AddToRoleAsync(user, IsndConstants.AdministratorRoleName); } return Ok(); diff --git a/src/isnd/Controllers/NewUpdateController.cs b/src/isnd/Controllers/NewUpdateController.cs index f223178..3cead90 100644 --- a/src/isnd/Controllers/NewUpdateController.cs +++ b/src/isnd/Controllers/NewUpdateController.cs @@ -9,7 +9,7 @@ namespace isnd.Controllers // TODO Web hook CI public class NewUpdateController : Controller { - [Authorize(Policy = Constants.RequireAdminPolicyName)] + [Authorize(Policy = IsndConstants.RequireAdminPolicyName)] public IActionResult NewRelease(NewReleaseInfo version) { throw new NotImplementedException("web hook"); diff --git a/src/isnd/Controllers/PackagesController.cs b/src/isnd/Controllers/PackagesController.cs index ba49932..3ba324d 100644 --- a/src/isnd/Controllers/PackagesController.cs +++ b/src/isnd/Controllers/PackagesController.cs @@ -15,6 +15,7 @@ using isnd.Services; using isnd.ViewModels; using System.Threading.Tasks; using isnd.Interfaces; +using isn.Abstract; namespace isnd.Controllers { @@ -54,7 +55,7 @@ namespace isnd.Controllers [HttpGet(_pkgRootPrefix + ApiConfig.Base)] public IActionResult ApiIndex() { - return Ok(new { version = "3.0.0", resources = _resources }); + return Ok(new ApiIndexViewModel{ Version = "3.0.0", Resources = _resources }); } // GET /autocomplete?id=isn.protocol&prerelease=true diff --git a/src/isnd/Interfaces/IPackageManager.cs b/src/isnd/Interfaces/IPackageManager.cs index 1db467d..746027e 100644 --- a/src/isnd/Interfaces/IPackageManager.cs +++ b/src/isnd/Interfaces/IPackageManager.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; +using isn.Abstract; using isnd.Controllers; using isnd.Data; using isnd.Data.Catalog; diff --git a/src/isnd/Services/PackageManager.cs b/src/isnd/Services/PackageManager.cs index 5ff78c1..0f251df 100644 --- a/src/isnd/Services/PackageManager.cs +++ b/src/isnd/Services/PackageManager.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using isn.abst; +using isn.Abstract; using isnd.Controllers; using isnd.Data; using isnd.Data.Catalog; @@ -41,7 +43,7 @@ namespace isnd.Services new Resource { Id = extUrl + ApiConfig.Publish, - Type = "PackagePublish/2.0.0", + Type = Constants.PublishCommandId, Comment = "Package Publish service" }); // under dev, only leash in release mode diff --git a/src/isnd/Startup.cs b/src/isnd/Startup.cs index 57e086f..6b665cc 100644 --- a/src/isnd/Startup.cs +++ b/src/isnd/Startup.cs @@ -58,9 +58,9 @@ namespace isnd services.AddAuthorization(options => { - options.AddPolicy(Constants.RequireAdminPolicyName, - policy => policy.RequireRole(Constants.AdministratorRoleName)); - options.AddPolicy(Constants.RequireValidApiKey, policy => + options.AddPolicy(IsndConstants.RequireAdminPolicyName, + policy => policy.RequireRole(IsndConstants.AdministratorRoleName)); + options.AddPolicy(IsndConstants.RequireValidApiKey, policy => policy.Requirements.Add(new ValidApiKeyRequirement())); }) diff --git a/src/isnd/isnd.csproj b/src/isnd/isnd.csproj index 8c556fe..1486e9b 100644 --- a/src/isnd/isnd.csproj +++ b/src/isnd/isnd.csproj @@ -25,6 +25,10 @@ + + + + diff --git a/test/isn.tests/Engine.cs b/test/isn.tests/Engine.cs deleted file mode 100644 index 74627c5..0000000 --- a/test/isn.tests/Engine.cs +++ /dev/null @@ -1,17 +0,0 @@ -using static isn.tests.Tests; - -namespace isn.tests -{ - internal class Engine : INeedEngine - { - public Engine() - { - - } - - public object Parse(string code) - { - throw new System.NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/test/isn.tests/IBody.cs b/test/isn.tests/IBody.cs deleted file mode 100644 index 2869069..0000000 --- a/test/isn.tests/IBody.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace isn.tests -{ - internal interface IBody - { - /// - /// The mult - /// - /// - T Action(T v); - - } -} \ No newline at end of file diff --git a/test/isn.tests/IRing.cs b/test/isn.tests/IRing.cs deleted file mode 100644 index 026a637..0000000 --- a/test/isn.tests/IRing.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace isn.tests -{ - internal interface IRing : IBody - { - - - IRing Add(IRing other); - IRing Mult(TBody v); - } - -} \ No newline at end of file diff --git a/test/isn.tests/Ring.cs b/test/isn.tests/Ring.cs deleted file mode 100644 index 0089db7..0000000 --- a/test/isn.tests/Ring.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace isn.tests -{ - internal class Body : IBody - { - static public Ring One { get ;} - - public T Action(T v) - { - throw new System.NotImplementedException(); - } - - } - internal class Ring : Body, IRing - { - public static IRing Zero => throw new System.NotImplementedException(); - - - public IRing Add(IRing unity) - { - throw new System.NotImplementedException(); - } - - public IRing Mult(TBody v) - { - throw new System.NotImplementedException(); - } - - } -} \ No newline at end of file diff --git a/test/isn.tests/UnitTest1.cs b/test/isn.tests/UnitTest1.cs index c52b45d..92bb565 100644 --- a/test/isn.tests/UnitTest1.cs +++ b/test/isn.tests/UnitTest1.cs @@ -1,25 +1,14 @@ using System; +using System.Data; using System.IO; -using System.Text; +using System.Xml; using NUnit.Framework; namespace isn.tests { public class Tests { - private const int V = 0; - private const int V1 = 1; - - public interface INeedEngine - { - object Parse(string code); - - } - - [SetUp] - public void Setup() - { - } + private DataRow dataRow; [Test] public void HAveADefaultDataProtector() @@ -32,43 +21,19 @@ namespace isn.tests Assert.AreEqual(pass, unprotectedpass); Assert.Pass($"Good jod man! (decoding {protectedpass})"); } - - // Not a [Test] - public void TestParseCplus() - { - INeedEngine engine = new Engine(); - IRing c = new Ring(); - Assert.Equals((INeedEngine)engine.Parse("c+"), c.Add(Ring.One)); - } - - public void AssertIRingIsABody() - { - Ring c = new Ring(); - Ring one = Ring.One; - Assert.True(c.Mult(one).Equals(c)); - } - - public void AssertIRingIsARing() - { - AssertIRingIsABody(); - Ring c = new Ring(); - IRing zero = Ring.Zero; - Assert.True(c.Add(zero).Equals(c)); - } - [Test] - public void AssertReadInput() + public void Test() { - var oldOut = Console.Out; - StringBuilder censoredTxt = new StringBuilder(); - var newOut = new StringWriter(censoredTxt); - Console.SetOut(newOut); - Console.WriteLine("~~censored~~"); - Console.SetOut(oldOut); - Console.Write("Hello "); - Console.Write(censoredTxt); - } + System.Data.DataTable dataTable = new System.Data.DataTable(); +dataTable.Columns.Add(new DataColumn("x")); +dataTable.Columns.Add(new DataColumn("y")); +dataRow = dataTable.NewRow(); +dataRow[0]= 1; +dataRow[1]= 2; +dataTable.Rows.Add(dataRow); + + } } } \ No newline at end of file diff --git a/test/isn.tests/isn.tests.csproj b/test/isn.tests/isn.tests.csproj index 3ac8d60..e5bb5fd 100644 --- a/test/isn.tests/isn.tests.csproj +++ b/test/isn.tests/isn.tests.csproj @@ -1,7 +1,7 @@ - netcoreapp2.1 + net6 false diff --git a/test/isnd.tests/UnitTestWebHost.cs b/test/isnd.tests/UnitTestWebHost.cs index 407fd0e..9b92b3a 100644 --- a/test/isnd.tests/UnitTestWebHost.cs +++ b/test/isnd.tests/UnitTestWebHost.cs @@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using System.Collections.Generic; namespace isnd.host.tests { @@ -38,11 +39,21 @@ namespace isnd.host.tests } } } - + public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup() .Build(); + + private class Butts: List + { + public bool Im12 { get; set; } + } + + private class Butt + { + public bool Im12 { get; set; } + } } } diff --git a/test/isnd.tests/isnd.tests.csproj b/test/isnd.tests/isnd.tests.csproj index 786d7e6..1bcc331 100644 --- a/test/isnd.tests/isnd.tests.csproj +++ b/test/isnd.tests/isnd.tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + net6 false d7144e46-4e63-4391-ba86-64b61f6e7be4 @@ -28,7 +28,7 @@