mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-12 19:24:34 +01:00
Http w/ dispatch
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -360,4 +360,8 @@ MigrationBackup/
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
FodyWeavers.xsd
|
||||
|
||||
# Personal
|
||||
!.gitkeep
|
||||
Common/Resources/**
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Config.Net" Version="5.1.5" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.19.1" />
|
||||
<PackageReference Include="protobuf-net" Version="3.2.16" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
67
Common/Database/User.cs
Normal file
67
Common/Database/User.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Bson;
|
||||
using Common.Resources.Proto;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Common.Database
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public static readonly IMongoCollection<UserScheme> collection = Global.db.GetCollection<UserScheme>("Users");
|
||||
|
||||
public static UserScheme CreateUser(string name)
|
||||
{
|
||||
UserScheme user = new()
|
||||
{
|
||||
Name = name,
|
||||
Uid = 1001,
|
||||
Nick = "",
|
||||
Exp = 0,
|
||||
Hcoin = 0,
|
||||
Stamina = 80,
|
||||
SelfDesc = "",
|
||||
IsFirstLogin = true,
|
||||
Token = Guid.NewGuid(),
|
||||
WarshipId = 0,
|
||||
WarshipAvatar = new WarshipAvatarData()
|
||||
{
|
||||
WarshipFirstAvatarId = 101,
|
||||
WarshipSecondAvatarId = 0
|
||||
},
|
||||
AssistantAvatarId = 101,
|
||||
BirthDate = 0,
|
||||
AvatarTeamList = new List<AvatarTeam> { new AvatarTeam { AvatarIdLists = new uint[] { 101 }, StageType = ((uint)StageType.StageStory) } },
|
||||
CustomAvatarTeamList = new List<CustomAvatarTeam> { }
|
||||
};
|
||||
|
||||
collection.InsertOne(user);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
public class UserScheme
|
||||
{
|
||||
public ObjectId Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public uint Uid { get; set; }
|
||||
public string Nick { get; set; }
|
||||
public int Exp { get; set; }
|
||||
public int Hcoin { get; set; }
|
||||
public int Stamina { get; set; }
|
||||
public string SelfDesc { get; set; }
|
||||
public bool IsFirstLogin { get; set; }
|
||||
|
||||
[BsonGuidRepresentation(GuidRepresentation.Standard)]
|
||||
public Guid Token { get; set; }
|
||||
public int WarshipId { get; set; }
|
||||
public WarshipAvatarData WarshipAvatar { get; set; }
|
||||
public int AssistantAvatarId { get; set; }
|
||||
public int BirthDate { get; set; }
|
||||
public List<AvatarTeam> AvatarTeamList { get; set; }
|
||||
public List<CustomAvatarTeam> CustomAvatarTeamList { get; set; }
|
||||
}
|
||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +1,61 @@
|
||||
using Config.Net;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public static class Global
|
||||
{
|
||||
public static IConfig config = new ConfigurationBuilder<IConfig>().UseJsonFile("config.json").Build();
|
||||
|
||||
public static MongoClient MongoClient = new MongoClient(config.DatabaseUri);
|
||||
public static IMongoDatabase db = MongoClient.GetDatabase("PemukulPaku");
|
||||
public static long GetUnixInSeconds() => ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds();
|
||||
}
|
||||
|
||||
public interface IConfig
|
||||
{
|
||||
[Option(DefaultValue = VerboseLevel.Normal)]
|
||||
[Option(DefaultValue = VerboseLevel.Warns)]
|
||||
VerboseLevel VerboseLevel { get; }
|
||||
|
||||
[Option(DefaultValue = "mongodb://localhost:27017/crepebh")]
|
||||
string DatabaseUri { get; }
|
||||
[Option(DefaultValue = false)]
|
||||
bool UseLocalCache { get; }
|
||||
|
||||
[Option(DefaultValue = "mongodb://localhost:27017/PemukulPaku")]
|
||||
string DatabaseUri { get; }
|
||||
|
||||
[Option]
|
||||
IGameserver Gameserver { get; }
|
||||
|
||||
[Option]
|
||||
IHttp Http { get; }
|
||||
|
||||
public interface IGameserver
|
||||
{
|
||||
[Option(DefaultValue = "127.0.0.1")]
|
||||
public string Host { get; }
|
||||
|
||||
[Option(DefaultValue = (uint)(16100))]
|
||||
public uint Port { get; }
|
||||
|
||||
[Option(DefaultValue = "overseas01")]
|
||||
public string RegionName { get; }
|
||||
}
|
||||
|
||||
public interface IHttp
|
||||
{
|
||||
|
||||
[Option(DefaultValue = (uint)(80))]
|
||||
public uint HttpPort { get; }
|
||||
|
||||
[Option(DefaultValue = (uint)(443))]
|
||||
public uint HttpsPort { get; }
|
||||
}
|
||||
}
|
||||
|
||||
public enum VerboseLevel
|
||||
{
|
||||
Normal = 0,
|
||||
Debug = 1
|
||||
Errors = 0,
|
||||
Warns = 1,
|
||||
Debug = 2
|
||||
}
|
||||
}
|
||||
297
HttpServer/Controllers/DispatchController.cs
Normal file
297
HttpServer/Controllers/DispatchController.cs
Normal file
@@ -0,0 +1,297 @@
|
||||
using HttpServer.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Common;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace HttpServer.Controllers
|
||||
{
|
||||
public class DispatchController
|
||||
{
|
||||
public static void AddHandlers(WebApplication app)
|
||||
{
|
||||
app.Map("/query_dispatch", (ctx) =>
|
||||
{
|
||||
QueryDispatch rsp = new()
|
||||
{
|
||||
Retcode = 0,
|
||||
RegionList = new Region[] {
|
||||
new Region() {
|
||||
Retcode = 0,
|
||||
DispatchUrl = $"http://{Global.config.Gameserver.Host}/query_gateway",
|
||||
Name = Global.config.Gameserver.RegionName,
|
||||
Title = "",
|
||||
Ext = GetExt(ctx.Request.Query["version"].ToString())
|
||||
}
|
||||
}
|
||||
};
|
||||
return ctx.Response.WriteAsync(JsonConvert.SerializeObject(rsp));
|
||||
});
|
||||
|
||||
app.Map("/query_gateway", (ctx) =>
|
||||
{
|
||||
string Version = ctx.Request.Query["version"].ToString();
|
||||
Gameserver Gameserver = new()
|
||||
{
|
||||
Ip = Global.config.Gameserver.Host,
|
||||
Port = Global.config.Gameserver.Port
|
||||
};
|
||||
|
||||
QueryGateway rsp = new()
|
||||
{
|
||||
Retcode = 0,
|
||||
Msg = "",
|
||||
RegionName = Global.config.Gameserver.RegionName,
|
||||
AccountUrl = $"http://{Global.config.Gameserver.Host}/account",
|
||||
AccountUrlBackup = $"http://{Global.config.Gameserver.Host}/account",
|
||||
AssetBundleUrlList = GetAssetBundleUrlList(Version),
|
||||
ExAudioAndVideoUrlList = GetExAudioAndVideoUrlList(Version),
|
||||
ExResourceUrlList = GetExResourceUrlList(Version),
|
||||
Ext = GetExt(Version),
|
||||
Gameserver = Gameserver,
|
||||
Gateway = Gameserver,
|
||||
IsDataReady = true,
|
||||
OaserverUrl = $"http://{Global.config.Gameserver.Host}/oaserver",
|
||||
ServerCurTime = Global.GetUnixInSeconds(),
|
||||
ServerCurTimezone = 8,
|
||||
ServerExt = new ServerExt()
|
||||
{
|
||||
CdkeyUrl = $"http://{Global.config.Gameserver.Host}/common",
|
||||
MihoyoSdkEnv = "2"
|
||||
}
|
||||
};
|
||||
return ctx.Response.WriteAsync(JsonConvert.SerializeObject(rsp));
|
||||
});
|
||||
}
|
||||
|
||||
public static Ext GetExt(string version)
|
||||
{
|
||||
return new Ext()
|
||||
{
|
||||
AiUseAssetBoundle = "1",
|
||||
ApmLogLevel = "2",
|
||||
ApmSwitch = "1",
|
||||
ApmSwitchCrash = "1",
|
||||
DataUseAssetBoundle = "1",
|
||||
EnableWatermark = "1",
|
||||
ExAudioAndVideoUrlList = GetExAudioAndVideoUrlList(version),
|
||||
ExResPrePublish = "0",
|
||||
ExResUseHttp = "0",
|
||||
ExResourceUrlList = GetExResourceUrlList(version),
|
||||
ForbidRecharge = "1",
|
||||
IsChecksumOff = "1",
|
||||
OfflineReportSwitch = "1",
|
||||
ResUseAssetBoundle = "1",
|
||||
ShowVersionText = "0",
|
||||
UpdateStreamingAsb = "1",
|
||||
UseMultyCdn = "1",
|
||||
ApmLogDest = "2",
|
||||
ApmSwitchGameLog = "1",
|
||||
BlockErrorDialog = "1",
|
||||
ElevatorModelPath = "GameEntry/EVA/StartLoading_Model",
|
||||
ExResBuffSize = "10485760",
|
||||
IsXxxx = "1",
|
||||
MtpSwitch = "0",
|
||||
NetworkFeedbackEnable = "0",
|
||||
ShowBulletinButton = "0",
|
||||
ShowBulletinEmptyDialogBg = "0"
|
||||
};
|
||||
}
|
||||
|
||||
public static string[] GetAssetBundleUrlList(string version)
|
||||
{
|
||||
Regex regex = new Regex(@"^(.*?)_(os|gf|global)_(.*?)$");
|
||||
Match matches = regex.Match(version);
|
||||
|
||||
if (matches.Success)
|
||||
{
|
||||
string type = matches.Groups[2].Value; // get the second group (os or gf)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case "os":
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"http://{Global.config.Gameserver.Host}/asset_bundle/overseas01/1.1",
|
||||
$"http://{Global.config.Gameserver.Host}/asset_bundle/overseas01/1.1"
|
||||
} : new string[]
|
||||
{
|
||||
"https://hk-bundle-os-mihayo.akamaized.net/asset_bundle/overseas01/1.1",
|
||||
"https://bundle-aliyun-os.honkaiimpact3.com/asset_bundle/overseas01/1.1"
|
||||
};
|
||||
case "gf":
|
||||
if (version.Contains("beta"))
|
||||
{
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"https://{Global.config.Gameserver.Host}/asset_bundle/beta_release/1.0",
|
||||
$"https://{Global.config.Gameserver.Host}/asset_bundle/beta_release/1.0"
|
||||
} : new string[]
|
||||
{
|
||||
"https://bh3rd-beta-qcloud.bh3.com/asset_bundle/beta_release/1.0",
|
||||
"https://bh3rd-beta.bh3.com/asset_bundle/beta_release/1.0"
|
||||
};
|
||||
}
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"https://{Global.config.Gameserver.Host}/asset_bundle/android01/1.0",
|
||||
$"https://{Global.config.Gameserver.Host}/asset_bundle/android01/1.0"
|
||||
} : new string[]
|
||||
{
|
||||
"https://bundle-qcloud.bh3.com/asset_bundle/android01/1.0",
|
||||
"https://bundle.bh3.com/asset_bundle/android01/1.0"
|
||||
};
|
||||
case "global":
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"https://{Global.config.Gameserver.Host}/asset_bundle/usa01/1.1",
|
||||
$"https://{Global.config.Gameserver.Host}/asset_bundle/usa01/1.1"
|
||||
} : new string[]
|
||||
{
|
||||
"http://hk-bundle-west-mihayo.akamaized.net/asset_bundle/usa01/1.1",
|
||||
"http://bundle-aliyun-usa.honkaiimpact3.com/asset_bundle/usa01/1.1"
|
||||
};
|
||||
default:
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"http://{Global.config.Gameserver.Host}/asset_bundle/overseas01/1.1",
|
||||
$"http://{Global.config.Gameserver.Host}/asset_bundle/overseas01/1.1"
|
||||
} : new string[]
|
||||
{
|
||||
"https://hk-bundle-os-mihayo.akamaized.net/asset_bundle/overseas01/1.1",
|
||||
"https://bundle-aliyun-os.honkaiimpact3.com/asset_bundle/overseas01/1.1"
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"http://{Global.config.Gameserver.Host}/asset_bundle/overseas01/1.1",
|
||||
$"http://{Global.config.Gameserver.Host}/asset_bundle/overseas01/1.1"
|
||||
} : new string[]
|
||||
{
|
||||
"https://hk-bundle-os-mihayo.akamaized.net/asset_bundle/overseas01/1.1",
|
||||
"https://bundle-aliyun-os.honkaiimpact3.com/asset_bundle/overseas01/1.1"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] GetExAudioAndVideoUrlList(string version)
|
||||
{
|
||||
Regex regex = new(@"^(.*?)_(os|gf|global)_(.*?)$");
|
||||
Match matches = regex.Match(version);
|
||||
|
||||
if (matches.Success)
|
||||
{
|
||||
string type = matches.Groups[2].Value; // get the second group (os or gf)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case "os":
|
||||
return new string[] { };
|
||||
case "gf":
|
||||
if (version.Contains("beta"))
|
||||
{
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"{Global.config.Gameserver.Host}/tmp/CGAudio",
|
||||
$"{Global.config.Gameserver.Host}/tmp/CGAudio"
|
||||
} : new string[]
|
||||
{
|
||||
"bh3rd-beta-qcloud.bh3.com/tmp/CGAudio",
|
||||
"bh3rd-beta.bh3.com/tmp/CGAudio"
|
||||
};
|
||||
}
|
||||
return new string[] { };
|
||||
case "global":
|
||||
return new string[] { };
|
||||
default:
|
||||
return new string[] { };
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return new string[] { };
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] GetExResourceUrlList(string version)
|
||||
{
|
||||
Regex regex = new(@"^(.*?)_(os|gf|global)_(.*?)$");
|
||||
Match matches = regex.Match(version);
|
||||
|
||||
if (matches.Success)
|
||||
{
|
||||
string type = matches.Groups[2].Value; // get the second group (os or gf)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case "os":
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"{Global.config.Gameserver.Host}/com.miHoYo.bh3oversea",
|
||||
$"{Global.config.Gameserver.Host}/com.miHoYo.bh3oversea"
|
||||
} : new string[]
|
||||
{
|
||||
"hk-bigfile-os-mihayo.akamaized.net/com.miHoYo.bh3oversea",
|
||||
"bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea"
|
||||
};
|
||||
case "gf":
|
||||
if (version.Contains("beta"))
|
||||
{
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"{Global.config.Gameserver.Host}/tmp/beta",
|
||||
$"{Global.config.Gameserver.Host}/tmp/beta"
|
||||
} : new string[]
|
||||
{
|
||||
"bh3rd-beta-qcloud.bh3.com/tmp/beta",
|
||||
"bh3rd-beta.bh3.com/tmp/beta"
|
||||
};
|
||||
}
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"{Global.config.Gameserver.Host}/tmp/Original",
|
||||
$"{Global.config.Gameserver.Host}/tmp/Original"
|
||||
} : new string[]
|
||||
{
|
||||
"bundle-qcloud.bh3.com/tmp/Original",
|
||||
"bundle.bh3.com/tmp/Original"
|
||||
};
|
||||
case "global":
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"{Global.config.Gameserver.Host}/tmp/com.miHoYo.bh3global",
|
||||
$"{Global.config.Gameserver.Host}/tmp/com.miHoYo.bh3global"
|
||||
} : new string[]
|
||||
{
|
||||
"hk-bundle-west-mihayo.akamaized.net/tmp/com.miHoYo.bh3global",
|
||||
"bigfile-aliyun-usa.honkaiimpact3.com/tmp/com.miHoYo.bh3global"
|
||||
};
|
||||
default:
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"{Global.config.Gameserver.Host}/com.miHoYo.bh3oversea",
|
||||
$"{Global.config.Gameserver.Host}/com.miHoYo.bh3oversea"
|
||||
} : new string[]
|
||||
{
|
||||
"hk-bigfile-os-mihayo.akamaized.net/com.miHoYo.bh3oversea",
|
||||
"bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea"
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Global.config.UseLocalCache ? new string[]
|
||||
{
|
||||
$"{Global.config.Gameserver.Host}/com.miHoYo.bh3oversea",
|
||||
$"{Global.config.Gameserver.Host}/com.miHoYo.bh3oversea"
|
||||
} : new string[]
|
||||
{
|
||||
"hk-bigfile-os-mihayo.akamaized.net/com.miHoYo.bh3oversea",
|
||||
"bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
HttpServer/HttpServer.csproj
Normal file
19
HttpServer/HttpServer.csproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<OutputType>Library</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
186
HttpServer/Models/Dispatch.cs
Normal file
186
HttpServer/Models/Dispatch.cs
Normal file
@@ -0,0 +1,186 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
namespace HttpServer.Models
|
||||
{
|
||||
public partial class QueryDispatch
|
||||
{
|
||||
[JsonProperty("region_list")]
|
||||
public Region[] RegionList { get; set; }
|
||||
|
||||
[JsonProperty("retcode")]
|
||||
public int Retcode { get; set; }
|
||||
}
|
||||
|
||||
public partial class QueryGateway
|
||||
{
|
||||
[JsonProperty("account_url")]
|
||||
public string AccountUrl { get; set; }
|
||||
|
||||
[JsonProperty("account_url_backup")]
|
||||
public string AccountUrlBackup { get; set; }
|
||||
|
||||
[JsonProperty("asset_bundle_url_list")]
|
||||
public string[] AssetBundleUrlList { get; set; }
|
||||
|
||||
[JsonProperty("ex_audio_and_video_url_list")]
|
||||
public object[] ExAudioAndVideoUrlList { get; set; }
|
||||
|
||||
[JsonProperty("ex_resource_url_list")]
|
||||
public string[] ExResourceUrlList { get; set; }
|
||||
|
||||
[JsonProperty("ext")]
|
||||
public Ext Ext { get; set; }
|
||||
|
||||
[JsonProperty("gameserver")]
|
||||
public Gameserver Gameserver { get; set; }
|
||||
|
||||
[JsonProperty("gateway")]
|
||||
public Gameserver Gateway { get; set; }
|
||||
|
||||
[JsonProperty("is_data_ready")]
|
||||
public bool IsDataReady { get; set; }
|
||||
|
||||
[JsonProperty("msg")]
|
||||
public string Msg { get; set; }
|
||||
|
||||
[JsonProperty("oaserver_url")]
|
||||
public string OaserverUrl { get; set; }
|
||||
|
||||
[JsonProperty("region_name")]
|
||||
public string RegionName { get; set; }
|
||||
|
||||
[JsonProperty("retcode")]
|
||||
public int Retcode { get; set; }
|
||||
|
||||
[JsonProperty("server_cur_time")]
|
||||
public long ServerCurTime { get; set; }
|
||||
|
||||
[JsonProperty("server_cur_timezone")]
|
||||
public long ServerCurTimezone { get; set; }
|
||||
|
||||
[JsonProperty("server_ext")]
|
||||
public ServerExt ServerExt { get; set; }
|
||||
}
|
||||
|
||||
public partial class Ext
|
||||
{
|
||||
[JsonProperty("ai_use_asset_boundle")]
|
||||
public string AiUseAssetBoundle { get; set; }
|
||||
|
||||
[JsonProperty("apm_log_dest")]
|
||||
public string ApmLogDest { get; set; }
|
||||
|
||||
[JsonProperty("apm_log_level")]
|
||||
public string ApmLogLevel { get; set; }
|
||||
|
||||
[JsonProperty("apm_switch")]
|
||||
public string ApmSwitch { get; set; }
|
||||
|
||||
[JsonProperty("apm_switch_crash")]
|
||||
public string ApmSwitchCrash { get; set; }
|
||||
|
||||
[JsonProperty("apm_switch_game_log")]
|
||||
public string ApmSwitchGameLog { get; set; }
|
||||
|
||||
[JsonProperty("block_error_dialog")]
|
||||
public string BlockErrorDialog { get; set; }
|
||||
|
||||
[JsonProperty("data_use_asset_boundle")]
|
||||
public string DataUseAssetBoundle { get; set; }
|
||||
|
||||
[JsonProperty("enable_watermark")]
|
||||
public string EnableWatermark { get; set; }
|
||||
|
||||
[JsonProperty("elevator_model_path")]
|
||||
public string ElevatorModelPath { get; set; }
|
||||
|
||||
[JsonProperty("ex_audio_and_video_url_list")]
|
||||
public string[] ExAudioAndVideoUrlList { get; set; }
|
||||
|
||||
[JsonProperty("ex_res_buff_size")]
|
||||
public string ExResBuffSize { get; set; }
|
||||
|
||||
[JsonProperty("ex_res_pre_publish")]
|
||||
public string ExResPrePublish { get; set; }
|
||||
|
||||
[JsonProperty("ex_res_use_http")]
|
||||
public string ExResUseHttp { get; set; }
|
||||
|
||||
[JsonProperty("ex_resource_url_list")]
|
||||
public string[] ExResourceUrlList { get; set; }
|
||||
|
||||
[JsonProperty("forbid_recharge")]
|
||||
public string ForbidRecharge { get; set; }
|
||||
|
||||
[JsonProperty("is_checksum_off")]
|
||||
public string IsChecksumOff { get; set; }
|
||||
|
||||
[JsonProperty("is_xxxx")]
|
||||
public string IsXxxx { get; set; }
|
||||
|
||||
[JsonProperty("mtp_switch")]
|
||||
public string MtpSwitch { get; set; }
|
||||
|
||||
[JsonProperty("network_feedback_enable")]
|
||||
public string NetworkFeedbackEnable { get; set; }
|
||||
|
||||
[JsonProperty("offline_report_switch")]
|
||||
public string OfflineReportSwitch { get; set; }
|
||||
|
||||
[JsonProperty("res_use_asset_boundle")]
|
||||
public string ResUseAssetBoundle { get; set; }
|
||||
|
||||
[JsonProperty("show_bulletin_button")]
|
||||
public string ShowBulletinButton { get; set; }
|
||||
|
||||
[JsonProperty("show_bulletin_empty_dialog_bg")]
|
||||
public string ShowBulletinEmptyDialogBg { get; set; }
|
||||
|
||||
[JsonProperty("show_version_text")]
|
||||
public string ShowVersionText { get; set; }
|
||||
|
||||
[JsonProperty("update_streaming_asb")]
|
||||
public string UpdateStreamingAsb { get; set; }
|
||||
|
||||
[JsonProperty("use_multy_cdn")]
|
||||
public string UseMultyCdn { get; set; }
|
||||
}
|
||||
|
||||
public partial class Gameserver
|
||||
{
|
||||
[JsonProperty("ip")]
|
||||
public string Ip { get; set; }
|
||||
|
||||
[JsonProperty("port")]
|
||||
public uint Port { get; set; }
|
||||
}
|
||||
|
||||
public partial class Region
|
||||
{
|
||||
[JsonProperty("dispatch_url")]
|
||||
public string DispatchUrl { get; set; }
|
||||
|
||||
[JsonProperty("ext")]
|
||||
public Ext Ext { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("retcode")]
|
||||
public int Retcode { get; set; }
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
}
|
||||
|
||||
public partial class ServerExt
|
||||
{
|
||||
[JsonProperty("cdkey_url")]
|
||||
public string CdkeyUrl { get; set; }
|
||||
|
||||
[JsonProperty("mihoyo_sdk_env")]
|
||||
public string MihoyoSdkEnv { get; set; }
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
24
HttpServer/Program.cs
Normal file
24
HttpServer/Program.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Common;
|
||||
using HttpServer.Controllers;
|
||||
|
||||
namespace HttpServer
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
Thread.CurrentThread.IsBackground = true;
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UsePathBase("/");
|
||||
app.Urls.Add($"http://*:{Global.config.Http.HttpPort}");
|
||||
app.Urls.Add($"https://*:{Global.config.Http.HttpsPort}");
|
||||
|
||||
DispatchController.AddHandlers(app);
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
31
HttpServer/Properties/launchSettings.json
Normal file
31
HttpServer/Properties/launchSettings.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:64847",
|
||||
"sslPort": 44333
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"HttpServer": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7227;http://localhost:5186",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
HttpServer/appsettings.Development.json
Normal file
8
HttpServer/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
10
HttpServer/appsettings.json
Normal file
10
HttpServer/appsettings.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Trace",
|
||||
"System": "Information",
|
||||
"Microsoft": "None"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
@@ -14,11 +14,14 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="protobuf-net" Version="3.2.16" />
|
||||
<Compile Remove="HttpServer\**" />
|
||||
<EmbeddedResource Remove="HttpServer\**" />
|
||||
<None Remove="HttpServer\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Common.csproj" />
|
||||
<ProjectReference Include="Common\Common.csproj" />
|
||||
<ProjectReference Include="HttpServer\HttpServer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PemukulPaku", "PemukulPaku.
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "Common\Common.csproj", "{226D0356-65DE-4DBD-9FF4-7D4B527B02E0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HttpServer", "HttpServer\HttpServer.csproj", "{DA5FFC52-14BB-44ED-B8EA-54012279F644}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -21,6 +23,10 @@ Global
|
||||
{226D0356-65DE-4DBD-9FF4-7D4B527B02E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{226D0356-65DE-4DBD-9FF4-7D4B527B02E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{226D0356-65DE-4DBD-9FF4-7D4B527B02E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DA5FFC52-14BB-44ED-B8EA-54012279F644}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DA5FFC52-14BB-44ED-B8EA-54012279F644}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DA5FFC52-14BB-44ED-B8EA-54012279F644}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DA5FFC52-14BB-44ED-B8EA-54012279F644}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using PemukulPaku.Resources.Proto;
|
||||
using Common.Resources.Proto;
|
||||
using Common;
|
||||
|
||||
namespace PemukulPaku
|
||||
{
|
||||
@@ -11,6 +12,9 @@ namespace PemukulPaku
|
||||
{
|
||||
Msg = "Hello!"
|
||||
};
|
||||
Console.WriteLine(Global.config.Gameserver.Host);
|
||||
new Thread(HttpServer.Program.Main).Start();
|
||||
Console.ReadKey(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Reference in New Issue
Block a user