allow copy cocogoat import url

This commit is contained in:
HolographicHat
2025-04-09 01:10:21 +08:00
parent 4b052cf6c7
commit 0e7be25b23
3 changed files with 12 additions and 8 deletions

View File

@@ -52,6 +52,7 @@ public static class Export {
var responseText = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
var responseJson = JsonSerializer.Deserialize(responseText, CocogoatResponseContext.Default.CocogoatResponse)!;
var cocogoatUrl = $"https://cocogoat.work/achievement?memo={responseJson.Key}";
Utils.SetQuickEditMode(true);
Console.WriteLine(cocogoatUrl);
if (Utils.ShellOpen(cocogoatUrl))
{

View File

@@ -1,8 +1,5 @@
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.Json;
using Windows.Win32;
using Windows.Win32.System.Console;
using YaeAchievement.Parsers;
using YaeAchievement.res;
using YaeAchievement.Utilities;
@@ -68,11 +65,8 @@ internal static class Program {
}
[ModuleInitializer]
internal static unsafe void SetupConsole() {
var handle = Native.GetStdHandle(STD_HANDLE.STD_INPUT_HANDLE);
CONSOLE_MODE mode = default;
Native.GetConsoleMode(handle, &mode);
Native.SetConsoleMode(handle, mode & ~CONSOLE_MODE.ENABLE_QUICK_EDIT_MODE);
internal static void SetupConsole() {
SetQuickEditMode(false);
Console.InputEncoding = Console.OutputEncoding = Encoding.UTF8;
}

View File

@@ -7,6 +7,7 @@ using System.Net.Sockets;
using System.Runtime.InteropServices;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.System.Console;
using Proto;
using YaeAchievement.res;
using YaeAchievement.Utilities;
@@ -214,4 +215,12 @@ public static class Utils {
}
});
}
public static unsafe void SetQuickEditMode(bool enable) {
var handle = Native.GetStdHandle(STD_HANDLE.STD_INPUT_HANDLE);
CONSOLE_MODE mode = default;
Native.GetConsoleMode(handle, &mode);
mode = enable ? mode | CONSOLE_MODE.ENABLE_QUICK_EDIT_MODE : mode &~CONSOLE_MODE.ENABLE_QUICK_EDIT_MODE;
Native.SetConsoleMode(handle, mode);
}
}