Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions HsMod/Patches/PatchHearthstone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ private static void PatchActorNames(ref Dictionary<string, int> ___m_signatureFr
if (pair.Value == 1)
{
// 9 新版随从的异画样式
result.TryAdd(pair.Key, 9);
result[pair.Key] = 9;
}
else
{
result.TryAdd(pair.Key, pair.Value);
result[pair.Key] = pair.Value;
}
}
}
Expand Down
28 changes: 15 additions & 13 deletions HsMod/WebPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,23 @@ private static string GenerateBtn()
}

private static string GenerateNav(string title)
{
string nav = string.Empty;
if (title != "index")
{
nav = "<center><ul class=\"nav_ui\">";
// Изменено для совместимости с .NET Framework 4.8:
var btns = GenerateBtn().Replace("<br/>", "").Split(new string[] { "<br />" }, StringSplitOptions.None);
foreach (string btn in btns)
{
string nav = string.Empty;
if (title != "index")
{
nav = "<center><ul class=\"nav_ui\">";
var btns = GenerateBtn().Replace("<br/>", "").Split("<br />");
foreach (string btn in btns)
{
nav += $@"<li class=""nav_li"">{btn}</li>";
}
nav += "</ul></center><br />";
}

return nav;
nav += $@"<li class=""nav_li"">{btn}</li>";
}
nav += "</ul></center><br />";
}

return nav;
}


public static StringBuilder Template(string title = "", string body = "", bool useViewport = true)
{
Expand Down
8 changes: 4 additions & 4 deletions HsMod/WebServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static async Task ProcessRequestAsync(HttpListenerContext context)
// Read the JSON from the request body
using (var reader = new StreamReader(request.InputStream))
{
string requestBody = await reader.ReadToEndAsync();
string requestBody = reader.ReadToEnd();
Utils.MyLogger(BepInEx.Logging.LogLevel.Debug, $"POST: {requestBody}");
// Parse JSON and get the "command" field
var json = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(requestBody);
Expand Down Expand Up @@ -123,7 +123,7 @@ private static async Task ProcessRequestAsync(HttpListenerContext context)
// Read the JSON from the request body
using (var reader = new StreamReader(request.InputStream))
{
string requestBody = await reader.ReadToEndAsync();
string requestBody = reader.ReadToEnd();
Utils.MyLogger(BepInEx.Logging.LogLevel.Debug, $"POST: {requestBody}");
// Parse JSON and get the "key" field
var json = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(requestBody);
Expand Down Expand Up @@ -183,7 +183,7 @@ private static async Task ProcessRequestAsync(HttpListenerContext context)
// Read the JSON from the request body
using (var reader = new StreamReader(request.InputStream))
{
string requestBody = await reader.ReadToEndAsync();
string requestBody = reader.ReadToEnd();
Utils.MyLogger(BepInEx.Logging.LogLevel.Debug, $"POST: {requestBody}");
// Parse JSON and get the "key" field
var json = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(requestBody);
Expand Down Expand Up @@ -266,7 +266,7 @@ private static async Task ProcessRequestAsync(HttpListenerContext context)
if (VaildFilePath(preUrl)) // 优先查找本地文件
{
context.Response.ContentType = GetMimeType(Path.GetExtension(preUrl));
var file = await File.ReadAllBytesAsync(preUrl);
var file = File.ReadAllBytes(preUrl);
await context.Response.OutputStream.WriteAsync(file, 0, file.Length);
}
else if (rawUrLower == "/safeimg")
Expand Down
Loading