Fix Restsharp / Move to Postgresql

This commit is contained in:
2023-07-12 05:06:18 +02:00
parent d379a43eb4
commit 99257c3422
19 changed files with 206 additions and 144 deletions

View File

@@ -0,0 +1,17 @@
using System.Text;
using Microsoft.EntityFrameworkCore.Storage;
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal;
namespace LaDOSE.Api;
public class NpgsqlSqlGenerationLowercaseHelper : NpgsqlSqlGenerationHelper
{
static string ToLowerCase(string input) => input.ToLower();
public NpgsqlSqlGenerationLowercaseHelper(RelationalSqlGenerationHelperDependencies dependencies)
: base(dependencies) { }
public override string DelimitIdentifier(string identifier)
=> base.DelimitIdentifier(ToLowerCase(identifier));
public override void DelimitIdentifier(StringBuilder builder, string identifier)
=> base.DelimitIdentifier(builder, ToLowerCase(identifier));
}

View File

@@ -15,8 +15,8 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.8" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,28 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using LaDOSE.Business.Interface;
using LaDOSE.Business.Provider;
using LaDOSE.Business.Service;
using LaDOSE.Entity;
using LaDOSE.Entity.Context;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
//using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using Pomelo.EntityFrameworkCore.MySql;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
using AutoMapper;
using LaDOSE.Api.Helpers;
using LaDOSE.Business.Helper;
@@ -32,6 +23,7 @@ using LaDOSE.Entity.Challonge;
using LaDOSE.Entity.Wordpress;
using Result = LaDOSE.Entity.Challonge.Result;
using LaDOSE.Entity.BotEvent;
using Microsoft.EntityFrameworkCore.Storage;
namespace LaDOSE.Api
{
@@ -82,9 +74,7 @@ namespace LaDOSE.Api
// ));
services.AddDbContextPool<LaDOSEDbContext>(options =>
{
options.UseMySql(
$"Server={MySqlServer};Database={MySqlDatabase};User={MySqlUser};Password={MySqlPassword};",
new MariaDbServerVersion(new Version(10, 1)));
options.UseNpgsql(Configuration.GetConnectionString("DbContext")).ReplaceService<ISqlGenerationHelper,NpgsqlSqlGenerationLowercaseHelper>();
});
var key = Encoding.ASCII.GetBytes(this.Configuration["JWTTokenSecret"]);

View File

@@ -4,20 +4,24 @@
"Default": "Warning"
}
},
"ConnectionStrings": {
"DbContext":"Host=descartes.local;Username=tom;Password=tom;Database=ladoseapi"
},
"CertificateSettings": {
"fileName": "localhost.pfx",
"password": "YourSecurePassword"
},
"MySql": {
"Server": "host",
"Database": "database",
"User": "User",
"Password": "Password"
"Server": "localhost",
"Database": "ladoseapi",
"User": "dev",
"Password": "dev"
},
"ApiKey": {
"ChallongeApiKey": "Challonge ApiKey"
"ChallongeApiKey": "Challonge ApiKey",
"SmashApiKey": "Smash"
},
"AllowedHosts": "*",
"AllowedHosts": "0.0.0.0",
"Port": 5000,
"JWTTokenSecret": "here goes the custom Secret key for authnetication"
}

View File

@@ -5,4 +5,8 @@
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>

View File

@@ -12,6 +12,7 @@
<PackageReference Include="DSharpPlus.Interactivity" Version="4.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>

View File

