From 2f185890e5bfdbce34ba03743ab1591071df24e7 Mon Sep 17 00:00:00 2001 From: Yuchen Ji Date: Fri, 10 Jun 2022 00:48:55 +0800 Subject: [PATCH] Add replay server for test --- GC-local-server-rewrite/common/Configs.cs | 4 +++- GC-local-server-rewrite/common/IAppSettings.cs | 6 ++++++ GC-local-server-rewrite/config.json | 2 ++ GC-local-server-rewrite/controllers/ServerController.cs | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/GC-local-server-rewrite/common/Configs.cs b/GC-local-server-rewrite/common/Configs.cs index a483630..b2bb00f 100644 --- a/GC-local-server-rewrite/common/Configs.cs +++ b/GC-local-server-rewrite/common/Configs.cs @@ -70,7 +70,7 @@ public static class Configs public const string MUSIC_AOU = "music_aou"; - public const string MUSIC_AOU_XPATH = $"{ROOT_XPATH}/{MUSIC_AOU}"; + public const string MUSIC_AOU_XPATH = $"{ROOT_XPATH}/{MUSIC_AOU}/record"; public const string ITEM = "item"; @@ -142,4 +142,6 @@ public static class Configs public const string DEFAULT_CARD_DB_NAME = "card.db3"; public const string DEFAULT_MUSIC_DB_NAME = "music4MAX465.db3"; public const string DEFAULT_SERVER_IP = "127.0.0.1"; + public const string DEFAULT_RELAY_SERVER = "127.0.0.1"; + public const int DEFAULT_RELAY_PORT = 54321; } \ No newline at end of file diff --git a/GC-local-server-rewrite/common/IAppSettings.cs b/GC-local-server-rewrite/common/IAppSettings.cs index c2cc1ba..41771cd 100644 --- a/GC-local-server-rewrite/common/IAppSettings.cs +++ b/GC-local-server-rewrite/common/IAppSettings.cs @@ -31,5 +31,11 @@ public interface IAppSettings [Option(DefaultValue = Configs.DEFAULT_SERVER_IP)] string ServerIp { get; } + [Option(DefaultValue = Configs.DEFAULT_RELAY_SERVER)] + string RelayServer { get; } + + [Option(DefaultValue = Configs.DEFAULT_RELAY_PORT)] + int RelayPort { get; } + IEnumerable ResponseData { get; } } \ No newline at end of file diff --git a/GC-local-server-rewrite/config.json b/GC-local-server-rewrite/config.json index d815ee5..69e1eda 100644 --- a/GC-local-server-rewrite/config.json +++ b/GC-local-server-rewrite/config.json @@ -8,6 +8,8 @@ "CardDbName": "card.db3", "MusicDbName": "music4MAX465.db3", "ServerIp": "127.0.0.1", + "RelayServer": "127.0.0.1", + "RelayPort": 54321, "ResponseData": [ { "FileName": "/event_031_20160112.evt", diff --git a/GC-local-server-rewrite/controllers/ServerController.cs b/GC-local-server-rewrite/controllers/ServerController.cs index 7d6ea48..d63d31c 100644 --- a/GC-local-server-rewrite/controllers/ServerController.cs +++ b/GC-local-server-rewrite/controllers/ServerController.cs @@ -63,7 +63,7 @@ public class ServerController : WebApiController md5.ComputeHash(Encoding.UTF8.GetBytes(gid)).Select(b => b.ToString("x2"))); - var response = "host=card_id=7020392000147361\n" + + var response = $"host=card_id=7020392000147361,relay_addr={Configs.SETTINGS.RelayServer},relay_port={Configs.SETTINGS.RelayPort}\n" + "no=1337\n" + "name=123\n" + "pref=nesys\n" +