diff options
author | TrueKuehli <rctcoaster2000@hotmail.de> | 2018-09-27 21:04:16 +0200 |
---|---|---|
committer | TrueKuehli <rctcoaster2000@hotmail.de> | 2018-09-27 21:04:16 +0200 |
commit | 5a317ff78acfd18ca586b763817e0810d030ca08 (patch) | |
tree | 1a1a96cd68d001c17fdc14034a50090461da335e /DSACore | |
parent | 3fa656c782c9235e354f1d7e53f40865ea482eaa (diff) | |
parent | 39da0da55a09a56bae3c250e6108c8edf77bfbfd (diff) |
Merge branch 'WebApi' of https://github.com/TrueDoctor/DiscoBot into WebApi
Diffstat (limited to 'DSACore')
-rw-r--r-- | DSACore/DSA_Game/Dsa.cs | 8 | ||||
-rw-r--r-- | DSACore/DSA_Game/Save/Properties.cs | 2 | ||||
-rw-r--r-- | DSACore/Program.cs | 3 | ||||
-rw-r--r-- | DSACore/Properties/PublishProfiles/FolderProfile.pubxml | 22 | ||||
-rw-r--r-- | DSACore/Properties/PublishProfiles/FolderProfile1.pubxml | 23 | ||||
-rw-r--r-- | DSACore/Properties/launchSettings.json | 2 | ||||
-rw-r--r-- | DSACore/Startup.cs | 11 |
7 files changed, 66 insertions, 5 deletions
diff --git a/DSACore/DSA_Game/Dsa.cs b/DSACore/DSA_Game/Dsa.cs index ff74788..7258e8c 100644 --- a/DSACore/DSA_Game/Dsa.cs +++ b/DSACore/DSA_Game/Dsa.cs @@ -13,6 +13,8 @@ namespace DSACore.DSA_Game public static class Dsa { + public const string rootPath = "DiscoBot\\DSACore\\"; + private static Session s_session; public static List<ICharacter> Chars { get; set; } = new List<ICharacter>(); // list of all characters @@ -37,6 +39,8 @@ namespace DSACore.DSA_Game } } + public static void start(){} + public static void Startup() { //new .Auxiliary.Calculator.StringSolver("1d100 - (1d200 + 1) * -50000").Solve(); @@ -49,8 +53,8 @@ namespace DSACore.DSA_Game .Where(c => !Talente.Exists(v => v.Name.Equals(c.Name))).ToList().ForEach(v => Talente.Add(v)); } - Properties.Deserialize(); - Properties.Serialize(); + Properties.Deserialize(rootPath+"Properties"); + Properties.Serialize(rootPath + "Properties"); Talente = Talente.OrderBy(x => x.Name).ToList(); Session = new Session diff --git a/DSACore/DSA_Game/Save/Properties.cs b/DSACore/DSA_Game/Save/Properties.cs index f201431..caed278 100644 --- a/DSACore/DSA_Game/Save/Properties.cs +++ b/DSACore/DSA_Game/Save/Properties.cs @@ -35,7 +35,7 @@ namespace DSACore.DSA_Game.Save set => objects["Sound"] = value; } - public static void Deserialize(string path = /*@"..\.."*/@"Properties") + public static void Deserialize(string path = @"Properties") { var files = Directory.GetFiles(path, "*.json"); diff --git a/DSACore/Program.cs b/DSACore/Program.cs index 373a39e..2b2f938 100644 --- a/DSACore/Program.cs +++ b/DSACore/Program.cs @@ -14,9 +14,10 @@ namespace DSACore { public static void Main(string[] args) { + DSA_Game.Dsa.Startup(); CreateWebHostBuilder(args).Build().Run(); } - + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>(); diff --git a/DSACore/Properties/PublishProfiles/FolderProfile.pubxml b/DSACore/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..622bb03 --- /dev/null +++ b/DSACore/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Diese Datei wird vom Veröffentlichungs-/Paketierungsprozess Ihres Webprojekts verwendet. Sie können das Verhalten dieses Prozesses anpassen, +indem Sie diese MSBuild-Datei bearbeiten. Weitere Informationen hierzu finden Sie unter https://go.microsoft.com/fwlink/?LinkID=208121. +--> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <WebPublishMethod>FileSystem</WebPublishMethod> + <PublishProvider>FileSystem</PublishProvider> + <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> + <LastUsedPlatform>Any CPU</LastUsedPlatform> + <SiteUrlToLaunchAfterPublish /> + <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> + <ExcludeApp_Data>False</ExcludeApp_Data> + <TargetFramework>netcoreapp2.1</TargetFramework> + <ProjectGuid>35a5e2cc-0fd4-4bc0-acbf-38599caed1c4</ProjectGuid> + <SelfContained>false</SelfContained> + <_IsPortable>true</_IsPortable> + <publishUrl>bin\Release\netcoreapp2.1\publish\</publishUrl> + <DeleteExistingFiles>False</DeleteExistingFiles> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/DSACore/Properties/PublishProfiles/FolderProfile1.pubxml b/DSACore/Properties/PublishProfiles/FolderProfile1.pubxml new file mode 100644 index 0000000..e929098 --- /dev/null +++ b/DSACore/Properties/PublishProfiles/FolderProfile1.pubxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Diese Datei wird vom Veröffentlichungs-/Paketierungsprozess Ihres Webprojekts verwendet. Sie können das Verhalten dieses Prozesses anpassen, +indem Sie diese MSBuild-Datei bearbeiten. Weitere Informationen hierzu finden Sie unter https://go.microsoft.com/fwlink/?LinkID=208121. +--> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <WebPublishMethod>FileSystem</WebPublishMethod> + <PublishProvider>FileSystem</PublishProvider> + <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> + <LastUsedPlatform>Any CPU</LastUsedPlatform> + <SiteUrlToLaunchAfterPublish /> + <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> + <ExcludeApp_Data>False</ExcludeApp_Data> + <TargetFramework>netcoreapp2.1</TargetFramework> + <RuntimeIdentifier>win-x64</RuntimeIdentifier> + <ProjectGuid>35a5e2cc-0fd4-4bc0-acbf-38599caed1c4</ProjectGuid> + <SelfContained>false</SelfContained> + <_IsPortable>true</_IsPortable> + <publishUrl>bin\Release\netcoreapp2.1\publish\</publishUrl> + <DeleteExistingFiles>False</DeleteExistingFiles> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/DSACore/Properties/launchSettings.json b/DSACore/Properties/launchSettings.json index bcc4406..2da5fec 100644 --- a/DSACore/Properties/launchSettings.json +++ b/DSACore/Properties/launchSettings.json @@ -21,7 +21,7 @@ "commandName": "Project", "launchBrowser": true, "launchUrl": "api/commands", - "applicationUrl": "https://localhost:5001;http://localhost:5000", + "applicationUrl": "https://0.0.0.0:5001;http://0.0.0.0:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/DSACore/Startup.cs b/DSACore/Startup.cs index 2d0c2a3..0628151 100644 --- a/DSACore/Startup.cs +++ b/DSACore/Startup.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.Mvc; +using DSACore.Hubs; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -25,7 +26,15 @@ namespace DSACore // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + services.AddCors(options => + { + options.AddPolicy("AllowSpecificOrigin", + builder => builder.WithOrigins("https://console.firebase.google.com/project/heldenonline-4d828")); + }); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + + services.AddSignalR(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -40,6 +49,8 @@ namespace DSACore app.UseHsts(); } + app.UseSignalR(routes => { routes.MapHub<ChatHub>("/chatHub"); }); + app.UseCors("AllowSpecificOrigin"); app.UseHttpsRedirection(); app.UseMvc(); } |