@@ -34,13 +34,6 @@ namespace LaDOSE.DiscordBot.Service
}
private void CheckToken()
{
}
public String GetInscrits()
{

View File

@@ -39,6 +39,8 @@ namespace LaDOSE.Entity.Context
public LaDOSEDbContext(DbContextOptions options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{

View File

@@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.2" />
</ItemGroup>

View File

@@ -6,7 +6,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RestSharp" Version="106.11.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RestSharp" Version="110.2.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -2,9 +2,10 @@
using System.Collections.Generic;
using LaDOSE.DTO;
using LaDOSE.REST.Event;
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Authenticators;
using RestSharp.Serialization.Json;
namespace LaDOSE.REST
{
@@ -29,33 +30,29 @@ namespace LaDOSE.REST
public void Connect(Uri url, string user, string password)
{
Client = new RestClient(url);
string token = GetToken(user, password);
Client = new RestClient(url, options =>
{
#if DEBUG
Client.Timeout = 999*1000;
options.MaxTimeout = Int32.MaxValue;
#endif
options.Authenticator = new JwtAuthenticator("token");
});
this.username = user;
this.password = password;
GetToken(user, password);
}
private void GetToken(string user, string password)
private string GetToken(string user, string password)
{
var restRequest = new RestRequest("users/auth", Method.POST);
var restRequest = new RestRequest("users/auth", Method.Post);
restRequest.AddJsonBody(new {username = user, password = password});
var response = Client.Post(restRequest);
if (response.IsSuccessful)
{
JsonDeserializer d = new JsonDeserializer();
var applicationUser = d.Deserialize<ApplicationUserDTO>(response);
this.Auth = applicationUser;
Client.Authenticator = new JwtAuthenticator($"{applicationUser.Token}");
RaiseUpdatedJwtEvent(new UpdatedJwtEventHandler(this.Auth));
}
else
{
throw new Exception("unable to contact services");
}
var response = Client.Post<ApplicationUserDTO>(restRequest);
//var applicationUser = JsonConvert.DeserializeObject<ApplicationUserDTO>(response.Content);
this.Auth = response;
return response.Token;
}
private void RaiseUpdatedJwtEvent(UpdatedJwtEventHandler auth)
@@ -75,120 +72,122 @@ namespace LaDOSE.REST
}
}
#region PostFix
private T Post<T>(string resource,T entity)
{
var json = new RestSharp.Serialization.Json.JsonSerializer();
var jsonD = new RestSharp.Serialization.Json.JsonDeserializer();
var request = new RestRequest();
request.Method = Method.POST;
request.Resource = resource;
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-type", "application/json");
request.Parameters.Clear();
request.AddParameter("application/json; charset=utf-8", json.Serialize(entity), ParameterType.RequestBody);
request.AddObject(entity);
var response = Client.Execute(request);
//var content = response.Content; // raw content as string
try
{
return jsonD.Deserialize<T>(response);
}
catch (Exception)
{
return default(T);
}
}
private R Post<P,R>(string resource, P entity)
{
var json = new RestSharp.Serialization.Json.JsonSerializer();
var jsonD = new RestSharp.Serialization.Json.JsonDeserializer();
var request = new RestRequest();
request.Method = Method.POST;
request.Resource = resource;
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-type", "application/json");
request.Parameters.Clear();
request.AddParameter("application/json; charset=utf-8", json.Serialize(entity), ParameterType.RequestBody);
//request.AddObject(entity);
var response = Client.Execute(request);
//var content = response.Content; // raw content as string
try
{
return jsonD.Deserialize<R>(response);
}
catch (Exception)
{
return default(R);
}
}
#endregion
// #region PostFix
//
// private T Post<T>(string resource,T entity)
// {
// var json = new RestSharp.Serialization.Json.JsonSerializer();
// var jsonD = new RestSharp.Serialization.Json.JsonDeserializer();
// var request = new RestRequest();
// request.Method = Method.Post;
// request.Resource = resource;
// request.AddHeader("Accept", "application/json");
// request.AddHeader("Content-type", "application/json");
// request.Parameters.Clear();
// request.AddParameter("application/json; charset=utf-8", json.Serialize(entity), ParameterType.RequestBody);
// request.AddObject(entity);
// var response = Client.Execute(request);
// //var content = response.Content; // raw content as string
// try
// {
// return jsonD.Deserialize<T>(response);
// }
// catch (Exception)
// {
// return default(T);
// }
//
//
// }
// private R Post<P,R>(string resource, P entity)
// {
// var json = new RestSharp.Serialization.Json.JsonSerializer();
// var jsonD = new RestSharp.Serialization.Json.JsonDeserializer();
// var request = new RestRequest();
// request.Method = Method.Post;
// request.Resource = resource;
// request.AddHeader("Accept", "application/json");
// request.AddHeader("Content-type", "application/json");
// request.Parameters.Clear();
// request.AddParameter("application/json; charset=utf-8", json.Serialize(entity), ParameterType.RequestBody);
// //request.AddObject(entity);
// var response = Client.Execute(request);
// //var content = response.Content; // raw content as string
// try
// {
// return jsonD.Deserialize<R>(response);
// }
// catch (Exception)
// {
// return default(R);
// }
//
//
// }
//
// #endregion
#region WordPress
public List<WPEventDTO> GetEvents()
{
CheckToken();
var restRequest = new RestRequest("/api/wordpress/WPEvent", Method.GET);
var restRequest = new RestRequest("/api/wordpress/WPEvent", Method.Get);
var restResponse = Client.Get<List<WPEventDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public WPEventDTO GetNextEvent()
{
CheckToken();
var restRequest = new RestRequest("/api/wordpress/NextEvent", Method.GET);
var restRequest = new RestRequest("/api/wordpress/NextEvent", Method.Get);
var restResponse = Client.Get<WPEventDTO>(restRequest);
return restResponse.Data;
return restResponse;
}
public string GetLastChallonge()
{
CheckToken();
var restRequest = new RestRequest($"/api/wordpress/GetLastChallonge/", Method.GET);
var restRequest = new RestRequest($"/api/wordpress/GetLastChallonge/", Method.Get);
var restResponse = Client.Get(restRequest);
return restResponse.Content;
}
public string CreateChallonge(int gameId, int eventId)
{
CheckToken();
var restRequest = new RestRequest($"/api/wordpress/CreateChallonge/{gameId}/{eventId}", Method.GET);
var restRequest = new RestRequest($"/api/wordpress/CreateChallonge/{gameId}/{eventId}", Method.Get);
var restResponse = Client.Get(restRequest);
return restResponse.Content;
}
public string CreateChallonge2(int gameId, int eventId, List<WPUserDTO> optionalPlayers)
{
CheckToken();
var restResponse = Post<List<WPUserDTO>,string>($"/api/wordpress/CreateChallonge/{gameId}/{eventId}",optionalPlayers);
RestRequest r =
new RestRequest($"/api/wordpress/CreateChallonge/{gameId}/{eventId}").AddJsonBody(optionalPlayers);
var restResponse = Client.Post<string>(r);
return restResponse;
}
public bool RefreshDb()
{
CheckToken();
var restRequest = new RestRequest("/api/Wordpress/UpdateDb", Method.GET);
var restRequest = new RestRequest("/api/Wordpress/UpdateDb", Method.Get);
var restResponse = Client.Get<bool>(restRequest);
return restResponse.Data;
return restResponse;
}
public List<WPUserDTO> GetUsers(int wpEventId, int gameId)
{
CheckToken();
var restRequest = new RestRequest($"/api/Wordpress/GetUsers/{wpEventId}/{gameId}", Method.GET);
var restRequest = new RestRequest($"/api/Wordpress/GetUsers/{wpEventId}/{gameId}", Method.Get);
var restResponse = Client.Get<List<WPUserDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public List<WPUserDTO> GetUsersOptions(int wpEventId, int gameId)
{
CheckToken();
var restRequest = new RestRequest($"/api/Wordpress/GetUsersOptions/{wpEventId}/{gameId}", Method.GET);
var restRequest = new RestRequest($"/api/Wordpress/GetUsersOptions/{wpEventId}/{gameId}", Method.Get);
var restResponse = Client.Get<List<WPUserDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
@@ -198,20 +197,21 @@ namespace LaDOSE.REST
public List<GameDTO> GetGames()
{
CheckToken();
var restRequest = new RestRequest("/api/Game", Method.GET);
var restRequest = new RestRequest("/api/Game", Method.Get);
var restResponse = Client.Get<List<GameDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public GameDTO UpdateGame(GameDTO game)
{
CheckToken();
return Post("Api/Game", game);
RestRequest r = new RestRequest("Api/Game").AddJsonBody(game);
return Client.Post<GameDTO>(r);
}
public bool DeleteGame(int gameId)
{
CheckToken();
var restRequest = new RestRequest($"/api/Game/{gameId}", Method.DELETE);
var restRequest = new RestRequest($"/api/Game/{gameId}", Method.Delete);
var restResponse = Client.Execute(restRequest);
return restResponse.IsSuccessful;
}
@@ -227,26 +227,27 @@ namespace LaDOSE.REST
public List<TodoDTO> GetTodos()
{
CheckToken();
var restRequest = new RestRequest("/api/Todo", Method.GET);
var restRequest = new RestRequest("/api/Todo", Method.Get);
var restResponse = Client.Get<List<TodoDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public TodoDTO GetTodoById(int id)
{
CheckToken();
var restRequest = new RestRequest($"/api/Todo/{id}", Method.GET);
var restRequest = new RestRequest($"/api/Todo/{id}", Method.Get);
var restResponse = Client.Get<TodoDTO>(restRequest);
return restResponse.Data;
return restResponse;
}
public TodoDTO UpdateTodo(TodoDTO Todo)
{
CheckToken();
return Post("Api/Todo", Todo);
var restRequest = new RestRequest($"/api/Todo/", Method.Post).AddJsonBody(Todo);
return Client.Post<TodoDTO>(restRequest);
}
public bool DeleteTodo(int todoId)
{
CheckToken();
var restRequest = new RestRequest($"/api/Todo/{todoId}", Method.DELETE);
var restRequest = new RestRequest($"/api/Todo/{todoId}", Method.Delete);
var restResponse = Client.Execute(restRequest);
return restResponse.IsSuccessful;
}
@@ -258,9 +259,9 @@ namespace LaDOSE.REST
public TournamentsResultDTO Test(string test)
{
CheckToken();
var restRequest = new RestRequest($"Api/Test/Test/{test}", Method.GET);
var restRequest = new RestRequest($"Api/Test/Test/{test}", Method.Get);
var restResponse = Client.Get<TournamentsResultDTO>(restRequest);
return restResponse.Data;
return restResponse;
}
@@ -270,14 +271,17 @@ namespace LaDOSE.REST
public List<TournamentDTO> GetTournaments(TimeRangeDTO timeRange)
{
CheckToken();
List<TournamentDTO> tournamentDtos = Post<TimeRangeDTO, List<TournamentDTO>>("/api/Tournament/GetTournaments",timeRange);
RestRequest r = new RestRequest("/api/Tournament/GetTournaments").AddJsonBody(timeRange);
List<TournamentDTO> tournamentDtos = Client.Post<List<TournamentDTO>>(r);
return tournamentDtos;
}
public TournamentsResultDTO GetResults(List<int> ids)
{
CheckToken();
return Post<List<int>,TournamentsResultDTO>("Api/Tournament/GetResults", ids);
var restRequest = new RestRequest("Api/Tournament/GetResults", Method.Post).AddJsonBody(ids);
return Client.Post<TournamentsResultDTO>(restRequest);
}
@@ -285,33 +289,34 @@ namespace LaDOSE.REST
public bool ParseSmash(string slug)
{
CheckToken();
var restRequest = new RestRequest($"Api/Tournament/ParseSmash/{slug}", Method.GET);
var restRequest = new RestRequest($"Api/Tournament/ParseSmash/{slug}", Method.Get);
var restResponse = Client.Get<bool>(restRequest);
return restResponse.Data;
return restResponse;
}
public bool ParseChallonge(List<int> ids)
{
CheckToken();
return Post<List<int>, bool>("Api/Tournament/ParseChallonge", ids);
var restRequest = new RestRequest("Api/Tournament/ParseChallonge", Method.Post).AddJsonBody(ids);
return Client.Post<bool>(restRequest);
}
#endregion
#region Tournamenet Event / Player
public List<EventDTO> GetAllEvents()
{
CheckToken();
var restRequest = new RestRequest("/api/Event", Method.GET);
var restRequest = new RestRequest("/api/Event", Method.Get);
var restResponse = Client.Get<List<EventDTO>>(restRequest);
return restResponse.Data;
return restResponse;
}
public List<string> GetPlayers(string slug)
{
CheckToken();
var restRequest = new RestRequest($"/api/Tournament/GetPLayers/{slug}", Method.GET);
var restRequest = new RestRequest($"/api/Tournament/GetPLayers/{slug}", Method.Get);
var restResponse = Client.Get<List<string>>(restRequest);
return restResponse.Data;
return restResponse;
}
#endregion
@@ -321,23 +326,24 @@ namespace LaDOSE.REST
public bool CreateBotEvent(string eventName)
{
CheckToken();
var restRequest = new RestRequest($"/api/BotEvent/CreateBotEvent/{eventName}", Method.GET);
var restRequest = new RestRequest($"/api/BotEvent/CreateBotEvent/{eventName}", Method.Get);
var restResponse = Client.Get<bool>(restRequest);
return restResponse.Data;
return restResponse;
}
public BotEventDTO GetLastBotEvent()
{
CheckToken();
var restRequest = new RestRequest($"/api/BotEvent/GetLastBotEvent/", Method.GET);
var restRequest = new RestRequest($"/api/BotEvent/GetLastBotEvent/", Method.Get);
var restResponse = Client.Post<BotEventDTO>(restRequest);
return restResponse.Data;
return restResponse;
}
public bool ResultBotEvent(BotEventSendDTO result)
{
CheckToken();
return Post<BotEventSendDTO,bool>("/api/BotEvent/ResultBotEvent", result);
var restRequest = new RestRequest("/api/BotEvent/ResultBotEvent", Method.Post).AddJsonBody(result);
return Client.Post<bool>(restRequest);
}
#endregion

View File

@@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="GraphQL.Client" Version="4.0.2" />
<PackageReference Include="GraphQL.Client.Serializer.Newtonsoft" Version="4.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

View File

@@ -96,7 +96,7 @@ namespace LaDOSE.Business.Service
//POKEMON.
catch (Exception e)
{
throw new Exception("FUCK !");
throw new Exception($"FUCK ! {e.Message}");
}
return currentEvent;
}

View File

@@ -20,6 +20,7 @@ namespace LaDOSE.Business.Service
{
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
return null;
var p = _context.ApplicationUser.ToList();
var user = _context.ApplicationUser.SingleOrDefault(x => x.Username == username);
// check if username exists

View File

@@ -46,7 +46,7 @@ namespace LaDOSE.Business.Service
public bool UpdateBooking()
{
_context.Database.SetCommandTimeout(60);
_context.Database.ExecuteSqlCommand("call ladoseapi.ImportEvent();");
_context.Database.ExecuteSqlRaw("call ladoseapi.ImportEvent();");
_context.Database.SetCommandTimeout(30);
return true;
}

View File

@@ -21,6 +21,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{2A0E1491
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LaDOSE.REST", "LaDOSE.REST\LaDOSE.REST.csproj", "{692C2A72-AB7E-4502-BED8-AA2AFA1761CB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinuxTest", "LinuxTest\LinuxTest.csproj", "{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -51,6 +53,10 @@ Global
{692C2A72-AB7E-4502-BED8-AA2AFA1761CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{692C2A72-AB7E-4502-BED8-AA2AFA1761CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{692C2A72-AB7E-4502-BED8-AA2AFA1761CB}.Release|Any CPU.Build.0 = Release|Any CPU
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -62,6 +68,7 @@ Global
{952DE665-70B5-492B-BE91-D0111E3BD907} = {6FC9438E-D93E-4E63-9342-F8A966EE2D06}
{61201DA6-1BC9-4BA1-AC45-70104D391ECD} = {6FC9438E-D93E-4E63-9342-F8A966EE2D06}
{692C2A72-AB7E-4502-BED8-AA2AFA1761CB} = {2A0E1491-8E15-4062-ABE7-C04AE9655515}
{0EFA533F-9657-40CE-A3A5-F4E3C6E649B1} = {2A0E1491-8E15-4062-ABE7-C04AE9655515}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D47DEDD0-C906-439D-81E4-D86BBE723B8C}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LaDOSE.REST\LaDOSE.REST.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,19 @@
using LaDOSE.REST;
internal class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Rest Test");
var p = new LaDOSE.REST.RestService();
Console.WriteLine("[+] Connect");
p.Connect(new Uri("http://localhost:5000/"),"dev","dev");
Console.WriteLine("[+] Test");
var games = p.GetGames();
foreach (var ga in games)
{
Console.WriteLine(ga.Name);
}
}
}