1
0
mirror of synced 2024-11-23 22:41:01 +01:00

Stage changes

This commit is contained in:
asesidaa 2024-11-24 02:23:25 +08:00
parent 5668aad9bc
commit c49a91c519
140 changed files with 15075 additions and 32 deletions

View File

@ -13,6 +13,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Otp.NET" Version="1.4.0" />
<PackageReference Include="Riok.Mapperly" Version="4.1.1-next.0" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="Swan.Core" Version="7.0.0-beta.2" />
<PackageReference Include="Throw" Version="1.4.0" />
</ItemGroup>

View File

@ -1,6 +1,6 @@
namespace Application.Handlers.Api.Auth;
public record ChangePasswordCommand(string AccessCode, string OldPassword, string NewPassword) : IRequest<ApiResult<bool>>;
public record ChangePasswordCommand(uint Baid, string OldPassword, string NewPassword) : IRequest<ApiResult<bool>>;
public class ChangePasswordCommandHandler(ITaikoDbContext context, ILogger<ChangePasswordCommandHandler> logger)
@ -8,15 +8,15 @@ public class ChangePasswordCommandHandler(ITaikoDbContext context, ILogger<Chang
{
public async Task<ApiResult<bool>> Handle(ChangePasswordCommand request, CancellationToken cancellationToken)
{
var card = await context.Cards.Include(card => card.Ba)
.ThenInclude(user => user!.Credential)
.FirstOrDefaultAsync(card => card.AccessCode == request.AccessCode, cancellationToken);
if (card is null)
var user = await context.UserData.Include(u => u.Credential)
.FirstOrDefaultAsync(u => u.Baid == request.Baid, cancellationToken);
if (user is null)
{
return ApiResult.Failed<bool>("Invalid access code");
return ApiResult.Failed<bool>("User not found");
}
var credential = card.Ba?.Credential;
var credential = user.Credential;
if (credential is null || credential.Password == string.Empty)
{
return ApiResult.Failed<bool>("User not registered");

View File

@ -1,13 +1,11 @@
namespace Application.Handlers.Api.Auth;
public record RegisterCommand : IRequest<ApiResult<bool>>
{
public string AccessCode { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public bool RegisterWithLastPlayTime { get; set; }
public DateTime LastPlayDateTime { get; set; }
public string InviteCode { get; set; } = string.Empty;
}
public record RegisterCommand(
string AccessCode,
string Password,
bool RegisterWithLastPlayTime,
DateTime LastPlayDateTime,
string InviteCode) : IRequest<ApiResult<bool>>;
public class RegisterCommandHandler(ITaikoDbContext context, ILogger<RegisterCommandHandler> logger)
: IRequestHandler<RegisterCommand, ApiResult<bool>>

View File

@ -12,6 +12,7 @@ public class BindAccessCodeCommandHandler(ITaikoDbContext context, ILogger<BindA
{
return ApiResult.Failed<bool>("Access code already exists");
}
var newCard = new Card
{

View File

@ -1,7 +1,7 @@
namespace Application.Handlers.Api.User;
using LeaderBoard = PaginatedResult<SongLeaderboardEntry>;
public record GetSongLeaderboardQuery(uint SongId, Difficulty Difficulty, int Baid, int Page, int Limit) : IRequest<ApiResult<LeaderBoard>>;
public record GetSongLeaderboardQuery(uint SongId, Difficulty Difficulty, uint Baid, int Page, int Limit) : IRequest<ApiResult<LeaderBoard>>;
public class GetSongLeaderboardQueryHandler(ITaikoDbContext context, ILogger<GetSongLeaderboardQueryHandler> logger)
: IRequestHandler<GetSongLeaderboardQuery, ApiResult<LeaderBoard>>

View File

@ -0,0 +1,26 @@
using Application.Mappers;
namespace Application.Handlers.Api.User;
public record UpdateUserSettingsCommand(uint Baid, UserSetting UserSetting): IRequest<ApiResult<bool>>;
public class UpdateUserSettingsCommandHandler(ITaikoDbContext context)
: IRequestHandler<UpdateUserSettingsCommand, ApiResult<bool>>
{
public async Task<ApiResult<bool>> Handle(UpdateUserSettingsCommand request, CancellationToken cancellationToken)
{
var user = await context.UserData.FirstOrDefaultAsync(u => u.Baid == request.Baid, cancellationToken);
if (user is null)
{
return ApiResult.Failed<bool>("User not found!");
}
UserSettingMapper.UpdateUserSetting(request.UserSetting, user);
var toneFlg = user.ToneFlgArray;
toneFlg = toneFlg.Append(0u).Append(request.UserSetting.SelectedToneId).Distinct().ToList();
user.ToneFlgArray = toneFlg;
await context.SaveChangesAsync(cancellationToken);
return ApiResult.Succeed(true);
}
}

View File

@ -0,0 +1,43 @@
using Domain.Settings;
using Microsoft.Extensions.Options;
namespace Application.Handlers.Game;
public record GetCrownDataQuery(uint Baid): IRequest<CommonCrownDataResponse>;
public class GetCrownDataQueryHandler(ITaikoDbContext context, IOptions<ServerSettings> options, ILogger<GetCrownDataQueryHandler> logger)
: IRequestHandler<GetCrownDataQuery, CommonCrownDataResponse>
{
public async Task<CommonCrownDataResponse> Handle(GetCrownDataQuery request, CancellationToken cancellationToken)
{
var songBestData = await context.SongBestData.Where(datum => datum.Baid == request.Baid)
.ToListAsync(cancellationToken);
var songIdMax = options.Value.EnableMoreSongs ? Constants.MusicIdMaxExpanded : Constants.MusicIdMax;
var crown = new ushort[songIdMax + 1];
var dondafulCrown = new ushort[songIdMax + 1];
for (var songId = 0; songId < songIdMax; songId++)
{
var id = songId;
dondafulCrown[songId] = songBestData
// Select song of this song id with dondaful crown
.Where(datum => datum.SongId == id &&
datum.BestCrown == CrownType.Dondaful)
// Calculate flag according to difficulty
.Aggregate((byte)0, (flag, datum) => FlagCalculator.ComputeDondafulCrownFlag(flag, datum.Difficulty));
crown[songId] = songBestData
// Select song of this song id with clear or fc crown
.Where(datum => datum.SongId == id &&
datum.BestCrown is CrownType.Clear or CrownType.Gold)
// Calculate flag according to difficulty
.Aggregate((ushort)0, (flag, datum) => FlagCalculator.ComputeCrownFlag(flag, datum.BestCrown, datum.Difficulty));
}
var response = new CommonCrownDataResponse(GZipBytesUtil.GetGZipBytes(crown), GZipBytesUtil.GetGZipBytes(dondafulCrown));
return response;
}
}

View File

@ -0,0 +1,47 @@
using Domain.Settings;
using Microsoft.Extensions.Options;
namespace Application.Handlers.Game;
public record GetScoreRankQuery(uint Baid): IRequest<CommonScoreRankResponse>;
public class GetScoreRankQueryHandler(ITaikoDbContext context, IOptions<ServerSettings> options, ILogger<GetScoreRankQueryHandler> logger)
: IRequestHandler<GetScoreRankQuery, CommonScoreRankResponse>
{
public async Task<CommonScoreRankResponse> Handle(GetScoreRankQuery request, CancellationToken cancellationToken)
{
var songIdMax = options.Value.EnableMoreSongs ? Constants.MusicIdMaxExpanded : Constants.MusicIdMax;
var kiwamiScores = new byte[songIdMax + 1];
var miyabiScores = new ushort[songIdMax + 1];
var ikiScores = new ushort[songIdMax + 1];
var songBestData = await context.SongBestData.Where(datum => datum.Baid == request.Baid)
.ToListAsync(cancellationToken);
for (var songId = 0; songId < songIdMax; songId++)
{
var id = songId;
kiwamiScores[songId] = songBestData
.Where(datum => datum.SongId == id &&
datum.BestScoreRank == ScoreRank.Dondaful)
.Aggregate((byte)0, (flag, datum) => FlagCalculator.ComputeKiwamiScoreRankFlag(flag, datum.Difficulty));
ikiScores[songId] = songBestData
.Where(datum => datum.SongId == id &&
datum.BestScoreRank is ScoreRank.White or ScoreRank.Bronze or ScoreRank.Silver)
.Aggregate((ushort)0, (flag, datum) => FlagCalculator.ComputeMiyabiOrIkiScoreRank(flag, datum.BestScoreRank, datum.Difficulty));
miyabiScores[songId] = songBestData
.Where(datum => datum.SongId == id &&
datum.BestScoreRank is ScoreRank.Gold or ScoreRank.Purple or ScoreRank.Sakura)
.Aggregate((ushort)0, (flag, datum) => FlagCalculator.ComputeMiyabiOrIkiScoreRank(flag, datum.BestScoreRank, datum.Difficulty));
}
var response = new CommonScoreRankResponse(
GZipBytesUtil.GetGZipBytes(ikiScores),
GZipBytesUtil.GetGZipBytes(kiwamiScores),
GZipBytesUtil.GetGZipBytes(miyabiScores)
);
return response;
}
}

View File

@ -0,0 +1,17 @@
namespace Application.Handlers.Game;
public record VerifyQrQuery(string Serial): IRequest<CommonVerifyQrResponse>;
public class VerifyQrQueryHandler(IGameDataService gameDataService)
: IRequestHandler<VerifyQrQuery, CommonVerifyQrResponse>
{
public Task<CommonVerifyQrResponse> Handle(VerifyQrQuery request, CancellationToken cancellationToken)
{
var qrCodeDataDictionary = gameDataService.GetQRCodeDataDictionary();
qrCodeDataDictionary.TryGetValue(request.Serial, out var qrCodeId);
return Task.FromResult(qrCodeId == 0 ?
new CommonVerifyQrResponse(false, 0) : new CommonVerifyQrResponse(true, qrCodeId));
}
}

View File

@ -15,12 +15,26 @@ public static partial class UserSettingMapper
[MapProperty(nameof(UserDatum.UnlockedHead), nameof(UserSetting.UnlockedHead), Use = nameof(FixUnlock))]
[MapProperty(nameof(UserDatum.UnlockedPuchi), nameof(UserSetting.UnlockedPuchi), Use = nameof(FixUnlock))]
public static partial UserSetting MapToUserSetting(UserDatum user);
[MapperIgnoreSource(nameof(UserSetting.Baid))]
[MapperIgnoreSource(nameof(UserSetting.UnlockedKigurumi))]
[MapperIgnoreSource(nameof(UserSetting.UnlockedBody))]
[MapperIgnoreSource(nameof(UserSetting.UnlockedFace))]
[MapperIgnoreSource(nameof(UserSetting.UnlockedHead))]
[MapperIgnoreSource(nameof(UserSetting.UnlockedPuchi))]
[MapProperty(nameof(UserSetting.PlaySetting), nameof(UserDatum.OptionSetting), Use = nameof(PlaySettingToShort))]
public static partial void UpdateUserSetting(UserSetting userSetting, UserDatum user);
public static PlaySetting ShortToPlaySetting(short option)
{
return PlaySettingConverter.ShortToPlaySetting(option);
}
public static short PlaySettingToShort(PlaySetting setting)
{
return PlaySettingConverter.PlaySettingToShort(setting);
}
public static List<uint> FixUnlock(List<uint> unlock)
{
if (!unlock.Contains(0))

View File

@ -0,0 +1,3 @@
namespace Application.Models.Game;
public record CommonCrownDataResponse(byte[] CrownFlg, byte[] DondafulCrownFlg);

View File

@ -0,0 +1,3 @@
namespace Application.Models.Game;
public record CommonScoreRankResponse(byte[] IkiScoreRankFlg, byte[] KiwamiScoreRankFlg, byte[] MiyabiScoreRankFlg);

View File

@ -0,0 +1,3 @@
namespace Application.Models.Game;
public record CommonVerifyQrResponse(bool IsQrValid, uint QrCodeId);

View File

@ -0,0 +1,61 @@
using System.Runtime.InteropServices;
using System.Text;
using ICSharpCode.SharpZipLib.GZip;
namespace Application.Utils;
public static class GZipBytesUtil
{
public static MemoryStream GenerateStreamFromString(string value)
{
return new MemoryStream(Encoding.UTF8.GetBytes(value));
}
public static byte[] GetEmptyJsonGZipBytes()
{
var outputStream = new MemoryStream(1024);
using (var stream = new GZipOutputStream(outputStream))
using (var writer = new StreamWriter(stream, Encoding.UTF8))
{
/*writer.AutoFlush = true;
writer.WriteLine("{}");*/
stream.Write(Array.Empty<byte>());
}
return outputStream.ToArray();
}
public static byte[] GetGZipBytes(byte[] input)
{
var outputStream = new MemoryStream(1024);
using (var stream = new GZipOutputStream(outputStream))
{
stream.Write(input);
}
return outputStream.ToArray();
}
public static byte[] GetGZipBytes<T>(T[] data) where T : struct
{
var outputStream = new MemoryStream(1024);
using (var stream = new GZipOutputStream(outputStream))
{
var byteRef = MemoryMarshal.AsBytes(new ReadOnlySpan<T>(data));
stream.Write(byteRef);
}
return outputStream.ToArray();
}
public static byte[] DecompressGZipBytes(byte[] input)
{
using (var inputStream = new MemoryStream(input))
using (var stream = new GZipInputStream(inputStream))
using (var outputStream = new MemoryStream(1024))
{
stream.CopyTo(outputStream);
return outputStream.ToArray();
}
}
}

1
Server/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
wwwroot/data/datatable/*

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
{
"AuthSettings": {
"JwtKey": "SuperSecretKeyAndHeresItsPadding",
"JwtIssuer": "http://localhost:5000",
"JwtAudience": "http://localhost:5000",
"AuthenticationRequired": false
}
}

View File

@ -0,0 +1,13 @@
{
"DataSettings" : {
"DanDataFileName" : "dan_data.json",
"GaidenDataFileName" : "gaiden_data.json",
"EventFolderDataFileName" : "event_folder_data.json",
"IntroDataFileName" : "intro_data.json",
"MovieDataFileName": "movie_data.json",
"ShopFolderDataFileName": "shop_folder_data.json",
"TokenDataFileName": "token_data.json",
"LockedSongsDataFileName": "locked_songs_data.json",
"QRCodeDataFileName": "qrcode_data.json"
}
}

View File

@ -0,0 +1,3 @@
{
"DbFileName" : "taiko.db3"
}

View File

@ -0,0 +1,34 @@
{
"Kestrel": {
"Endpoints": {
"BaseServer": {
"Url": "http://0.0.0.0:5000"
},
"AmAuthServer": {
"Url": "http://0.0.0.0:80"
},
"MuchaServer": {
"Url": "https://0.0.0.0:10122"
},
"GameServer1": {
"Url": "https://0.0.0.0:54430"
},
"GameServer2": {
"Url": "https://0.0.0.0:54431"
},
"GameServerCN": {
"Url": "https://0.0.0.0:57402"
},
"GarmcServer": {
"Url": "https://0.0.0.0:443"
}
},
"Certificates": {
"Default": {
"Path": "Certificates/cert.pfx",
"Password": "",
"AllowInvalid": true
}
}
}
}

View File

@ -0,0 +1,27 @@
{
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.AspNetCore": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Filter": [
{
"Name": "ByExcluding",
"Args": {
"expression": "@mt = 'An unhandled exception has occurred while executing the request.'"
}
}
],
"WriteTo": [
{
"Name": "File",
"Args": { "path": "./Logs/log-.txt", "rollingInterval": "Day" }
}
]
}
}

View File

@ -0,0 +1,8 @@
{
"ServerSettings": {
"MuchaUrl": "https://v402-front.mucha-prd.nbgi-amnet.jp:10122",
"GameUrl": "vsapi.taiko-p.jp",
"EnableMoreSongs": false,
"MoreSongsSize": 9000
}
}

View File

@ -0,0 +1,52 @@
using Domain.Settings;
using Microsoft.Extensions.Options;
using Server.Models;
using Server.Utils;
namespace Server.Controllers.AmAuth;
[ApiController]
[Route("/sys/servlet/PowerOn")]
public class PowerOnController : BaseController<PowerOnController>
{
private readonly ServerSettings settings;
public PowerOnController(IOptions<ServerSettings> settings)
{
this.settings = settings.Value;
}
[HttpPost]
public ContentResult PowerOn([FromForm] PowerOnRequest request)
{
Logger.LogInformation("Power on request: {Request}",request.Stringify());
var now = DateTime.Now;
var response = new Dictionary<string, string>
{
{"stat", "1"},
{"uri", settings.GameUrl},
{"host", settings.GameUrl},
{"place_id", "JPN0123"},
{"name", "NAMCO"},
{"nickname", "NAMCO"},
{"region0", "1"},
{"region_name0", "NAMCO"},
{"region_name1", "X"},
{"region_name2", "Y"},
{"region_name3", "Z"},
{"country", "JPN"},
{"allnet_id", "456"},
{"timezone", "002,00"},
{"setting", ""},
{"year", now.Year.ToString()},
{"month", now.Month.ToString()},
{"day", now.Day.ToString()},
{"hour", now.Hour.ToString()},
{"minute", now.Minute.ToString()},
{"second", now.Second.ToString()},
{"res_class", "PowerOnResponseVer2"},
{"token", "123"}
};
return Content(FormOutputUtil.ToFormOutput(response) + '\n');
}
}

View File

@ -0,0 +1,90 @@
using Domain.Settings;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Server.Models;
using Server.Utils;
namespace Server.Controllers.AmUpdater;
public class MuchaController : BaseController<MuchaController>
{
private readonly ServerSettings settings;
public MuchaController(IOptions<ServerSettings> settings)
{
this.settings = settings.Value;
}
[HttpPost("/mucha_front/boardauth.do")]
public ContentResult BoardAuth([FromForm] MuchaUpdateCheckRequest request)
{
Logger.LogInformation("Mucha request: {Request}", request.Stringify());
var serverTime = DateTime.Now.ToString("yyyyMMddHHmm");
var utcServerTime = DateTime.UtcNow.ToString("yyyyMMddHHmm");
var response = new Dictionary<string, string>
{
{ "RESULTS", "001" },
{ "AREA_0", "008" },
{ "AREA_0_EN", "" },
{ "AREA_1", "009" },
{ "AREA_1_EN", "" },
{ "AREA_2", "010" },
{ "AREA_2_EN", "" },
{ "AREA_3", "011" },
{ "AREA_3_EN", "" },
{ "AREA_FULL_0", "" },
{ "AREA_FULL_0_EN", "" },
{ "AREA_FULL_1", "" },
{ "AREA_FULL_1_EN", "" },
{ "AREA_FULL_2", "" },
{ "AREA_FULL_2_EN", "" },
{ "AREA_FULL_3", "" },
{ "AREA_FULL_3_EN", "" },
{ "AUTH_INTERVAL", "86400" },
{ "CHARGE_URL", $"{settings.MuchaUrl}/charge/" },
{ "CONSUME_TOKEN", "0" },
{ "COUNTRY_CD", "JPN" },
{ "DONGLE_FLG", "1" },
{ "EXPIRATION_DATE", "null" },
{ "FILE_URL", $"{settings.MuchaUrl}/file/" },
{ "FORCE_BOOT", "0" },
{ "PLACE_ID", request.PlaceId ?? "" },
{ "PREFECTURE_ID", "14" },
{ "SERVER_TIME", serverTime },
{ "UTC_SERVER_TIME", utcServerTime },
{ "SHOP_NAME", "NAMCO" },
{ "SHOP_NAME_EN", "NAMCO" },
{ "SHOP_NICKNAME", "W" },
{ "SHOP_NICKNAME_EN", "W" },
{ "URL_1", $"{settings.MuchaUrl}/url1/" },
{ "URL_2", $"{settings.MuchaUrl}/url2/" },
{ "URL_3", $"{settings.MuchaUrl}/url3/" },
{ "USE_TOKEN", "0" }
};
var formOutput = FormOutputUtil.ToFormOutput(response);
return Content(formOutput);
}
[HttpPost("/mucha_front/updatacheck.do")]
public ContentResult UpdateCheck(MuchaBoardAuthRequest request)
{
Logger.LogInformation("Request is {Request}", request.Stringify());
var response = new Dictionary<string, string>
{
{ "RESULTS", "001" },
{ "UPDATE_VER_1", request.GameVersion ?? "S1210JPN08.18" },
{ "UPDATE_URL_1", $"{settings.MuchaUrl}/updUrl1/" },
{ "UPDATE_SIZE_1", "0" },
{ "UPDATE_CRC_1", "0000000000000000" },
{ "CHECK_URL_1", $"{settings.MuchaUrl}/checkUrl/" },
{ "EXE_VER_1", request.GameVersion ?? "S1210JPN08.18" },
{ "INFO_SIZE_1", "0" },
{ "COM_SIZE_1", "0" },
{ "COM_TIME_1", "0" },
{ "LAN_INFO_SIZE_1", "0" }
};
var formOutput = FormOutputUtil.ToFormOutput(response);
return Content(formOutput);
}
}

View File

@ -0,0 +1,132 @@
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using Application.Handlers.Api.Auth;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using OtpNet;
using Shared.Models.Requests;
namespace Server.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
public class AuthController : BaseController<AuthController>
{
[HttpPost("Login")]
[AllowAnonymous]
public async Task<IActionResult> Login(LoginRequest loginRequest)
{
var loginCommand = new LoginCommand(loginRequest.AccessCode, loginRequest.Password);
var apiResult = await Mediator.Send(loginCommand);
if (!apiResult.Succeeded)
{
return Unauthorized(apiResult.Message);
}
return Ok(apiResult.Data);
}
/*[HttpPost("LoginWithToken")]
[ServiceFilter(typeof(AuthorizeIfRequiredAttribute))]
public IActionResult LoginWithToken()
{
var tokenInfo = authService.ExtractTokenInfo(Microsoft.AspNetCore.Http.HttpContext);
if (tokenInfo == null)
{
return Unauthorized();
}
return Ok();
}*/
[HttpPost("Register")]
[AllowAnonymous]
public async Task<IActionResult> Register(RegisterRequest registerRequest)
{
var registerCommand = RegisterCommandMapper.ToCommand(registerRequest);
var apiResult = await Mediator.Send(registerCommand);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok();
}
[HttpPost]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> ChangePassword(ChangePasswordRequest request)
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var changePasswordCommand = new ChangePasswordCommand(baid, request.OldPassword, request.NewPassword);
var apiResult = await Mediator.Send(changePasswordCommand);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok();
}
[HttpPost]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> ChangePasswordAdmin(ChangePasswordRequest request)
{
var changePasswordCommand = ChangePasswordCommandMapper.ToCommand(request);
var apiResult = await Mediator.Send(changePasswordCommand);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok();
}
[HttpPost]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> ResetPasswordAdmin(ResetPasswordRequest resetPasswordRequest)
{
var resetPasswordCommand = new ResetPasswordCommand(resetPasswordRequest.Baid);
var apiResult = await Mediator.Send(resetPasswordCommand);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok();
}
[HttpPost]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> ResetPassword(ResetPasswordRequest resetPasswordRequest)
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var resetPasswordCommand = new ResetPasswordCommand(baid);
var apiResult = await Mediator.Send(resetPasswordCommand);
if (!apiResult.Succeeded)
{
return Unauthorized(apiResult.Message);
}
return Ok();
}
[HttpPost("GenerateOtp")]
[Authorize(Policy = "AuthConditionalAdmin")]
public IActionResult GenerateOtp(GenerateOtpRequest request)
{
var command = new GenerateOtpCommand(request.Baid);
var apiResult = Mediator.Send(command);
return Ok(apiResult.Result.Data);
}
}

View File

@ -0,0 +1,73 @@
using System.Security.Claims;
using Application.Handlers.Api.Cards;
using Microsoft.AspNetCore.Authorization;
using Shared.Models.Requests;
namespace Server.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
public class CardsController : BaseController<CardsController>
{
[HttpDelete("admin/{accessCode}")]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> DeleteAccessCodeAdmin(string accessCode)
{
var command = new DeleteCardCommand(accessCode, 0, true);
var apiResult = await Mediator.Send(command);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return NoContent();
}
[HttpDelete("{accessCode}")]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> DeleteAccessCode(string accessCode)
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var command = new DeleteCardCommand(accessCode, baid, false);
var apiResult = await Mediator.Send(command);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return NoContent();
}
[HttpPost]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> BindAccessCode(BindAccessCodeRequest request)
{
if (request.Baid != 0)
{
return BadRequest("Baid must be 0");
}
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var command = new BindAccessCodeCommand(request.AccessCode, baid);
var apiResult = await Mediator.Send(command);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok();
}
[HttpPost]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> BindAccessCodeAdmin(BindAccessCodeRequest request)
{
var command = new BindAccessCodeCommand(request.AccessCode, request.Baid);
var apiResult = await Mediator.Send(command);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok();
}
}

View File

@ -0,0 +1,41 @@
using System.Security.Claims;
using Application.Handlers.Api.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
namespace Server.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
public class DanBestDataController : BaseController<DanBestDataController>
{
[HttpGet("my")]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> GetDanBestData()
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var query = new GetDanBestDataQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
[HttpGet("{baid}")]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> GetDanBestData(uint baid)
{
var query = new GetDanBestDataQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
}

View File

@ -0,0 +1,75 @@
using System.Security.Claims;
using Application.Handlers.Api.User;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using Shared.Models.Requests;
namespace Server.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
public class FavoriteSongsController : BaseController<FavoriteSongsController>
{
[HttpPost]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> UpdateFavoriteSong(SetFavoriteRequest request)
{
if (request.Baid != 0)
{
return BadRequest("Baid must be 0");
}
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var command = new UpdateFavoriteSongCommand(baid, request.SongId, request.IsFavorite);
var apiResult = await Mediator.Send(command);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return NoContent();
}
[HttpPost]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> UpdateFavoriteSongAdmin(SetFavoriteRequest request)
{
var command = new UpdateFavoriteSongCommand(request.Baid, request.SongId, request.IsFavorite);
var apiResult = await Mediator.Send(command);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return NoContent();
}
[HttpGet("my")]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> GetFavoriteSongs()
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var query = new GetFavoriteSongsQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
[HttpGet("{baid}")]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> GetFavoriteSongs(uint baid)
{
var query = new GetFavoriteSongsQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
}

View File

@ -0,0 +1,44 @@
using Application.Interfaces;
using Microsoft.AspNetCore.Authorization;
namespace Server.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
public class GameDataController(IGameDataService gameDataService) : BaseController<UsersController>
{
[HttpGet("MusicDetails")]
[Authorize(Policy = "AuthConditional")]
public IActionResult GetMusicDetails()
{
return Ok(gameDataService.GetMusicDetailDictionary());
}
[HttpGet("Costumes")]
[Authorize(Policy = "AuthConditional")]
public IActionResult GetCostumes()
{
return Ok(gameDataService.GetCostumeList());
}
[HttpGet("Titles")]
[Authorize(Policy = "AuthConditional")]
public IActionResult GetTitles()
{
return Ok(gameDataService.GetTitleDictionary());
}
[HttpGet("LockedCostumes")]
[Authorize(Policy = "AuthConditional")]
public IActionResult GetLockedCostumes()
{
return Ok(gameDataService.GetLockedCostumeDataDictionary());
}
[HttpGet("LockedTitles")]
[Authorize(Policy = "AuthConditional")]
public IActionResult GetLockedTitles()
{
return Ok(gameDataService.GetLockedTitleDataDictionary());
}
}

View File

@ -0,0 +1,42 @@
using System.Security.Claims;
using Application.Handlers.Api.User;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using Riok.Mapperly.Abstractions;
using Shared.Models.Responses;
namespace Server.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
public class PlayDataController : BaseController<PlayDataController>
{
[HttpGet("{baid}")]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> GetSongBestRecords(uint baid)
{
var query = new GetSongBestRecordsQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
[HttpGet("my")]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> GetSongBestRecords()
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var query = new GetSongBestRecordsQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
}

View File

@ -0,0 +1,40 @@
using System.Security.Claims;
using Application.Handlers.Api.User;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
namespace Server.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
public class PlayHistoryController : BaseController<PlayDataController>
{
[HttpGet("{baid}")]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> GetSongHistory(uint baid)
{
var query = new GetSongHistoryQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
[HttpGet("my")]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> GetSongHistory()
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var query = new GetSongHistoryQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
}

View File

@ -0,0 +1,28 @@
using System.Security.Claims;
using Application.Handlers.Api.User;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using Shared.Models.Requests;
namespace Server.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
public class SongLeaderboardController : BaseController<SongLeaderboardController>
{
[HttpGet("{songId}")]
[Authorize("AuthConditional")]
public async Task<IActionResult> GetSongLeaderboard([FromQuery]GetSongLeaderboardRequest request)
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var query = new GetSongLeaderboardQuery(request.SongId, request.Difficulty, baid, request.Page, request.Limit);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
}

View File

@ -0,0 +1,41 @@
using System.Security.Claims;
using Application.Handlers.Api.User;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
namespace Server.Controllers.Api;
[ApiController]
[Route("/api/[controller]")]
public class UserSettingsController : BaseController<UserSettingsController>
{
[HttpPost("{baid}")]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> SaveUserSetting(uint baid, UserSetting userSetting)
{
var command = new UpdateUserSettingsCommand(baid, userSetting);
var result = await Mediator.Send(command);
if (!result.Succeeded)
{
return BadRequest(result.Message);
}
return NoContent();
}
[HttpPost("my")]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> SaveMyUserSetting(UserSetting userSetting)
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var command = new UpdateUserSettingsCommand(baid, userSetting);
var result = await Mediator.Send(command);
if (!result.Succeeded)
{
return BadRequest(result.Message);
}
return NoContent();
}
}

View File

@ -0,0 +1,88 @@
using System.Security.Claims;
using Application.Handlers.Api.User;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using Shared.Models.Requests;
using Shared.Models.Responses;
namespace Server.Controllers.Api;
[ApiController]
[Route("api/[controller]")]
public class UsersController : BaseController<UsersController>
{
[HttpGet("my")]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> GetUser()
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var query = new GetUserQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
[HttpGet("{baid}")]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<User?> GetUser(uint baid)
{
var query = new GetUserQuery(baid);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return null;
}
return apiResult.Data;
}
[HttpGet]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<ActionResult<UsersResponse>> GetUsers([FromQuery] GetUsersRequest request)
{
var query = new GetUsersQuery(request.Page, request.Limit, request.SearchTerm);
var apiResult = await Mediator.Send(query);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return Ok(apiResult.Data);
}
[HttpDelete("{baid}")]
[Authorize(Policy = "AuthConditionalAdmin")]
public async Task<IActionResult> DeleteUser(uint baid)
{
var command = new DeleteUserCommand(baid);
var apiResult = await Mediator.Send(command);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return NoContent();
}
[HttpDelete("me")]
[Authorize(Policy = "AuthConditional")]
public async Task<IActionResult> DeleteCurrentUser()
{
var baid = uint.Parse(User.Claims.First(c => c.Type == ClaimTypes.Name).Value);
var command = new DeleteUserCommand(baid);
var apiResult = await Mediator.Send(command);
if (!apiResult.Succeeded)
{
return BadRequest(apiResult.Message);
}
return NoContent();
}
}

View File

@ -0,0 +1,12 @@
namespace Server.Controllers;
public abstract class BaseController<T> : ControllerBase where T : BaseController<T>
{
private ILogger<T>? logger;
private ISender? mediator;
protected ISender Mediator => (mediator ??= HttpContext.RequestServices.GetService<ISender>()) ?? throw new InvalidOperationException();
protected ILogger<T> Logger => (logger ??= HttpContext.RequestServices.GetService<ILogger<T>>()) ?? throw new InvalidOperationException();
}

View File

@ -0,0 +1,39 @@
namespace Server.Controllers.Game;
[ApiController]
public class AddTokenCountController : BaseController<AddTokenCountController>
{
[HttpPost("/v12r08_ww/chassis/addtokencount_7547j3o4.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> AddTokenCount([FromBody] AddTokenCountRequest request)
{
Logger.LogInformation("[3906] AddTokenCount request : {Request}", request.Stringify());
var command = new AddTokenCountCommand(AddTokenCountRequestMapper.Map(request));
await Mediator.Send(command);
var response = new AddTokenCountResponse
{
Result = 1
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/addtokencount.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> AddTokenCount3209([FromBody] Server.Models.v3209.AddTokenCountRequest request)
{
Logger.LogInformation("[3209] AddTokenCount request : {Request}", request.Stringify());
var command = new AddTokenCountCommand(AddTokenCountRequestMapper.Map(request));
await Mediator.Send(command);
var response = new AddTokenCountResponse
{
Result = 1
};
return Ok(response);
}
}

View File

@ -0,0 +1,64 @@
namespace Server.Controllers.Game;
[ApiController]
public class BaidController : BaseController<BaidController>
{
[HttpPost("/v12r08_ww/chassis/baidcheck_dcfxit1u.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetBaid([FromBody] BAIDRequest request)
{
Logger.LogInformation("Baid request: {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new BaidQuery(request.AccessCode));
BAIDResponse response;
if (commonResponse.IsNewUser)
{
Logger.LogInformation("New user with access code {AccessCode}", request.AccessCode);
response = new BAIDResponse
{
Result = 1,
PlayerType = 1,
Baid = commonResponse.Baid,
};
return Ok(response);
}
response = Mappers.BaidResponseMapper.Map3906WithPostProcess(commonResponse);
response.PlayerType = 0;
response.IsDispAchievementTypeSet = true;
response.IsDispSouuchiOn = true;
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/baidcheck.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetBaid3209([FromBody] Server.Models.v3209.BAIDRequest request)
{
Logger.LogInformation("Baid request: {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new BaidQuery(request.WechatQrStr));
Server.Models.v3209.BAIDResponse response;
if (commonResponse.IsNewUser)
{
Logger.LogInformation("New user with access code {AccessCode}", request.WechatQrStr);
response = new Server.Models.v3209.BAIDResponse
{
Result = 1,
PlayerType = 1,
Baid = commonResponse.Baid,
};
return Ok(response);
}
response = Mappers.BaidResponseMapper.Map3209WithPostProcess(commonResponse);
response.PlayerType = 0;
response.IsDispAchievementTypeSet = true;
response.IsDispSouuchiOn = true;
return Ok(response);
}
}

View File

@ -0,0 +1,31 @@
namespace Server.Controllers.Game;
[ApiController]
public class BookkeepingController : BaseController<BookkeepingController>
{
[HttpPost("/v12r08_ww/chassis/bookkeeping_s4esi5un.php")]
[Produces("application/protobuf")]
public IActionResult StartupAuth([FromBody] BookKeepingRequest request)
{
Logger.LogInformation("[3906] Bookkeeping request: {Request}", request.Stringify());
var response = new BookKeepingResponse
{
Result = 1
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/bookkeeping.php")]
[Produces("application/protobuf")]
public IActionResult StartupAuth3209([FromBody] Server.Models.v3209.BookKeepingRequest request)
{
Logger.LogInformation("[3209] Bookkeeping request: {Request}", request.Stringify());
var response = new BookKeepingResponse
{
Result = 1
};
return Ok(response);
}
}

View File

@ -0,0 +1,33 @@
namespace Server.Controllers.Game;
[ApiController]
public class ChallengeCompetitionController : BaseController<ChallengeCompetitionController>
{
[HttpPost("/v12r08_ww/chassis/challengecompe.php")]
[Produces("application/protobuf")]
public IActionResult HandleChallenge([FromBody] ChallengeCompeRequest request)
{
Logger.LogInformation("ChallengeCompe request : {Request}", request.Stringify());
var response = new ChallengeCompeResponse
{
Result = 1
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/challengecompe.php")]
[Produces("application/protobuf")]
public IActionResult HandleChallenge3209([FromBody] Server.Models.v3209.ChallengeCompeRequest request)
{
Logger.LogInformation("ChallengeCompe request : {Request}", request.Stringify());
var response = new Server.Models.v3209.ChallengeCompeResponse
{
Result = 1
};
return Ok(response);
}
}

View File

@ -0,0 +1,44 @@
using Application.Utils;
using Microsoft.Extensions.Options;
namespace Server.Controllers.Game;
[ApiController]
public class CrownsDataController : BaseController<CrownsDataController>
{
[HttpPost("/v12r08_ww/chassis/crownsdata_oqgqy90s.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> CrownsData([FromBody] CrownsDataRequest request)
{
Logger.LogInformation("CrownsData request : {Request}", request.Stringify());
var crownData = await Mediator.Send(new GetCrownDataQuery(request.Baid));
var response = new CrownsDataResponse
{
Result = 1,
CrownFlg = crownData.CrownFlg,
DondafulCrownFlg = crownData.DondafulCrownFlg
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/crownsdata.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> CrownsData3209([FromBody] Server.Models.v3209.CrownsDataRequest request)
{
Logger.LogInformation("CrownsData request : {Request}", request.Stringify());
var crownData = await Mediator.Send(new GetCrownDataQuery((uint)request.Baid));
var response = new Server.Models.v3209.CrownsDataResponse
{
Result = 1,
CrownFlg = crownData.CrownFlg,
DondafulCrownFlg = crownData.DondafulCrownFlg
};
return Ok(response);
}
}

View File

@ -0,0 +1,35 @@
namespace Server.Controllers.Game;
[ApiController]
public class ExecuteQrCodeController : BaseController<ExecuteQrCodeController>
{
[HttpPost("/v12r08_ww/chassis/executeqrcode_rgowsr5m.php")]
[Produces("application/protobuf")]
public IActionResult ExecuteQrCode([FromBody] ExecuteQrcodeRequest request)
{
Logger.LogInformation("ExecuteQrcode request : {Request}", request.Stringify());
var response = new ExecuteQrcodeResponse
{
QrcodeId = 1,
Result = 1
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/executeqrcode.php")]
[Produces("application/protobuf")]
public IActionResult ExecuteQrCode3209([FromBody] Server.Models.v3209.ExecuteQrcodeRequest request)
{
Logger.LogInformation("ExecuteQrcode request : {Request}", request.Stringify());
var response = new Server.Models.v3209.ExecuteQrcodeResponse
{
QrcodeId = 1,
Result = 1
};
return Ok(response);
}
}

View File

@ -0,0 +1,27 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetAiDataController : BaseController<GetAiDataController>
{
[HttpPost("/v12r08_ww/chassis/getaidata_6x30b9nr.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetAiData([FromBody] GetAiDataRequest request)
{
Logger.LogInformation("GetAiData request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetAiDataQuery(request.Baid));
var response = Mappers.AiDataResponseMapper.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/getaidata.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetAiData3209([FromBody] Server.Models.v3209.GetAiDataRequest request)
{
Logger.LogInformation("GetAiData request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetAiDataQuery((uint)request.Baid));
var response = Mappers.AiDataResponseMapper.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,30 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetAiScoreController : BaseController<GetAiScoreController>
{
[HttpPost("/v12r08_ww/chassis/getaiscore_lp38po4w.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetAiScore([FromBody] GetAiScoreRequest request)
{
Logger.LogInformation("GetAiScore request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetAiScoreQuery(request.Baid, request.SongNo, request.Level));
var response = AiScoreMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("v12r00_cn/chassis/getaiscore.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetAiScore3209([FromBody] Server.Models.v3209.GetAiScoreRequest request)
{
Logger.LogInformation("GetAiScore request : {Request}", request.Stringify());
var commonResponse =
await Mediator.Send(new GetAiScoreQuery((uint)request.Baid, request.SongNo, request.Level));
var response = AiScoreMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,37 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetApplicationUrlController : BaseController<GetApplicationUrlController>
{
[HttpPost("/v12r08_ww/chassis/getapplicationurl.php")]
[Produces("application/protobuf")]
public IActionResult GetApplicationUrl([FromBody] GetApplicationUrlRequest request)
{
Logger.LogInformation("GetApplicationUrl request : {Request}", request.Stringify());
var response = new GetApplicationUrlResponse
{
Result = 1,
ApplicationUrl = $"{HttpContext.Request.Host.Value}/app"
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/getapplicationurl.php")]
[Produces("application/protobuf")]
public IActionResult GetApplicationUrl3209([FromBody] Server.Models.v3209.GetApplicationUrlRequest request)
{
Logger.LogInformation("GetApplicationUrl request : {Request}", request.Stringify());
var response = new Server.Models.v3209.GetApplicationUrlResponse
{
Result = 1,
ApplicationUrl = $"{HttpContext.Request.Host.Value}/app"
};
return Ok(response);
}
}

View File

@ -0,0 +1,39 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetDanOdaiController : BaseController<GetDanOdaiController>
{
[HttpPost("/v12r08_ww/chassis/getdanodai_ela9zu1a.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetDanOdai([FromBody] GetDanOdaiRequest request)
{
Logger.LogInformation("GetDanOdai request : {Request}", request.Stringify());
var response = new GetDanOdaiResponse
{
Result = 1
};
var odaiDataList = await Mediator.Send(new GetDanOdaiQuery(request.DanIds, request.Type));
response.AryOdaiDatas.AddRange(odaiDataList.Select(DanDataMappers.To3906OdaiData));
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/getdanodai.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetDanOdai3209([FromBody] Server.Models.v3209.GetDanOdaiRequest request)
{
Logger.LogInformation("GetDanOdai request : {Request}", request.Stringify());
var response = new Server.Models.v3209.GetDanOdaiResponse
{
Result = 1
};
var odaiDataList = await Mediator.Send(new GetDanOdaiQuery(request.DanIds, request.Type));
response.AryOdaiDatas.AddRange(odaiDataList.Select(DanDataMappers.To3209OdaiData));
return Ok(response);
}
}

View File

@ -0,0 +1,29 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetDanScoreController : BaseController<GetDanScoreController>
{
[HttpPost("/v12r08_ww/chassis/getdanscore_frqhg7q6.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetDanScore([FromBody] GetDanScoreRequest request)
{
Logger.LogInformation("GetDanScore request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetDanScoreQuery(request.Baid, request.Type, request.DanIds));
var response = DanScoreMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/getdanscore.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetDanScore3209([FromBody] Server.Models.v3209.GetDanScoreRequest request)
{
Logger.LogInformation("GetDanScore3209 request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetDanScoreQuery((uint)request.Baid, request.Type, request.DanIds));
var response = DanScoreMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,25 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetFolderController : BaseController<GetFolderController>
{
[HttpPost("/v12r08_ww/chassis/getfolder_rffj346i.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetFolder([FromBody] GetfolderRequest request)
{
Logger.LogInformation("GetFolder request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetFolderQuery(request.FolderIds));
var response = FolderDataMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/getfolder.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetFolder([FromBody] Server.Models.v3209.GetfolderRequest request)
{
Logger.LogInformation("GetFolder3209 request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetFolderQuery(request.FolderIds));
var response = FolderDataMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,40 @@
using Application.Utils;
namespace Server.Controllers.Game;
[ApiController]
public class GetGenericMasterController : BaseController<GetGenericMasterController>
{
[HttpPost("/v12r08_ww/chassis/getgenericmaster_ts8om3qd.php")]
[Produces("application/protobuf")]
public IActionResult GetGenericMaster([FromBody] GetGenericMasterRequest request)
{
Logger.LogInformation("GetGenericMasterRequest: {Request}", request.Stringify());
var response = new GetGenericMasterResponse
{
Result = 1,
VerupNo = 2,
EnableIdBit = FlagCalculator.GetBitArrayTrue(5000)
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/getgenericmaster.php")]
[Produces("application/protobuf")]
public IActionResult GetGenericMaster([FromBody] Server.Models.v3209.GetGenericMasterRequest request)
{
Logger.LogInformation("GetGenericMaster3209Request: {Request}", request.Stringify());
var response = new Server.Models.v3209.GetGenericMasterResponse
{
Result = 1,
VerupNo = 2,
EnableIdBit = FlagCalculator.GetBitArrayTrue(5000)
};
return Ok(response);
}
}

View File

@ -0,0 +1,44 @@
using Application.Utils;
using Microsoft.Extensions.Options;
namespace Server.Controllers.Game;
[ApiController]
public class GetScoreRankController : BaseController<GetScoreRankController>
{
[HttpPost("/v12r08_ww/chassis/getscorerank_1c8l7y61.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetScoreRank([FromBody] GetScoreRankRequest request)
{
Logger.LogInformation("GetScoreRank request : {Request}", request.Stringify());
var scoreRankData = await Mediator.Send(new GetScoreRankQuery(request.Baid));
var response = new GetScoreRankResponse
{
Result = 1,
IkiScoreRankFlg = scoreRankData.IkiScoreRankFlg,
KiwamiScoreRankFlg = scoreRankData.KiwamiScoreRankFlg,
MiyabiScoreRankFlg = scoreRankData.MiyabiScoreRankFlg
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/getscorerank.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetScoreRank3209([FromBody] Server.Models.v3209.GetScoreRankRequest request)
{
Logger.LogInformation("GetScoreRank request : {Request}", request.Stringify());
var scoreRankData = await Mediator.Send(new GetScoreRankQuery((uint)request.Baid));
var response = new Server.Models.v3209.GetScoreRankResponse
{
Result = 1,
IkiScoreRankFlg = scoreRankData.IkiScoreRankFlg,
KiwamiScoreRankFlg = scoreRankData.KiwamiScoreRankFlg,
MiyabiScoreRankFlg = scoreRankData.MiyabiScoreRankFlg
};
return Ok(response);
}
}

View File

@ -0,0 +1,29 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetShopFolderController : BaseController<GetShopFolderController>
{
[HttpPost("/v12r08_ww/chassis/getshopfolder_w4xik0uw.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetShopFolder([FromBody] GetShopFolderRequest request)
{
Logger.LogInformation("GetShopFolder request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetShopFolderQuery());
var response = ShopFolderDataMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/getshopfolder.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetShopFolder3209([FromBody] Server.Models.v3209.GetShopFolderRequest request)
{
Logger.LogInformation("GetShopFolder request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetShopFolderQuery());
var response = ShopFolderDataMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,29 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetSongIntroductionController : BaseController<GetSongIntroductionController>
{
[HttpPost("/v12r08_ww/chassis/getsongintroduction_66blw6is.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetSongIntroduction([FromBody] GetSongIntroductionRequest request)
{
Logger.LogInformation("GetSongIntroduction request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetSongIntroductionQuery(request.SetIds));
var response = SongIntroductionDataMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/getsongintroduction.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetSongIntroduction3209([FromBody] Server.Models.v3209.GetSongIntroductionRequest request)
{
Logger.LogInformation("GetSongIntroduction request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetSongIntroductionQuery(request.SetIds));
var response = SongIntroductionDataMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,47 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetTelopController : BaseController<GetTelopController>
{
[HttpPost("/v12r08_ww/chassis/gettelop_o0cb2z3e.php")]
[Produces("application/protobuf")]
public IActionResult GetTelop([FromBody] GettelopRequest request)
{
Logger.LogInformation("GetTelop request : {Request}", request.Stringify());
var startDateTime = DateTime.Now - TimeSpan.FromDays(999.0);
var endDateTime = DateTime.Now + TimeSpan.FromDays(999.0);
var response = new GettelopResponse
{
Result = 1,
StartDatetime = startDateTime.ToString(Constants.DateTimeFormat),
EndDatetime = endDateTime.ToString(Constants.DateTimeFormat),
Telop = "Hello 3906",
VerupNo = 1
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/gettelop.php")]
[Produces("application/protobuf")]
public IActionResult GetTelop3209([FromBody] Server.Models.v3209.GettelopRequest request)
{
Logger.LogInformation("GetTelop request : {Request}", request.Stringify());
var startDateTime = DateTime.Now - TimeSpan.FromDays(999.0);
var endDateTime = DateTime.Now + TimeSpan.FromDays(999.0);
var response = new Server.Models.v3209.GettelopResponse
{
Result = 1,
StartDatetime = startDateTime.ToString(Constants.DateTimeFormat),
EndDatetime = endDateTime.ToString(Constants.DateTimeFormat),
Telop = "Hello 3209",
VerupNo = 1
};
return Ok(response);
}
}

View File

@ -0,0 +1,29 @@
namespace Server.Controllers.Game;
[ApiController]
public class GetTokenCountController : BaseController<GetTokenCountController>
{
[HttpPost("/v12r08_ww/chassis/gettokencount_iut9g23g.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetTokenCount([FromBody] GetTokenCountRequest request)
{
Logger.LogInformation("GetTokenCount request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetTokenCountQuery(request.Baid));
var response = TokenCountDataMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("v12r00_cn/chassis/gettokencount.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetTokenCount3209([FromBody] Server.Models.v3209.GetTokenCountRequest request)
{
Logger.LogInformation("GetTokenCount request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetTokenCountQuery((uint)request.Baid));
var response = TokenCountDataMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,19 @@
using Server.Models.v3209;
namespace Server.Controllers.Game;
[ApiController]
public class HeadClerk2Controller : BaseController<HeadClerk2Controller>
{
[HttpPost("/v12r00_cn/chassis/headclerk2.php")]
[Produces("application/protobuf")]
public IActionResult UploadHeadClert2([FromBody] HeadClerk2Request request)
{
Logger.LogInformation("HeadClerk2 request : {Request}", request.Stringify());
var response = new HeadClerk2Response
{
Result = 1
};
return Ok(response);
}
}

View File

@ -0,0 +1,34 @@
namespace Server.Controllers.Game;
[ApiController]
public class HeartbeatController : BaseController<HeartbeatController>
{
[HttpPost("/v12r08_ww/chassis/heartbeat_hcv5akgr.php")]
[Produces("application/protobuf")]
public IActionResult HeartBeat([FromBody] HeartBeatRequest request)
{
Logger.LogInformation("Heartbeat request: {Request}", request.Stringify());
var response = new HeartBeatResponse
{
Result = 1,
ComSvrStat = 1,
GameSvrStat = 1
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/heartbeat.php")]
[Produces("application/protobuf")]
public IActionResult HeartBeat3209([FromBody] Server.Models.v3209.HeartBeatRequest request)
{
Logger.LogInformation("Heartbeat request: {Request}", request.Stringify());
var response = new Server.Models.v3209.HeartBeatResponse
{
Result = 1,
GameSvrStat = 1
};
return Ok(response);
}
}

View File

@ -0,0 +1,30 @@
namespace Server.Controllers.Game;
[ApiController]
public class InitialDataCheckController : BaseController<InitialDataCheckController>
{
[HttpPost("/v12r08_ww/chassis/initialdatacheck_vaosv643.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> InitialDataCheck([FromBody] InitialdatacheckRequest request)
{
Logger.LogInformation("Initial data check request: {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetInitialDataQuery());
var response = InitialDataMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/initialdatacheck.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> InitialDataCheckCN([FromBody] Server.Models.v3209.InitialdatacheckRequest request)
{
Logger.LogInformation("Initial data check request: {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new GetInitialDataQuery());
var response = InitialDataMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,27 @@
namespace Server.Controllers.Game;
[ApiController]
public class MyDonEntryController : BaseController<MyDonEntryController>
{
[HttpPost("/v12r08_ww/chassis/mydonentry_3nrd7kwk.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetMyDonEntry([FromBody] MydonEntryRequest request)
{
Logger.LogInformation("MyDonEntry request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new AddMyDonEntryCommand(request.AccessCode, request.MydonName, request.MydonNameLanguage));
var response = MyDonEntryMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/mydonentry.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetMyDonEntry3209([FromBody] Server.Models.v3209.MydonEntryRequest request)
{
Logger.LogInformation("MyDonEntry request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new AddMyDonEntryCommand(request.WechatQrStr, request.MydonName, request.MydonNameLanguage));
var response = MyDonEntryMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,46 @@
using Application.Utils;
namespace Server.Controllers.Game;
[ApiController]
public class PlayResultController : BaseController<PlayResultController>
{
[HttpPost("/v12r08_ww/chassis/playresult_r3ky4a4z.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> UploadPlayResult([FromBody] PlayResultRequest request)
{
Logger.LogInformation("PlayResult request : {Request}", request.Stringify());
var truncated = request.PlayresultData.Skip(32).ToArray();
var decompressed = GZipBytesUtil.DecompressGZipBytes(truncated);
var playResultData = Serializer.Deserialize<PlayResultDataRequest>(new ReadOnlySpan<byte>(decompressed));
Logger.LogInformation("Play result data {Data}", playResultData.Stringify());
var commonRequest = PlayResultMappers.Map(playResultData);
var commonResponse = await Mediator.Send(new UpdatePlayResultCommand(request.BaidConf, commonRequest));
var response = new PlayResultResponse
{
Result = commonResponse
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/playresult.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> UploadPlayResult3209([FromBody] Server.Models.v3209.PlayResultRequest request)
{
Logger.LogInformation("PlayResult3209 request : {Request}", request.Stringify());
var decompressed = GZipBytesUtil.DecompressGZipBytes(request.PlayresultData);
var playResultData =
Serializer.Deserialize<Server.Models.v3209.PlayResultDataRequest>(new ReadOnlySpan<byte>(decompressed));
Logger.LogInformation("Play result data 3209 {Data}", playResultData.Stringify());
var commonRequest = PlayResultMappers.Map(playResultData);
var commonResponse = await Mediator.Send(new UpdatePlayResultCommand((uint) request.BaidConf, commonRequest));
var response = new Server.Models.v3209.PlayResultResponse
{
Result = commonResponse
};
return Ok(response);
}
}

View File

@ -0,0 +1,33 @@
namespace Server.Controllers.Game;
[ApiController]
public class RewardItemController : BaseController<RewardItemController>
{
[HttpPost("/v12r08_ww/chassis/rewarditem.php")]
[Produces("application/protobuf")]
public IActionResult RewardItem([FromBody] RewardItemRequest request)
{
Logger.LogInformation("RewardItem request : {Request}", request.Stringify());
var response = new RewardItemResponse
{
Result = 1
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/rewarditem.php")]
[Produces("application/protobuf")]
public IActionResult RewardItem3209([FromBody] Server.Models.v3209.RewardItemRequest request)
{
Logger.LogInformation("RewardItem request : {Request}", request.Stringify());
var response = new Server.Models.v3209.RewardItemResponse
{
Result = 1
};
return Ok(response);
}
}

View File

@ -0,0 +1,31 @@
namespace Server.Controllers.Game;
[ApiController]
public class SelfBestController : BaseController<SelfBestController>
{
[HttpPost("/v12r08_ww/chassis/selfbest_5nz47auu.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> SelfBest([FromBody] SelfBestRequest request)
{
Logger.LogInformation("SelfBest request : {Request}", request.Stringify());
var commonResponse =
await Mediator.Send(new GetSelfBestQuery(request.Baid, request.Level, request.ArySongNoes));
var response = SelfBestMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/selfbest.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> SelfBest3209([FromBody] Server.Models.v3209.SelfBestRequest request)
{
Logger.LogInformation("SelfBest3209 request : {Request}", request.Stringify());
var commonResponse =
await Mediator.Send(new GetSelfBestQuery((uint)request.Baid, request.Level, request.ArySongNoes));
var response = SelfBestMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,33 @@
namespace Server.Controllers.Game;
[ApiController]
public class SetAnyStringController : BaseController<SetAnyStringController>
{
[HttpPost("/v12r08_ww/chassis/setanystring_mssxf3bo.php")]
[Produces("application/protobuf")]
public IActionResult SetAnyString([FromBody] SetAnyStringRequest request)
{
Logger.LogInformation("SetAnyString request : {Request}", request.Stringify());
var response = new SetAnyStringResponse
{
Result = 1,
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/setanystring.php")]
[Produces("application/protobuf")]
public IActionResult SetAnyString3209([FromBody] Server.Models.v3209.SetAnyStringRequest request)
{
Logger.LogInformation("SetAnyString request : {Request}", request.Stringify());
var response = new Server.Models.v3209.SetAnyStringResponse
{
Result = 1,
};
return Ok(response);
}
}

View File

@ -0,0 +1,28 @@
namespace Server.Controllers.Game;
[ApiController]
public class SongPurchaseController : BaseController<SongPurchaseController>
{
[HttpPost("/v12r08_ww/chassis/songpurchase_wm2fh5bl.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> SongPurchase([FromBody] SongPurchaseRequest request)
{
Logger.LogInformation("SongPurchase request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(SongPurchaseMappers.MapToCommand(request));
var response = SongPurchaseMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/songpurchase.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> SongPurchase3209([FromBody] Server.Models.v3209.SongPurchaseRequest request)
{
Logger.LogInformation("SongPurchase request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(SongPurchaseMappers.MapToCommand(request));
var response = SongPurchaseMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,28 @@
using taiko.vsinterface;
namespace Server.Controllers.Game;
[ApiController]
[Route("/v01r00/chassis/startupauth.php")]
public class StartupAuthController : BaseController<StartupAuthController>
{
[HttpPost]
[Produces("application/protobuf")]
public IActionResult StartupAuth([FromBody] StartupAuthRequest request)
{
Logger.LogInformation("StartupAuth request: {Request}", request.Stringify());
var response = new StartupAuthResponse
{
Result = 1
};
var info = request.AryOperationInfoes.ConvertAll(input =>
new StartupAuthResponse.OperationData
{
KeyData = input.KeyData,
ValueData = input.ValueData
});
response.AryOperationInfoes.AddRange(info);
return Ok(response);
}
}

View File

@ -0,0 +1,33 @@
namespace Server.Controllers.Game;
[ApiController]
public class TournamentCheckController : BaseController<TournamentCheckController>
{
[HttpPost("/v12r08_ww/chassis/tournamentcheck.php")]
[Produces("application/protobuf")]
public IActionResult TournamentCheck([FromBody] TournamentcheckRequest request)
{
Logger.LogInformation("TournamentCheck request : {Request}", request.Stringify());
var response = new TournamentcheckResponse
{
Result = 1,
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/tournamentcheck.php")]
[Produces("application/protobuf")]
public IActionResult TournamentCheck3209([FromBody] Server.Models.v3209.TournamentcheckRequest request)
{
Logger.LogInformation("TournamentCheck request : {Request}", request.Stringify());
var response = new Server.Models.v3209.TournamentcheckResponse
{
Result = 1,
};
return Ok(response);
}
}

View File

@ -0,0 +1,29 @@
namespace Server.Controllers.Game;
[ApiController]
public class UserDataController : BaseController<UserDataController>
{
[HttpPost("/v12r08_ww/chassis/userdata_gc6x17o8.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetUserData([FromBody] UserDataRequest request)
{
Logger.LogInformation("UserData request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new UserDataQuery(request.Baid));
var response = UserDataMappers.MapTo3906(commonResponse);
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/userdata.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> GetUserData3209([FromBody] Server.Models.v3209.UserDataRequest request)
{
Logger.LogInformation("UserData request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new UserDataQuery((uint)request.Baid));
var response = UserDataMappers.MapTo3209(commonResponse);
return Ok(response);
}
}

View File

@ -0,0 +1,38 @@
namespace Server.Controllers.Game;
[ApiController]
public class VerifyQrCodeController : BaseController<VerifyQrCodeController>
{
[HttpPost("/v12r08_ww/chassis/verifyqrcode_ku5ra5q7.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> VerifyQrCode([FromBody] VerifyQrcodeRequest request)
{
Logger.LogInformation("VerifyQrCode request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new VerifyQrQuery(request.QrcodeSerial));
var response = new VerifyQrcodeResponse
{
Result = commonResponse.IsQrValid ? 1u : 51u,
QrcodeId = commonResponse.QrCodeId
};
return Ok(response);
}
[HttpPost("/v12r00_cn/chassis/verifyqrcode.php")]
[Produces("application/protobuf")]
public async Task<IActionResult> VerifyQrCode3209([FromBody] Server.Models.v3209.VerifyQrcodeRequest request)
{
Logger.LogInformation("VerifyQrCode request : {Request}", request.Stringify());
var commonResponse = await Mediator.Send(new VerifyQrQuery(request.QrcodeSerial));
var response = new Models.v3209.VerifyQrcodeResponse
{
Result = commonResponse.IsQrValid ? 1u : 51u,
QrcodeId = commonResponse.QrCodeId
};
return Ok(response);
}
}

View File

@ -0,0 +1,40 @@
using Garm;
using google.type;
namespace Server.Controllers.Garmc;
[Route("/v1/s12-jp-dev/garm.Monitoring/Ping")]
[ApiController]
public class PingController : BaseController<PingController>
{
[HttpPost]
[Produces("application/protobuf")]
public async Task<PingResponse> Ping()
{
HttpContext.Request.EnableBuffering();
var body = await HttpContext.Request.BodyReader.ReadAsync();
var request = Serializer.Deserialize<PingRequest>(body.Buffer);
Logger.LogInformation("Ping request: {Request}", request.Stringify());
var response = new PingResponse
{
ServerRecvTime = DateTime.UtcNow - TimeSpan.FromMilliseconds(50),
ServerSendTime = DateTime.UtcNow + TimeSpan.FromMilliseconds(50),
ClientIp = "127.0.0.1",
GeoData = new GeoData
{
Country = "JPN",
Region = "Kanto",
City = "Tokyo",
Latlng = new LatLng
{
Latitude = 114.0,
Longitude = 514.0
}
},
UnderMaintenance = false,
AcidAvailable = true
};
Response.Headers.Append("x-drpc-code", "0");
return response;
}
}

View File

@ -0,0 +1,24 @@
using Garm;
namespace Server.Controllers.Garmc;
[Route("/v1/s12-jp-dev/garm.SystemBoard/RegisterSystemBoardBilling")]
[ApiController]
public class RegisterSystemBoardBillingController : BaseController<RegisterSystemBoardBillingController>
{
[HttpPost]
[Produces("application/protobuf")]
public async Task<RegisterSystemBoardBillingResponse> RegisterSystemBoardBilling()
{
HttpContext.Request.EnableBuffering();
var body = await HttpContext.Request.BodyReader.ReadAsync();
var request = Serializer.Deserialize<RegisterSystemBoardBillingRequest>(body.Buffer);
Logger.LogInformation("RegisterSystemBoardBilling request: {Request}", request.Stringify());
var response = new RegisterSystemBoardBillingResponse
{
TooMany = false
};
Response.Headers.Append("x-drpc-code", "0");
return response;
}
}

View File

@ -0,0 +1,24 @@
using Garm;
namespace Server.Controllers.Garmc;
[Route("/v1/s12-jp-dev/garm.SystemBoard/RegisterSystemBoard")]
[ApiController]
public class RegisterSystemBoardController : BaseController<RegisterSystemBoardController>
{
[HttpPost]
[Produces("application/protobuf")]
public async Task<RegisterSystemBoardResponse> RegisterSystemBoard()
{
HttpContext.Request.EnableBuffering();
var body = await HttpContext.Request.BodyReader.ReadAsync();
var request = Serializer.Deserialize<RegisterSystemBoardRequest>(body.Buffer);
Logger.LogInformation("RegisterSystemBoard request: {Request}", request.Stringify());
var response = new RegisterSystemBoardResponse
{
Token = "114514"
};
Response.Headers.Append("x-drpc-code", "0");
return response;
}
}

View File

@ -0,0 +1,54 @@
using System.Buffers;
using System.Text;
using System.Text.Json.Serialization;
namespace Server.Controllers.MuchaActivation;
public class OtkResponse
{
[JsonPropertyName("status")]
public int Status { get; set; }
[JsonPropertyName("message")]
public string? Message { get; set; }
[JsonPropertyName("otk")]
public string? Otk { get; set; }
[JsonPropertyName("uuid")]
public string? Uuid { get; set; }
[JsonPropertyName("expiredAt")]
public string? ExpiredAt { get; set; }
}
[Route("/mucha_activation/otk")]
[ApiController]
public class OtkController : BaseController<OtkController>
{
[HttpPost]
public async Task<OtkResponse> Otk()
{
HttpContext.Request.EnableBuffering();
var body = await HttpContext.Request.BodyReader.ReadAsync();
var json = Encoding.UTF8.GetString(body.Buffer.ToArray());
Logger.LogInformation("MuchaActivation request: {Request}", json);
var expiredAt = DateTime.Now.AddDays(10).ToString("yyyy-MM-ddThh:mm:ssZ");
// Generate a random string otk with randomNumberGenerator
var random = new Random();
var randomNumber = random.Next(10000000, 99999999);
var otk = randomNumber.ToString();
var g = Guid.NewGuid();
var uuid = g.ToString();
var response = new OtkResponse
{
Status = 200,
Message = "Success",
Otk = otk,
Uuid = uuid,
ExpiredAt = expiredAt
};
return response;
}
}

View File

@ -0,0 +1,39 @@
using System.Buffers;
using System.Text;
using System.Text.Json.Serialization;
namespace Server.Controllers.MuchaActivation;
public class SignatureResponse
{
[JsonPropertyName("status")]
public int Status { get; set; }
[JsonPropertyName("message")]
public string? Message { get; set; }
[JsonPropertyName("signature")]
public string? Signature { get; set; }
}
[Route("/mucha_activation/signature")]
[ApiController]
public class SignatureController : BaseController<SignatureController>
{
[HttpPost]
public async Task<SignatureResponse> Signature()
{
HttpContext.Request.EnableBuffering();
var body = await HttpContext.Request.BodyReader.ReadAsync();
var json = Encoding.UTF8.GetString(body.Buffer.ToArray());
Logger.LogInformation("Signature request: {Request}", json);
var response = new SignatureResponse
{
Status = 200,
Message = "Success",
Signature = "1220"
};
return response;
}
}

View File

@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace Server.Conventions;
public class ControllerHidingConvention : IActionModelConvention
{
public void Apply(ActionModel action)
{
if (action.Controller.ControllerType.Namespace != "TaikoLocalServer.Controllers.Api")
{
action.ApiExplorer.IsVisible = false;
}
}
}

View File

@ -0,0 +1,35 @@
using Serilog.Events;
using Serilog.Formatting;
namespace Server.Formatters;
public class CsvFormatter: ITextFormatter
{
public void Format(LogEvent logEvent, TextWriter output)
{
logEvent.Properties.TryGetValue("ChassisId", out var chassisId);
logEvent.Properties.TryGetValue("ShopId", out var shopId);
logEvent.Properties.TryGetValue("Baid", out var baid);
logEvent.Properties.TryGetValue("PlayedAt", out var playedAt);
logEvent.Properties.TryGetValue("IsRight", out var isRight);
logEvent.Properties.TryGetValue("Type", out var type);
logEvent.Properties.TryGetValue("Amount", out var amount);
output.Write(logEvent.Timestamp.ToString("yyyy-MM-dd"));
output.Write(",");
output.Write(chassisId);
output.Write(",");
output.Write(shopId);
output.Write(",");
output.Write(baid);
output.Write(",");
output.Write(playedAt);
output.Write(",");
output.Write(isRight);
output.Write(",");
output.Write(type);
output.Write(",");
output.Write(amount);
output.WriteLine();
}
}

22
Server/GlobalUsings.cs Normal file
View File

@ -0,0 +1,22 @@
// Global using directives
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.EntityFrameworkCore;
global using ProtoBuf;
global using MediatR;
global using Swan.Formatters;
global using Application.Handlers.Game;
global using Application.Handlers.Api;
global using Application.Models.Api;
global using Application.Models.Game;
global using Application.Utils;
global using Domain.Enums;
global using Domain.Entities;
global using Domain.Models;
global using Domain.Settings;
global using Domain.Common;
global using Server.Models;
global using Server.Models.v3906;
global using Server.Mappers;
global using Server.Utils;

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class AddTokenCountRequestMapper
{
public static partial CommonAddTokenCountRequest Map(AddTokenCountRequest request);
public static partial CommonAddTokenCountRequest Map(Models.v3209.AddTokenCountRequest request);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class AiDataResponseMapper
{
public static partial GetAiDataResponse MapTo3906(CommonAiDataResponse response);
public static partial Models.v3209.GetAiDataResponse MapTo3209(CommonAiDataResponse response);
}

View File

@ -0,0 +1,21 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class AiScoreMappers
{
[MapProperty(nameof(AiScoreDatum.AiSectionScoreData), nameof(CommonAiScoreResponse.AryBestSectionDatas))]
public static partial CommonAiScoreResponse MapToCommonAiScoreResponse(AiScoreDatum datum);
public static CommonAiScoreResponse MapAsSuccess(AiScoreDatum datum)
{
var response= MapToCommonAiScoreResponse(datum);
response.Result = 1;
return response;
}
public static partial GetAiScoreResponse MapTo3906(CommonAiScoreResponse response);
public static partial Models.v3209.GetAiScoreResponse MapTo3209(CommonAiScoreResponse response);
}

View File

@ -0,0 +1,49 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class BaidResponseMapper
{
public static partial BAIDResponse MapTo3906(CommonBaidResponse commonBaidResponse);
public static BAIDResponse Map3906WithPostProcess(CommonBaidResponse commonBaidResponse)
{
var response = MapTo3906(commonBaidResponse);
response.AryCostumedata = new BAIDResponse.CostumeData
{
Costume1 = commonBaidResponse.CostumeData[0],
Costume2 = commonBaidResponse.CostumeData[1],
Costume3 = commonBaidResponse.CostumeData[2],
Costume4 = commonBaidResponse.CostumeData[3],
Costume5 = commonBaidResponse.CostumeData[4]
};
response.CostumeFlg1 = commonBaidResponse.CostumeFlagArrays[0];
response.CostumeFlg2 = commonBaidResponse.CostumeFlagArrays[1];
response.CostumeFlg3 = commonBaidResponse.CostumeFlagArrays[2];
response.CostumeFlg4 = commonBaidResponse.CostumeFlagArrays[3];
response.CostumeFlg5 = commonBaidResponse.CostumeFlagArrays[4];
return response;
}
public static partial Models.v3209.BAIDResponse MapTo3209(CommonBaidResponse commonBaidResponse);
public static Models.v3209.BAIDResponse Map3209WithPostProcess(CommonBaidResponse commonBaidResponse)
{
var response = MapTo3209(commonBaidResponse);
response.AryCostumedata = new Models.v3209.BAIDResponse.CostumeData
{
Costume1 = commonBaidResponse.CostumeData[0],
Costume2 = commonBaidResponse.CostumeData[1],
Costume3 = commonBaidResponse.CostumeData[2],
Costume4 = commonBaidResponse.CostumeData[3],
Costume5 = commonBaidResponse.CostumeData[4]
};
response.CostumeFlg1 = commonBaidResponse.CostumeFlagArrays[0];
response.CostumeFlg2 = commonBaidResponse.CostumeFlagArrays[1];
response.CostumeFlg3 = commonBaidResponse.CostumeFlagArrays[2];
response.CostumeFlg4 = commonBaidResponse.CostumeFlagArrays[3];
response.CostumeFlg5 = commonBaidResponse.CostumeFlagArrays[4];
return response;
}
}

View File

@ -0,0 +1,11 @@
using Application.Handlers.Api.Auth;
using Riok.Mapperly.Abstractions;
using Shared.Models.Requests;
namespace Server.Mappers;
[Mapper]
public static partial class ChangePasswordCommandMapper
{
public static partial ChangePasswordCommand ToCommand(ChangePasswordRequest request);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class DanDataMappers
{
public static partial GetDanOdaiResponse.OdaiData To3906OdaiData(DanData data);
public static partial Models.v3209.GetDanOdaiResponse.OdaiData To3209OdaiData(DanData data);
}

View File

@ -0,0 +1,10 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class DanScoreMappers
{
public static partial GetDanScoreResponse MapTo3906(CommonDanScoreDataResponse response);
public static partial Models.v3209.GetDanScoreResponse MapTo3209(CommonDanScoreDataResponse response);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class FolderDataMappers
{
public static partial GetfolderResponse MapTo3906(CommonGetFolderResponse response);
public static partial Models.v3209.GetfolderResponse MapTo3209(CommonGetFolderResponse response);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class InitialDataMappers
{
public static partial InitialdatacheckResponse MapTo3906(CommonInitialDataCheckResponse response);
public static partial Models.v3209.InitialdatacheckResponse MapTo3209(CommonInitialDataCheckResponse response);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class MyDonEntryMappers
{
public static partial MydonEntryResponse MapTo3906(CommonMyDonEntryResponse response);
public static partial Models.v3209.MydonEntryResponse MapTo3209(CommonMyDonEntryResponse response);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class PlayResultMappers
{
public static partial CommonPlayResultData Map(PlayResultDataRequest request);
public static partial CommonPlayResultData Map(Models.v3209.PlayResultDataRequest request);
}

View File

@ -0,0 +1,11 @@
using Application.Handlers.Api.Auth;
using Riok.Mapperly.Abstractions;
using Shared.Models.Requests;
namespace Server.Mappers;
[Mapper]
public static partial class RegisterCommandMapper
{
public static partial RegisterCommand ToCommand(RegisterRequest request);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class SelfBestMappers
{
public static partial SelfBestResponse MapTo3906(CommonSelfBestResponse response);
public static partial Models.v3209.SelfBestResponse MapTo3209(CommonSelfBestResponse response);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class ShopFolderDataMappers
{
public static partial GetShopFolderResponse MapTo3906(CommonGetShopFolderResponse response);
public static partial Models.v3209.GetShopFolderResponse MapTo3209(CommonGetShopFolderResponse response);
}

View File

@ -0,0 +1,12 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class SongIntroductionDataMappers
{
public static partial GetSongIntroductionResponse MapTo3906(CommonGetSongIntroductionResponse response);
public static partial Models.v3209.GetSongIntroductionResponse
MapTo3209(CommonGetSongIntroductionResponse response);
}

View File

@ -0,0 +1,15 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class SongPurchaseMappers
{
public static partial SongPurchaseResponse MapTo3906(CommonSongPurchaseResponse response);
public static partial Models.v3209.SongPurchaseResponse MapTo3209(CommonSongPurchaseResponse response);
public static partial PurchaseSongCommand MapToCommand(SongPurchaseRequest request);
public static partial PurchaseSongCommandCN MapToCommand(Models.v3209.SongPurchaseRequest request);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class TokenCountDataMappers
{
public static partial GetTokenCountResponse MapTo3906(CommonGetTokenCountResponse response);
public static partial Models.v3209.GetTokenCountResponse MapTo3209(CommonGetTokenCountResponse response);
}

View File

@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
namespace Server.Mappers;
[Mapper]
public static partial class UserDataMappers
{
public static partial UserDataResponse MapTo3906(CommonUserDataResponse response);
public static partial Models.v3209.UserDataResponse MapTo3209(CommonUserDataResponse response);
}

View File

@ -0,0 +1,52 @@
using System.Net;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
namespace Server.Middlewares;
public class AllNetRequestMiddleware(RequestDelegate next)
{
public async Task InvokeAsync(HttpContext context)
{
if (context.Request.Method != WebRequestMethods.Http.Post)
{
context.Response.StatusCode = StatusCodes.Status405MethodNotAllowed;
return;
}
if (!context.Request.HasFormContentType)
{
await next(context);
return;
}
context.Request.EnableBuffering();
var bodyAsText = await new StreamReader(context.Request.Body).ReadToEndAsync();
var compressed = Convert.FromBase64String(bodyAsText);
var decompressed = Decompress(compressed);
context.Request.Body.Position = 0;
context.Request.Body = decompressed;
context.Request.ContentLength = decompressed.Length;
// Call the next delegate/middleware in the pipeline.
await next(context);
}
private static Stream Decompress(byte[] data)
{
var outputStream = new MemoryStream();
using var compressedStream = new MemoryStream(data);
using var inputStream = new InflaterInputStream(compressedStream);
inputStream.CopyTo(outputStream);
outputStream.Position = 0;
return outputStream;
}
}
public static class AllNetMiddlewareExtensions
{
public static IApplicationBuilder UseAllNetRequestMiddleware(
this IApplicationBuilder builder)
{
return builder.UseMiddleware<AllNetRequestMiddleware>();
}
}

3225
Server/Models/3209/Game.cs Normal file

File diff suppressed because it is too large Load Diff

3381
Server/Models/3906/Game.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,257 @@
// <auto-generated>
// This file was generated by a tool; you should avoid making direct changes.
// Consider using 'partial classes' to extend these types
// Input: my.proto
// </auto-generated>
#region Designer generated code
#pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
namespace taiko.vsinterface
{
[global::ProtoBuf.ProtoContract()]
public partial class StartupAuthRequest : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"chassis_id", IsRequired = true)]
public string ChassisId { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"usbmem_key")]
[global::System.ComponentModel.DefaultValue("")]
public string UsbmemKey
{
get => __pbn__UsbmemKey ?? "";
set => __pbn__UsbmemKey = value;
}
public bool ShouldSerializeUsbmemKey() => __pbn__UsbmemKey != null;
public void ResetUsbmemKey() => __pbn__UsbmemKey = null;
private string __pbn__UsbmemKey;
[global::ProtoBuf.ProtoMember(3, Name = @"hdd_ver", IsRequired = true)]
public uint HddVer { get; set; }
[global::ProtoBuf.ProtoMember(4, Name = @"usbmem_ver")]
public uint UsbmemVer
{
get => __pbn__UsbmemVer.GetValueOrDefault();
set => __pbn__UsbmemVer = value;
}
public bool ShouldSerializeUsbmemVer() => __pbn__UsbmemVer != null;
public void ResetUsbmemVer() => __pbn__UsbmemVer = null;
private uint? __pbn__UsbmemVer;
[global::ProtoBuf.ProtoMember(5, Name = @"shop_id", IsRequired = true)]
public string ShopId { get; set; }
[global::ProtoBuf.ProtoMember(6, Name = @"rack_id")]
[global::System.ComponentModel.DefaultValue("")]
public string RackId
{
get => __pbn__RackId ?? "";
set => __pbn__RackId = value;
}
public bool ShouldSerializeRackId() => __pbn__RackId != null;
public void ResetRackId() => __pbn__RackId = null;
private string __pbn__RackId;
[global::ProtoBuf.ProtoMember(7, Name = @"country_id")]
[global::System.ComponentModel.DefaultValue("")]
public string CountryId
{
get => __pbn__CountryId ?? "";
set => __pbn__CountryId = value;
}
public bool ShouldSerializeCountryId() => __pbn__CountryId != null;
public void ResetCountryId() => __pbn__CountryId = null;
private string __pbn__CountryId;
[global::ProtoBuf.ProtoMember(8, Name = @"ary_operation_info")]
public global::System.Collections.Generic.List<OperationData> AryOperationInfoes { get; } = new global::System.Collections.Generic.List<OperationData>();
[global::ProtoBuf.ProtoContract()]
public partial class OperationData : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"key_data", IsRequired = true)]
public uint KeyData { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"value_data", IsRequired = true)]
public byte[] ValueData { get; set; }
}
}
[global::ProtoBuf.ProtoContract()]
public partial class StartupAuthResponse : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"result", IsRequired = true)]
public uint Result { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"ary_movie_info")]
public global::System.Collections.Generic.List<MovieData> AryMovieInfoes { get; } = new global::System.Collections.Generic.List<MovieData>();
[global::ProtoBuf.ProtoMember(3, Name = @"ary_operation_info")]
public global::System.Collections.Generic.List<OperationData> AryOperationInfoes { get; } = new global::System.Collections.Generic.List<OperationData>();
[global::ProtoBuf.ProtoContract()]
public partial class MovieData : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"movie_id", IsRequired = true)]
public uint MovieId { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"enable_days", IsRequired = true)]
public uint EnableDays { get; set; }
}
[global::ProtoBuf.ProtoContract()]
public partial class OperationData : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"key_data", IsRequired = true)]
public uint KeyData { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"value_data", IsRequired = true)]
public byte[] ValueData { get; set; }
}
}
[global::ProtoBuf.ProtoContract()]
public partial class VerupAuthRequest : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"chassis_id", IsRequired = true)]
public string ChassisId { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"usbmem_key", IsRequired = true)]
public string UsbmemKey { get; set; }
[global::ProtoBuf.ProtoMember(3, Name = @"hdd_ver", IsRequired = true)]
public uint HddVer { get; set; }
[global::ProtoBuf.ProtoMember(4, Name = @"usbmem_ver", IsRequired = true)]
public uint UsbmemVer { get; set; }
[global::ProtoBuf.ProtoMember(5, Name = @"shop_id", IsRequired = true)]
public string ShopId { get; set; }
[global::ProtoBuf.ProtoMember(6, Name = @"rack_id")]
[global::System.ComponentModel.DefaultValue("")]
public string RackId
{
get => __pbn__RackId ?? "";
set => __pbn__RackId = value;
}
public bool ShouldSerializeRackId() => __pbn__RackId != null;
public void ResetRackId() => __pbn__RackId = null;
private string __pbn__RackId;
[global::ProtoBuf.ProtoMember(7, Name = @"country_id")]
[global::System.ComponentModel.DefaultValue("")]
public string CountryId
{
get => __pbn__CountryId ?? "";
set => __pbn__CountryId = value;
}
public bool ShouldSerializeCountryId() => __pbn__CountryId != null;
public void ResetCountryId() => __pbn__CountryId = null;
private string __pbn__CountryId;
}
[global::ProtoBuf.ProtoContract()]
public partial class VerupAuthResponse : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"result", IsRequired = true)]
public uint Result { get; set; }
}
[global::ProtoBuf.ProtoContract()]
public partial class VerupCompleteRequest : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"chassis_id", IsRequired = true)]
public string ChassisId { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"usbmem_key", IsRequired = true)]
public string UsbmemKey { get; set; }
[global::ProtoBuf.ProtoMember(3, Name = @"hdd_ver", IsRequired = true)]
public uint HddVer { get; set; }
[global::ProtoBuf.ProtoMember(4, Name = @"usbmem_ver", IsRequired = true)]
public uint UsbmemVer { get; set; }
[global::ProtoBuf.ProtoMember(5, Name = @"shop_id", IsRequired = true)]
public string ShopId { get; set; }
[global::ProtoBuf.ProtoMember(6, Name = @"rack_id")]
[global::System.ComponentModel.DefaultValue("")]
public string RackId
{
get => __pbn__RackId ?? "";
set => __pbn__RackId = value;
}
public bool ShouldSerializeRackId() => __pbn__RackId != null;
public void ResetRackId() => __pbn__RackId = null;
private string __pbn__RackId;
[global::ProtoBuf.ProtoMember(7, Name = @"country_id")]
[global::System.ComponentModel.DefaultValue("")]
public string CountryId
{
get => __pbn__CountryId ?? "";
set => __pbn__CountryId = value;
}
public bool ShouldSerializeCountryId() => __pbn__CountryId != null;
public void ResetCountryId() => __pbn__CountryId = null;
private string __pbn__CountryId;
}
[global::ProtoBuf.ProtoContract()]
public partial class VerupCompleteResponse : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"result", IsRequired = true)]
public uint Result { get; set; }
}
}
#pragma warning restore CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
#endregion

31
Server/Models/3906/any.cs Normal file
View File

@ -0,0 +1,31 @@
// <auto-generated>
// This file was generated by a tool; you should avoid making direct changes.
// Consider using 'partial classes' to extend these types
// Input: any.proto
// </auto-generated>
#region Designer generated code
#pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
namespace Google.Protobuf.WellKnownTypes
{
[global::ProtoBuf.ProtoContract()]
public partial class Any : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"type_url")]
[global::System.ComponentModel.DefaultValue("")]
public string TypeUrl { get; set; } = "";
[global::ProtoBuf.ProtoMember(2, Name = @"value")]
public byte[] Value { get; set; }
}
}
#pragma warning restore CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
#endregion

View File

@ -0,0 +1,33 @@
// <auto-generated>
// This file was generated by a tool; you should avoid making direct changes.
// Consider using 'partial classes' to extend these types
// Input: date.proto
// </auto-generated>
#region Designer generated code
#pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
namespace google.type
{
[global::ProtoBuf.ProtoContract()]
public partial class Date : global::ProtoBuf.IExtensible
{
private global::ProtoBuf.IExtension __pbn__extensionData;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
=> global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
[global::ProtoBuf.ProtoMember(1, Name = @"year")]
public int Year { get; set; }
[global::ProtoBuf.ProtoMember(2, Name = @"month")]
public int Month { get; set; }
[global::ProtoBuf.ProtoMember(3, Name = @"day")]
public int Day { get; set; }
}
}
#pragma warning restore CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
#endregion

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More