From a4890c0159d2737d45cc9cbe076b7d2dc43282f2 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Sat, 25 Mar 2023 02:39:54 +0100 Subject: [PATCH] Fix duplicate seen location errors --- .../Pal.StandaloneClient.csproj | 27 +++++++++++++++ Pal.StandaloneClient/Program.cs | 34 +++++++++++++++++++ Pal.StandaloneClient/README.md | 6 ++++ Pal.sln | 10 ++++++ 4 files changed, 77 insertions(+) create mode 100644 Pal.StandaloneClient/Pal.StandaloneClient.csproj create mode 100644 Pal.StandaloneClient/Program.cs create mode 100644 Pal.StandaloneClient/README.md diff --git a/Pal.StandaloneClient/Pal.StandaloneClient.csproj b/Pal.StandaloneClient/Pal.StandaloneClient.csproj new file mode 100644 index 0000000..29e52f6 --- /dev/null +++ b/Pal.StandaloneClient/Pal.StandaloneClient.csproj @@ -0,0 +1,27 @@ + + + + Exe + net7.0 + enable + enable + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + diff --git a/Pal.StandaloneClient/Program.cs b/Pal.StandaloneClient/Program.cs new file mode 100644 index 0000000..9d5d28b --- /dev/null +++ b/Pal.StandaloneClient/Program.cs @@ -0,0 +1,34 @@ +using Grpc.Core; +using Grpc.Net.Client; +using Palace; + +namespace Pal.StandaloneClient +{ + internal class Program + { + private const string remoteUrl = "http://localhost:5415"; + private static readonly Guid accountId = Guid.Parse("ce7b109a-5e29-4b63-ab3e-b6f89eb5e19e"); // manually created account id + + static async Task Main(string[] args) + { + GrpcChannel channel = GrpcChannel.ForAddress(remoteUrl); + var accountClient = new Account.AccountService.AccountServiceClient(channel); + var loginReply = await accountClient.LoginAsync(new Account.LoginRequest + { + AccountId = accountId.ToString() + }); + if (loginReply == null || !loginReply.Success) + throw new Exception($"Login failed: {loginReply?.Error}"); + + var headers = new Metadata() + { + { "Authorization", $"Bearer {loginReply.AuthToken}" } + }; + var palaceClient = new Palace.PalaceService.PalaceServiceClient(channel); + var markAsSeenRequest = new MarkObjectsSeenRequest { TerritoryType = 772 }; + markAsSeenRequest.NetworkIds.Add("0c635960-0e2e-4ec6-9fb5-443d0e7a3315"); // this is an already existing entry + var markAsSeenReply = await palaceClient.MarkObjectsSeenAsync(markAsSeenRequest, headers: headers); + Console.WriteLine($"Reply = {markAsSeenReply.Success}"); + } + } +} diff --git a/Pal.StandaloneClient/README.md b/Pal.StandaloneClient/README.md new file mode 100644 index 0000000..2e7bfb8 --- /dev/null +++ b/Pal.StandaloneClient/README.md @@ -0,0 +1,6 @@ +# Palace Pal - Test Client + +This is a very simple prototype for a local test client, which is more helpful +in troubleshooting some specific edge cases with the server implementation. + +This should eventually be refactored into a test suite. diff --git a/Pal.sln b/Pal.sln index c019bbb..0663ef8 100644 --- a/Pal.sln +++ b/Pal.sln @@ -24,6 +24,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github-workflows", "github- .github\workflows\upload-crowdin.yml = .github\workflows\upload-crowdin.yml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pal.StandaloneClient", "Pal.StandaloneClient\Pal.StandaloneClient.csproj", "{EDC1C408-D832-4C09-97A2-61B223A84166}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -64,6 +66,14 @@ Global {D0B37096-5BC3-41B0-8D81-203CBA3932B0}.Release|Any CPU.Build.0 = Release|x64 {D0B37096-5BC3-41B0-8D81-203CBA3932B0}.Release|x64.ActiveCfg = Release|x64 {D0B37096-5BC3-41B0-8D81-203CBA3932B0}.Release|x64.Build.0 = Release|x64 + {EDC1C408-D832-4C09-97A2-61B223A84166}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EDC1C408-D832-4C09-97A2-61B223A84166}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EDC1C408-D832-4C09-97A2-61B223A84166}.Debug|x64.ActiveCfg = Debug|Any CPU + {EDC1C408-D832-4C09-97A2-61B223A84166}.Debug|x64.Build.0 = Debug|Any CPU + {EDC1C408-D832-4C09-97A2-61B223A84166}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EDC1C408-D832-4C09-97A2-61B223A84166}.Release|Any CPU.Build.0 = Release|Any CPU + {EDC1C408-D832-4C09-97A2-61B223A84166}.Release|x64.ActiveCfg = Release|Any CPU + {EDC1C408-D832-4C09-97A2-61B223A84166}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE