27 Commits
2.4.1 ... 2.7.0

Author SHA1 Message Date
HolographicHat
c60d3a3b82 v2.7 2023-04-12 12:28:03 +08:00
HolographicHat
58dcd5b228 Fix 2023-04-02 18:23:58 +08:00
HolographicHat
a72007ffa6 Merge remote-tracking branch 'origin/master' 2023-04-02 16:20:23 +08:00
HolographicHat
d3b9d10d01 #55 2023-04-02 16:17:11 +08:00
HolographicHat
69184fa59d Auto compile protos 2023-03-30 08:54:50 +08:00
HolographicHat
8473336b37 Update Tutorial.md 2023-03-01 20:57:42 +08:00
HolographicHat
ffc0854291 bump version to 2.6.0 2023-03-01 20:48:45 +08:00
HolographicHat
3b2b1fba49 fix ci 2023-02-28 19:59:46 +08:00
HolographicHat
c325b5f754 3.5 2023-02-28 19:16:51 +08:00
HolographicHat
8e2e438c96 fix ci 2023-02-27 20:01:23 +08:00
HolographicHat
9bc2cdb443 Update actions .net version 2023-02-27 19:47:06 +08:00
HolographicHat
826ed661cd Merge pull request #51 from Lightczx/master
Use Microsoft.Windows.CsWin32 to replace manual PInvoke
2023-02-27 19:45:11 +08:00
DismissedLight
5f8ff734f2 fixup native call 2023-02-26 14:41:24 +08:00
DismissedLight
50007c2c53 Use CsWin32 2023-02-26 13:46:03 +08:00
HolographicHat
7512c6fca2 Merge pull request #50 from peaceshi/master
open export dir.
2023-02-21 18:09:06 +08:00
peaceshi
2feae6ddb9 open export dir. 2023-02-20 18:13:05 +08:00
HolographicHat
52ae44f467 fix #49 2023-02-09 21:18:51 +08:00
HolographicHat
d93f6f92c0 Merge pull request #48 from xzm2000/patch-1
Update Tutorial.md
2023-01-25 22:52:54 +08:00
xzm2000
20b59eab7e Update Tutorial.md
update url
2023-01-25 11:23:51 +08:00
HolographicHat
0094b9b959 Update README.md 2023-01-19 15:08:33 +08:00
HolographicHat
24b68fbed1 Merge pull request #46 from Finchaos/patch-1
Create Tutorial.md
2023-01-19 15:04:04 +08:00
HolographicHat
397923d4ad Update and rename tutorial.md to Tutorial.md 2023-01-19 14:54:08 +08:00
Finchaos
0a3482e7b2 Create tutorial.md 2023-01-19 14:21:34 +08:00
HolographicHat
7ae18cfbf0 v2.5 2023-01-18 11:52:00 +08:00
HolographicHat
24cd49fa03 3.4 AchievementAllDataNotify 2023-01-18 02:54:42 +08:00
HolographicHat
f0dbb9162b Use 77.cocogoat.cn 2023-01-18 02:47:20 +08:00
HolographicHat
68ff9c5a25 3.4 native lib 2023-01-18 02:46:54 +08:00
41 changed files with 445 additions and 2377 deletions

View File

@@ -14,15 +14,15 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Publish
run: dotnet publish -o .\publish\
run: dotnet publish --property:OutputPath=.\publish\
- name: Upload artifact
uses: actions/upload-artifact@v3.1.0
with:

4
.gitignore vendored
View File

@@ -10,4 +10,6 @@ riderModule.iml
*.user
*.userosscache
*.sln.docstates
.vs/
.vs/
src/Proto/*

View File

@@ -13,11 +13,7 @@
- 没有窗口大小、游戏语言等要求
## 使用说明
第一次打开需要先设置原神主程序(YuanShen.exe/GenshinImpact.exe)所在路径
![alt](https://upload-bbs.mihoyo.com/upload/2022/04/06/165631158/e540a5a6d50cd5fdee19665435548e00_514247033566841954.jpg)
设置完毕后,等待原神启动
当你看到门时,点击进入游戏,游戏将自动退出
游戏退出后,在程序内输入数字以选择导出到哪个网站/应用
→ [Tutorial.md](Tutorial.md)
## 下载地址
[releases/latest](https://github.com/HolographicHat/YaeAchievement/releases/latest)
@@ -27,7 +23,7 @@
## 常见问题
0. Q: 打不开
A: 安装 [.NET Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.7-windows-x64-installer)
A: 安装 [.NET Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-7.0.3-windows-x64-installer)
1. Q: 原神启动时报错: 数据异常(31-4302)
A: 不要把软件和原神主程序放一起

View File

@@ -30,7 +30,7 @@ After the game exits, enter a number inside the program to select the site/appli
## Frequently asked questions
0. Q: Unable to start
A: Download and install [.NET Runtime 6](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.8-windows-x64-installer)
A: Download and install [.NET Runtime 6](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-7.0.3-windows-x64-installer)
1. Q: Error while Genshin started: Data Exception (31-4302)
A: Don't place software in the directory containing Genshin Impact.

81
Tutorial.md Normal file
View File

@@ -0,0 +1,81 @@
## 使用说明
1.选择正确的下载文件以2.4.1版本为例):
点击该网址https://github.com/HolographicHat/YaeAchievement/releases
点击图中红框圈中的名称为“YaeAchievement.exe”的文件浏览器会自动弹出下载。建议将该文件保存在桌面或者其它易于寻找的文件夹内。
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/1.png)
2.安装启动软件所需文件(若已安装该运行时可忽略此步骤)
点击该网址https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-7.0.3-windows-x64-installer 。
进入网页后浏览器会自动弹出下载,同样地,将文件保存在桌面或者其它易于寻找的文件夹内。
下载完成后打开名称形如dotnet-runtime-x.x.x-win-x64.exe的文件会弹出安装窗口如下图所示。
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/2.png)
直接点击安装即可。
3.打开主程序所需的操作以及成就导出的选择
双击在第一步下载的名称为“YaeAchievement.exe”的文件成功打开后会提示原神正在启动如下图所示。
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/3.png)
原神启动完成后,点击进入游戏即可。
点击进入游戏后原神闪退,工具会提示您选择导出至何种工具,如下图所示。
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/4.png)
此时可根据自己的需要进行选择,一般推荐导出至[0]椰羊以及[4]表格文件(.csv
选择完毕后各工具导出页面如下:
#### 椰羊:
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/5.png)
#### Snap.Hutao
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main//images/6.png)
#### Seelie.me
此时YaeAchievement会提示成就数据已导出。请在保存YaeAchievement的文件夹内找到名称形如export-20xxxxxxxxxxxx-seelie.json的文件。
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/7.png)
然后点击该网址https://seelie.me/settings, 进入网页后选择导入,如下图所示。
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/8.png)
点击导入后选中名称形如export-20xxxxxxxxxxxx-seelie.json的文件如下图所示。
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/9.png)
当弹出如下图所示的提示时表示导入成功。
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/10.png)
此时可选择左栏成就,查看导入的成就数据。
#### 寻空:
![image](https://github.com/Finchaos/yae-markdown-230119/blob/main/images/11.png)
### 各种工具的介绍烦请移步至各工具的官方页面进行查看(下方序号对应导出序号)
0. [椰羊](https://cocogoat.work/achievement)
1. [Snap·HuTao](https://github.com/DGP-Studio/Snap.HuTao)
2. [Paimon.moe](https://paimon.moe/achievement/)
3. [Seelie.me](https://seelie.me/achievements)
4. [寻空](https://github.com/xunkong/xunkong)

View File

@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
@@ -21,8 +21,16 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.21.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Google.Protobuf" Version="3.22.1" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.188-beta">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Grpc.Tools" Version="2.53.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
<ItemGroup>
@@ -31,6 +39,10 @@
<LastGenOutput>App.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Remove="res\Updater.exe" />
<None Remove="src\NativeMethods.json" />
<None Remove="src\NativeMethods.txt" />
<AdditionalFiles Include="src\NativeMethods.json" />
<AdditionalFiles Include="src\NativeMethods.txt" />
<EmbeddedResource Include="res\Updater.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
@@ -44,4 +56,8 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Protobuf Include="res/proto/*.proto" ProtoRoot="res/proto" GrpcServices="None" />
</ItemGroup>
</Project>

View File

@@ -105,7 +105,7 @@
<AdditionalDependencies>detours-x64.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy $(TargetPath) $(ProjectDir)..\bin\Debug\net6.0\win-x64\YaeAchievementLib.dll /y</Command>
<Command>copy $(TargetPath) $(ProjectDir)..\bin\Debug\net7.0-windows\win-x64\YaeAchievementLib.dll /y</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

View File

@@ -5,10 +5,11 @@
using Genshin::ByteArray, Genshin::ClientKcpEvent, Genshin::KcpPacket, Genshin::KcpEventType;
using std::to_string;
HWND unityWnd = 0;
HANDLE hPipe = 0;
HWND unityWnd = nullptr;
HANDLE hPipe = nullptr;
std::set<UINT16> PacketWhitelist = { 179, 130, 156, 2692, 100, 43, 119 }; // ping, token, loginreq
// Allow Protocol: GetPlayerToken, PlayerLogin, AchievementAllDataNotify, Ping
std::set<UINT16> PacketWhitelist = { 190, 196, 189, 176, 2659, 16, 56, 152 };
bool OnPacket(KcpPacket* pkt) {
if (pkt->data == nullptr) return true;
@@ -29,20 +30,21 @@ bool OnPacket(KcpPacket* pkt) {
return false;
}
printf("Passed cmdid: %d\n", ReadMapped<UINT16>(data->vector, 2));
if (ReadMapped<UINT16>(data->vector, 2) == 2692) {
if (ReadMapped<UINT16>(data->vector, 2) == 2659) {
auto headLength = ReadMapped<UINT16>(data->vector, 4);
auto dataLength = ReadMapped<UINT32>(data->vector, 6);
auto iStr = Genshin::ToBase64String(data, 10 + headLength, dataLength, nullptr);
auto cStr = IlStringToString(iStr) + "\n";
auto cStr = ToString(iStr) + "\n";
WriteFile(hPipe, cStr.c_str(), cStr.length(), nullptr, nullptr);
CloseHandle(hPipe);
ExitProcess(0);
auto manager = Genshin::GetSingletonInstance(Genshin::GetSingletonManager(), il2cpp_string_new("GameManager"));
Genshin::ForceQuit(manager);
}
delete[] data;
return true;
}
std::map<INT, UINT> signatures;
std::string checksum;
namespace Hook {
@@ -51,7 +53,7 @@ namespace Hook {
}
void SetVersion(void* obj, Il2CppString* value, void* method) {
auto version = IlStringToString(value);
auto version = ToString(value);
value = string_new(version + " YaeAchievement");
CALL_ORIGIN(SetVersion, obj, value, method);
}
@@ -65,7 +67,17 @@ namespace Hook {
}
ByteArray* UnityEngine_RecordUserData(INT type) {
return GCHandle_GetObject<ByteArray>(signatures[type]);
return Genshin::GetBytes(Genshin::GetDefaultEncoding(), il2cpp_string_new(""));
}
VOID SetChecksum(LPVOID obj, Il2CppString* value) {
CALL_ORIGIN(SetChecksum, obj, il2cpp_string_new(checksum.c_str()));
}
VOID RequestLogin(LPVOID obj, LPVOID token, UINT32 uid) {
HookManager::install(Genshin::SetChecksum, SetChecksum);
CALL_ORIGIN(RequestLogin, obj, token, uid);
HookManager::detach(SetChecksum);
}
}
@@ -74,21 +86,21 @@ void Run(HMODULE* phModule) {
//freopen_s((FILE**)stdout, "CONOUT$", "w", stdout);
while (
GetModuleHandle("UserAssembly.dll") == nullptr ||
(unityWnd = FindMainWindowByPID(GetCurrentProcessId())) == 0
(unityWnd = FindMainWindowByPID(GetCurrentProcessId())) == nullptr
) {
Sleep(1000);
}
Sleep(5000);
DisableVMProtect();
InitIL2CPP();
for (int i = 0; i < 4; i++) {
auto result = Genshin::RecordUserData(i, nullptr);
signatures[i] = GCHandle_New(result, true);
auto enc = Genshin::GetDefaultEncoding();
for (int i = 0; i < 3; i++) {
checksum += ToString(Genshin::GetString(enc, Genshin::RecordUserData(i)));
}
signatures[3] = signatures[2];
HookManager::install(Genshin::KcpSend, Hook::KcpSend);
HookManager::install(Genshin::KcpRecv, Hook::KcpRecv);
HookManager::install(Genshin::SetVersion, Hook::SetVersion);
HookManager::install(Genshin::RequestLogin, Hook::RequestLogin);
HookManager::install(Genshin::UnityEngine_RecordUserData, Hook::UnityEngine_RecordUserData);
hPipe = CreateFile(R"(\\.\pipe\YaeAchievementPipe)", GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
if (hPipe == INVALID_HANDLE_VALUE) {

View File

@@ -1,3 +1 @@
DO_API(0x02974550, 0x02970540, uint32_t, il2cpp_gchandle_new, (Il2CppObject* obj, bool pinned));
DO_API(0x02974260, 0x02970250, Il2CppObject*, il2cpp_gchandle_get_target, (uint32_t gchandle));
DO_API(0x028BF7E0, 0x028BBE80, Il2CppString*, il2cpp_string_new, (const char* str));
DO_API(0x897c10, 0x8951f0, Il2CppString*, il2cpp_string_new, (const char* str));

View File

@@ -2,33 +2,30 @@ using namespace Genshin;
// DO_APP_FUNC(CN_OFFSET, OS_OFFSET, RETURN, FUNC_NAME, (ARGS...));
// N: System.Convert$ToBase64String
// L: mscorlib
// S: Ref/E8 ?? ?? ?? ?? 48 8B D8 EB 23 E8
DO_APP_FUNC(0x086B86C0, 0x086B6440, Il2CppString*, ToBase64String, (ByteArray* value, int offset, int length, void* method));
DO_APP_FUNC(0x6790b00, 0x6839fa0, Il2CppString*, ToBase64String, (ByteArray* value, int offset, int length, void* method));
// N: MoleMole.MonoLoginMainPage.version$set
// L: Assembly-CSharp
// S: 84 C0 74 35 B9 52 FA 00 00 E8 ?? ?? ?? ?? 84 C0 74 27 B9 52 FA 00 00 E8 ?? ?? ?? ?? 48 85 C0 74 52 4C 8B C7 48 8B D3 48 8B C8 48 8B 5C 24 30 48 83 C4 20 5F E9
DO_APP_FUNC(0X04186660, 0x04180EC0, void, SetVersion, (void* obj, Il2CppString* value, void* method));
DO_APP_FUNC(0x379bb90, 0x3821a40, void, SetVersion, (void* obj, Il2CppString* value, void* method));
// N: UnityEngine.Application$RecordUserData
// L: UnityEngine.CoreModule
DO_APP_FUNC(0x090BEBC0, 0x090BD710, ByteArray*, RecordUserData, (int32_t nType, void* method));
DO_APP_FUNC(0x7040220, 0x70f3890, ByteArray*, RecordUserData, (int32_t nType));
// N: MoleMole.Packet$XorEncrypt [Obfuscated]
// L: Assembly-CSharp
DO_APP_FUNC(0x0423B270, 0x04235CE0, void, XorEncrypt, (ByteArray** data, int length, void* method));
DO_APP_FUNC(0xf85bf0, 0xf90450, void, XorEncrypt, (ByteArray** data, int length, void* method));
// N: Kcp.KcpNative$kcp_client_send_packet [Obfuscated]
// L: Assembly-CSharp
DO_APP_FUNC(0x042281D0, 0x04222A60, int, KcpSend, (void* client, KcpPacket* pkt, void* method));
DO_APP_FUNC(0x156e740, 0x158a1e0, int, KcpSend, (void* client, KcpPacket* pkt, void* method));
// N: MoleMole.KcpClient$TryDequeueEvent [Obfuscated]
// L: Assembly-CSharp
// S: Ref/public static extern Int32 [A-Z]{11}\(IntPtr [A-Z]{11}, [A-Z]{11}& [A-Z]{11}\)
DO_APP_FUNC(0x02BAFFF0, 0x02BAC3D0, bool, KcpRecv, (void* client, ClientKcpEvent* evt, void* method));
DO_APP_FUNC(0x2ce2040, 0x2d44790, bool, KcpRecv, (void* client, ClientKcpEvent* evt, void* method));
DO_APP_FUNC(0x08A43710, 0x08A41130, LPVOID, GetDefaultEncoding, (void* method));
DO_APP_FUNC(0x6a4e700, 0x6afb5e0, LPVOID, GetDefaultEncoding, ());
DO_APP_FUNC(0x08A42FB0, 0x08A409B0, Il2CppString*, GetString, (LPVOID encoding, LPVOID bytes, void* method));
DO_APP_FUNC(0x6a4dfb0, 0x6afae80, Il2CppString*, GetString, (LPVOID encoding, LPVOID bytes));
DO_APP_FUNC(0x6a4ce50, 0x6af9d50, ByteArray*, GetBytes, (LPVOID encoding, LPVOID str));
DO_APP_FUNC(0x36a1260, 0x3723bc0, VOID, RequestLogin, (LPVOID obj, LPVOID token, UINT uid));
DO_APP_FUNC(0x26506b0, 0x1b0c690, VOID, SetChecksum, (LPVOID obj, Il2CppString* value));
DO_APP_FUNC(0xf25990, 0xf2f110, VOID, ForceQuit, (LPVOID obj));
DO_APP_FUNC(0x4aac4c0, 0x4b57410, LPVOID, GetSingletonManager, ());
DO_APP_FUNC(0x4aac1f0, 0x4b57140, LPVOID, GetSingletonInstance, (LPVOID obj, Il2CppString* value));

View File

@@ -1,3 +1,3 @@
using namespace Genshin;
DO_UNI_FUNC(0x00100300, 0x00100300, ByteArray*, UnityEngine_RecordUserData, (int32_t nType));
DO_UNI_FUNC(0x100640, 0x100640, ByteArray*, UnityEngine_RecordUserData, (int32_t nType));

View File

@@ -4,17 +4,17 @@
VOID DisableVMProtect() {
DWORD oldProtect = 0;
auto ntdll = GetModuleHandleA("ntdll.dll");
BYTE callcode = ((BYTE*)GetProcAddress(ntdll, "NtQuerySection"))[4] - 1;
BYTE restore[] = { 0x4C, 0x8B, 0xD1, 0xB8, callcode };
auto nt_vp = (BYTE*)GetProcAddress(ntdll, "NtProtectVirtualMemory");
VirtualProtect(nt_vp, sizeof(restore), PAGE_EXECUTE_READWRITE, &oldProtect);
memcpy(nt_vp, restore, sizeof(restore));
VirtualProtect(nt_vp, sizeof(restore), oldProtect, &oldProtect);
auto pNtProtectVirtualMemory = GetProcAddress(ntdll, "NtProtectVirtualMemory");
auto pNtQuerySection = GetProcAddress(ntdll, "NtQuerySection");
DWORD old;
VirtualProtect(pNtProtectVirtualMemory, 1, PAGE_EXECUTE_READWRITE, &old);
*(uintptr_t*)pNtProtectVirtualMemory = *(uintptr_t*)pNtQuerySection & ~(0xFFui64 << 32) | (uintptr_t)(*(uint32_t*)((uintptr_t)pNtQuerySection + 4) - 1) << 32;
VirtualProtect(pNtProtectVirtualMemory, 1, old, &old);
}
#pragma region StringConvert
string IlStringToString(Il2CppString* str, UINT codePage) {
string ToString(Il2CppString* str, UINT codePage) {
auto chars = reinterpret_cast<const wchar_t*>(str->chars);
auto len = WideCharToMultiByte(codePage, 0, chars, -1, nullptr, 0, nullptr, nullptr);
auto buffer = new char[len];
@@ -24,14 +24,6 @@ string IlStringToString(Il2CppString* str, UINT codePage) {
#pragma endregion
#pragma region GC
UINT32 GCHandle_New(void* object, bool pinned) {
return il2cpp_gchandle_new((Il2CppObject*)object, pinned);
}
#pragma endregion
#pragma region ByteUtils
bool IsLittleEndian() {

View File

@@ -5,8 +5,7 @@ using std::string;
VOID DisableVMProtect();
bool IsLittleEndian();
HWND FindMainWindowByPID(DWORD pid);
UINT32 GCHandle_New(LPVOID object, bool pinned);
string IlStringToString(Il2CppString* str, UINT codePage = CP_ACP);
string ToString(Il2CppString* str, UINT codePage = CP_ACP);
#define cstring_new(str) il2cpp_string_new(str)
#define string_new(str) cstring_new((str).c_str())
@@ -27,8 +26,3 @@ static T ReadMapped(void* data, int offset, bool littleEndian = false) {
memcpy(&result, cData + offset, sizeof(result));
return result;
}
template<class T>
static T* GCHandle_GetObject(UINT handle) {
return (T*) il2cpp_gchandle_get_target(handle);
}

9
res/App.Designer.cs generated
View File

@@ -246,6 +246,15 @@ namespace YaeAchievement.res {
}
}
/// <summary>
/// Looks up a localized string similar to No write permission on {0}..
/// </summary>
internal static string NoWritePermission {
get {
return ResourceManager.GetString("NoWritePermission", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Press any key to exit..
/// </summary>

View File

@@ -126,4 +126,7 @@ Input a number (0-5): </value>
<data name="GenshinHashError" xml:space="preserve">
<value>Please update genshin and retry.</value>
</data>
<data name="NoWritePermission" xml:space="preserve">
<value>No write permission on {0}.</value>
</data>
</root>

View File

@@ -26,7 +26,8 @@
[4] 表格文件
[5] 寻空
[6] 原魔工具箱
输入一个数字 (0-6): </value>
[7] UIAF JSON文件
输入一个数字 (0-7): </value>
</data>
<data name="ExportToCocogoatSuccess" xml:space="preserve">
<value>在浏览器内进行下一步操作</value>
@@ -116,4 +117,7 @@
<data name="GenshinHashError" xml:space="preserve">
<value>请将原神更新至最新版本后重试</value>
</data>
<data name="NoWritePermission" xml:space="preserve">
<value>无法写入文件,请更换软件所在目录后重试</value>
</data>
</root>

View File

@@ -0,0 +1,21 @@
syntax = "proto3";
option csharp_namespace = "Proto";
message Achievement {
enum Status {
INVALID = 0;
UNFINISHED = 1;
FINISHED = 2;
REWARD_TAKEN = 3;
}
uint32 timestamp = 9;
uint32 current = 3;
uint32 total = 4;
uint32 id = 10;
Status status = 2;
}
message AchievementAllDataNotify {
repeated Achievement list = 11;
}

View File

@@ -0,0 +1,16 @@
syntax = "proto3";
option csharp_namespace = "Proto";
message AchievementItem {
uint32 pre = 1;
uint32 group = 2;
string name = 3;
string description = 4;
}
message AchievementInfo {
string version = 1;
map<uint32, string> group = 2;
map<uint32, AchievementItem> items = 3;
}

10
res/proto/CacheItem.proto Normal file
View File

@@ -0,0 +1,10 @@
syntax = "proto3";
option csharp_namespace = "Proto";
message CacheItem {
uint32 version = 1;
string checksum = 2;
string etag = 3;
bytes content = 4;
}

View File

@@ -0,0 +1,15 @@
syntax = "proto3";
option csharp_namespace = "Proto";
message UpdateInfo {
uint32 versionCode = 1;
string versionName = 2;
string description = 3;
string packageLink = 4;
bool forceUpdate = 5;
bool enableLibDownload = 6;
bool enableAutoDownload = 7;
string currentCNGameHash = 8;
string currentOSGameHash = 9;
}

View File

@@ -1,5 +1,7 @@
using Microsoft.Win32;
using YaeAchievement.Win32;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.Gdi;
namespace YaeAchievement.AppCenterSDK;
@@ -21,9 +23,9 @@ public static class DeviceHelper {
}
public static string GetScreenSize() {
var desktop = Native.GetDC(IntPtr.Zero);
var size = $"{Native.GetDeviceCaps(desktop, 118)}x{Native.GetDeviceCaps(desktop, 117)}";
Native.ReleaseDC(IntPtr.Zero, desktop);
var desktop = Native.GetDC(HWND.Null);
var size = $"{Native.GetDeviceCaps(desktop, GET_DEVICE_CAPS_INDEX.DESKTOPHORZRES)}x{Native.GetDeviceCaps(desktop, GET_DEVICE_CAPS_INDEX.DESKTOPVERTRES)}";
_ = Native.ReleaseDC(HWND.Null, desktop);
return size;
}

View File

@@ -1,5 +1,6 @@
using System.IO.Compression;
using Google.Protobuf;
using Proto;
namespace YaeAchievement;

View File

@@ -1,10 +1,14 @@
using System.Net;
using System.ComponentModel;
using System.Diagnostics;
using System.Net;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.Win32;
using Proto;
using YaeAchievement.AppCenterSDK;
using YaeAchievement.res;
using static AchievementAllDataNotify.Types.Achievement.Types;
using static Proto.Achievement.Types;
namespace YaeAchievement;
@@ -28,7 +32,8 @@ public static class Export {
4 => ToCSV,
5 => ToXunkong,
6 => ToWxApp1,
7 => ToRawJson,
7 => ToUIAFJson,
8 => ToRawJson,
_ => ToCocogoat
})).Invoke(data);
}
@@ -41,7 +46,7 @@ public static class Export {
var result = JsonSerializer.Serialize(ExportToUIAFApp(data));
using var request = new HttpRequestMessage {
Method = HttpMethod.Post,
RequestUri = new Uri($"https://77.cocogoat.work/v1/memo?source={App.AllAchievement}"),
RequestUri = new Uri($"https://77.cocogoat.cn/v1/memo?source={App.AllAchievement}"),
Content = new StringContent(result, Encoding.UTF8, "application/json")
};
using var response = Utils.CHttpClient.Send(request);
@@ -77,6 +82,14 @@ public static class Export {
Console.WriteLine(App.ExportToSnapGenshinSuccess);
}
// ReSharper disable once InconsistentNaming
private static void ToUIAFJson(AchievementAllDataNotify data) {
var path = Path.GetFullPath($"uiaf-{DateTime.Now:yyyyMMddHHmmss}.json");
if (TryWriteToFile(path, JsonSerializer.Serialize(ExportToUIAFApp(data)))) {
Console.WriteLine(App.ExportToFileSuccess, path);
}
}
private static void ToPaimon(AchievementAllDataNotify data) {
var info = LoadAchievementInfo();
var output = new Dictionary<uint, Dictionary<uint, bool>>();
@@ -93,8 +106,9 @@ public static class Export {
["achievement"] = output.OrderBy(pair => pair.Key).ToDictionary(pair => pair.Key, pair => pair.Value)
};
var path = Path.GetFullPath($"export-{DateTime.Now:yyyyMMddHHmmss}-paimon.json");
File.WriteAllText(path, JsonSerializer.Serialize(final));
Console.WriteLine(App.ExportToFileSuccess, path);
if (TryWriteToFile(path, JsonSerializer.Serialize(final))) {
Console.WriteLine(App.ExportToFileSuccess, path);
}
}
private static void ToSeelie(AchievementAllDataNotify data) {
@@ -108,8 +122,9 @@ public static class Export {
["achievements"] = output.OrderBy(pair => pair.Key).ToDictionary(pair => pair.Key, pair => pair.Value)
};
var path = Path.GetFullPath($"export-{DateTime.Now:yyyyMMddHHmmss}-seelie.json");
File.WriteAllText(path, JsonSerializer.Serialize(final));
Console.WriteLine(App.ExportToFileSuccess, path);
if (TryWriteToFile(path, JsonSerializer.Serialize(final))) {
Console.WriteLine(App.ExportToFileSuccess, path);
}
}
// ReSharper disable once InconsistentNaming
@@ -139,8 +154,10 @@ public static class Export {
return item.JoinToString(",");
}));
var path = Path.GetFullPath($"achievement-{DateTime.Now:yyyyMMddHHmmss}.csv");
File.WriteAllText(path, $"\uFEFF{string.Join("\n", output)}");
Console.WriteLine(App.ExportToFileSuccess, path);
if (TryWriteToFile(path, $"\uFEFF{string.Join("\n", output)}")) {
Console.WriteLine(App.ExportToFileSuccess, path);
Process.Start("explorer.exe", $"{Path.GetDirectoryName(path)}");
}
}
private static void ToXunkong(AchievementAllDataNotify data) {
@@ -156,10 +173,12 @@ public static class Export {
private static void ToRawJson(AchievementAllDataNotify data) {
var path = Path.GetFullPath($"export-{DateTime.Now:yyyyMMddHHmmss}-raw.json");
File.WriteAllText(path, JsonSerializer.Serialize(data, new JsonSerializerOptions {
var text = JsonSerializer.Serialize(data, new JsonSerializerOptions {
WriteIndented = true
}));
Console.WriteLine(App.ExportToFileSuccess, path);
});
if (TryWriteToFile(path, text)) {
Console.WriteLine(App.ExportToFileSuccess, path);
}
}
// ReSharper disable once InconsistentNaming
@@ -184,11 +203,9 @@ public static class Export {
};
}
#pragma warning disable CA1416
private static bool CheckXunkongScheme() {
return (string?)Registry.ClassesRoot.OpenSubKey("xunkong")?.GetValue("") == "URL:xunkong";
}
#pragma warning restore CA1416
private static string JoinToString(this IEnumerable<object> list, string separator) {
return string.Join(separator, list);
@@ -210,4 +227,21 @@ public static class Export {
var b = Utils.GetBucketFileAsByteArray("schicksal/metadata");
return AchievementInfo.Parser.ParseFrom(b);
}
public static int PrintMsgAndReturnErrCode(this Win32Exception ex, string msg) {
// ReSharper disable once LocalizableElement
Console.WriteLine($"{msg}: {ex.Message}");
AppCenter.TrackCrash(ex, false);
return ex.NativeErrorCode;
}
private static bool TryWriteToFile(string path, string contents) {
try {
File.WriteAllText(path, contents);
return true;
} catch (UnauthorizedAccessException) {
Console.WriteLine(App.NoWritePermission, path);
return false;
}
}
}

View File

@@ -20,8 +20,8 @@ public static class GlobalVars {
public static readonly string CachePath = Path.Combine(DataPath, "cache");
public static readonly string LibFilePath = Path.Combine(DataPath, "YaeAchievement.dll");
public const uint AppVersionCode = 34;
public const string AppVersionName = "2.4.1";
public const uint AppVersionCode = 37;
public const string AppVersionName = "2.7";
public const string PipeName = "YaeAchievementPipe";
public const string BucketHost = "https://cn-cd-1259389942.file.myqcloud.com";

View File

@@ -1,52 +1,62 @@
using System.ComponentModel;
using YaeAchievement.Win32;
using static YaeAchievement.Win32.Native;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.System.Memory;
using Windows.Win32.System.Threading;
namespace YaeAchievement;
namespace YaeAchievement;
public static class Injector {
public static unsafe bool CreateProcess(string path, out IntPtr hProc, out IntPtr hThread, out uint pid) {
var si = new StartupInfo();
SecurityAttributes* attr = null;
public static unsafe bool CreateProcess(string path, out HANDLE hProc, out HANDLE hThread, out uint pid) {
Span<char> cmdLines = stackalloc char[1]; // "\0"
var si = new STARTUPINFOW {
cb = unchecked((uint)sizeof(STARTUPINFOW))
};
var dir = Path.GetDirectoryName(path)!;
var result = Native.CreateProcess(
path, null, ref *attr, ref *attr, false,
CreationFlags.CreateSuspended, IntPtr.Zero, dir, ref si, out var pi
path, ref cmdLines, default, default, false,
PROCESS_CREATION_FLAGS.CREATE_SUSPENDED, default, dir, in si, out var pi
);
pid = pi.dwProcessID;
pid = pi.dwProcessId;
hProc = pi.hProcess;
hThread = pi.hThread;
return result;
}
// todo: refactor
public static int LoadLibraryAndInject(IntPtr hProc, string libPath) {
var hKernel = GetModuleHandle("kernel32.dll");
if (hKernel == IntPtr.Zero) {
return new Win32Exception().PrintMsgAndReturnErrCode("GetModuleHandle fail");
public static unsafe int LoadLibraryAndInject(HANDLE hProc, ReadOnlySpan<byte> libPath) {
fixed (char* lpModelName = "kernel32.dll") {
var hKernel = Native.GetModuleHandle(lpModelName);
if (hKernel.IsNull) {
return new Win32Exception().PrintMsgAndReturnErrCode("GetModuleHandle fail");
}
fixed(byte* lpProcName = "LoadLibraryA"u8) {
var pLoadLibrary = Native.GetProcAddress(hKernel, (PCSTR)lpProcName);
if (pLoadLibrary.IsNull) {
return new Win32Exception().PrintMsgAndReturnErrCode("GetProcAddress fail");
}
var pBase = Native.VirtualAllocEx(hProc, default, unchecked((uint)libPath.Length + 1), VIRTUAL_ALLOCATION_TYPE.MEM_RESERVE | VIRTUAL_ALLOCATION_TYPE.MEM_COMMIT, PAGE_PROTECTION_FLAGS.PAGE_READWRITE);
if ((nint)pBase == 0) {
return new Win32Exception().PrintMsgAndReturnErrCode("VirtualAllocEx fail");
}
fixed (void* lpBuffer = libPath) {
if (!Native.WriteProcessMemory(hProc, pBase, lpBuffer, unchecked((uint)libPath.Length))) {
return new Win32Exception().PrintMsgAndReturnErrCode("WriteProcessMemory fail");
}
}
var lpStartAddress = pLoadLibrary.CreateDelegate<LPTHREAD_START_ROUTINE>();
var hThread = Native.CreateRemoteThread(hProc, default, 0, lpStartAddress, pBase, 0);
if (hThread.IsNull) {
var e = new Win32Exception();
Native.VirtualFreeEx(hProc, pBase, 0, VIRTUAL_FREE_TYPE.MEM_RELEASE);
return e.PrintMsgAndReturnErrCode("CreateRemoteThread fail");
}
if (Native.WaitForSingleObject(hThread, 2000) == 0) {
Native.VirtualFreeEx(hProc, pBase, 0, VIRTUAL_FREE_TYPE.MEM_RELEASE);
}
return !Native.CloseHandle(hThread) ? new Win32Exception().PrintMsgAndReturnErrCode("CloseHandle fail") : 0;
}
}
var pLoadLibrary = GetProcAddress(hKernel, "LoadLibraryA");
if (pLoadLibrary == IntPtr.Zero) {
return new Win32Exception().PrintMsgAndReturnErrCode("GetProcAddress fail");
}
var pBase = VirtualAllocEx(hProc, IntPtr.Zero, libPath.Length + 1, AllocationType.Reserve | AllocationType.Commit, MemoryProtection.ReadWrite);
if (pBase == IntPtr.Zero) {
return new Win32Exception().PrintMsgAndReturnErrCode("VirtualAllocEx fail");
}
if (!WriteProcessMemory(hProc, pBase, libPath.ToCharArray(), libPath.Length, out _)) {
return new Win32Exception().PrintMsgAndReturnErrCode("WriteProcessMemory fail");
}
var hThread = CreateRemoteThread(hProc, IntPtr.Zero, 0, pLoadLibrary, pBase, 0, out _);
if (hThread == IntPtr.Zero) {
var e = new Win32Exception();
VirtualFreeEx(hProc, pBase, 0, AllocationType.Release);
return e.PrintMsgAndReturnErrCode("CreateRemoteThread fail");
}
if (WaitForSingleObject(hThread, 2000) == 0) {
VirtualFreeEx(hProc, pBase, 0, AllocationType.Release);
}
return !CloseHandle(hThread) ? new Win32Exception().PrintMsgAndReturnErrCode("CloseHandle fail") : 0;
}
}
}

6
src/NativeMethods.json Normal file
View File

@@ -0,0 +1,6 @@
{
"$schema": "https://aka.ms/CsWin32.schema.json",
"className": "Native",
"allowMarshaling": true,
"public": true
}

21
src/NativeMethods.txt Normal file
View File

@@ -0,0 +1,21 @@
CreateProcess
GetModuleHandle
GetProcAddress
VirtualAllocEx
WriteProcessMemory
CreateRemoteThread
VirtualFreeEx
WaitForSingleObject
OpenClipboard
EmptyClipboard
GlobalLock
SetClipboardData
GlobalUnlock
CloseClipboard
GetStdHandle
GetConsoleMode
SetConsoleMode
TerminateProcess
ResumeThread
GetDeviceCaps
GetDC

View File

@@ -1,15 +1,16 @@
using YaeAchievement;
using Proto;
using YaeAchievement;
using YaeAchievement.AppCenterSDK;
using YaeAchievement.AppCenterSDK.Models;
using YaeAchievement.res;
using static YaeAchievement.Utils;
TryDisableQuickEdit();
InstallExitHook();
InstallExceptionHook();
await CheckVcRuntime();
CheckSelfIsRunning();
TryDisableQuickEdit();
await CheckVcRuntime();
CheckGenshinIsRunning();
Console.WriteLine(@"----------------------------------------------------");

View File

@@ -1,585 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: AchievementAllDataNotify.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021, 8981
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
/// <summary>Holder for reflection information generated from AchievementAllDataNotify.proto</summary>
public static partial class AchievementAllDataNotifyReflection {
#region Descriptor
/// <summary>File descriptor for AchievementAllDataNotify.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static AchievementAllDataNotifyReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Ch5BY2hpZXZlbWVudEFsbERhdGFOb3RpZnkucHJvdG8ivwIKGEFjaGlldmVt",
"ZW50QWxsRGF0YU5vdGlmeRIzCgRsaXN0GAggAygLMiUuQWNoaWV2ZW1lbnRB",
"bGxEYXRhTm90aWZ5LkFjaGlldmVtZW50Gu0BCgtBY2hpZXZlbWVudBIRCgl0",
"aW1lc3RhbXAYCCABKA0SDwoHY3VycmVudBgLIAEoDRINCgV0b3RhbBgGIAEo",
"DRIKCgJpZBgOIAEoDRI8CgZzdGF0dXMYDyABKA4yLC5BY2hpZXZlbWVudEFs",
"bERhdGFOb3RpZnkuQWNoaWV2ZW1lbnQuU3RhdHVzImEKBlN0YXR1cxISCg5T",
"VEFUVVNfSU5WQUxJRBAAEhUKEVNUQVRVU19VTkZJTklTSEVEEAESEwoPU1RB",
"VFVTX0ZJTklTSEVEEAISFwoTU1RBVFVTX1JFV0FSRF9UQUtFThADYgZwcm90",
"bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AchievementAllDataNotify), global::AchievementAllDataNotify.Parser, new[]{ "List" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::AchievementAllDataNotify.Types.Achievement), global::AchievementAllDataNotify.Types.Achievement.Parser, new[]{ "Timestamp", "Current", "Total", "Id", "Status" }, null, new[]{ typeof(global::AchievementAllDataNotify.Types.Achievement.Types.Status) }, null, null)})
}));
}
#endregion
}
#region Messages
public sealed partial class AchievementAllDataNotify : pb::IMessage<AchievementAllDataNotify>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<AchievementAllDataNotify> _parser = new pb::MessageParser<AchievementAllDataNotify>(() => new AchievementAllDataNotify());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<AchievementAllDataNotify> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::AchievementAllDataNotifyReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AchievementAllDataNotify() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AchievementAllDataNotify(AchievementAllDataNotify other) : this() {
list_ = other.list_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AchievementAllDataNotify Clone() {
return new AchievementAllDataNotify(this);
}
/// <summary>Field number for the "list" field.</summary>
public const int ListFieldNumber = 8;
private static readonly pb::FieldCodec<global::AchievementAllDataNotify.Types.Achievement> _repeated_list_codec
= pb::FieldCodec.ForMessage(66, global::AchievementAllDataNotify.Types.Achievement.Parser);
private readonly pbc::RepeatedField<global::AchievementAllDataNotify.Types.Achievement> list_ = new pbc::RepeatedField<global::AchievementAllDataNotify.Types.Achievement>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::AchievementAllDataNotify.Types.Achievement> List {
get { return list_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as AchievementAllDataNotify);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(AchievementAllDataNotify other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if(!list_.Equals(other.list_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
hash ^= list_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
list_.WriteTo(output, _repeated_list_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
list_.WriteTo(ref output, _repeated_list_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
size += list_.CalculateSize(_repeated_list_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(AchievementAllDataNotify other) {
if (other == null) {
return;
}
list_.Add(other.list_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 66: {
list_.AddEntriesFrom(input, _repeated_list_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 66: {
list_.AddEntriesFrom(ref input, _repeated_list_codec);
break;
}
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the AchievementAllDataNotify message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
public sealed partial class Achievement : pb::IMessage<Achievement>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Achievement> _parser = new pb::MessageParser<Achievement>(() => new Achievement());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Achievement> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::AchievementAllDataNotify.Descriptor.NestedTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Achievement() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Achievement(Achievement other) : this() {
timestamp_ = other.timestamp_;
current_ = other.current_;
total_ = other.total_;
id_ = other.id_;
status_ = other.status_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Achievement Clone() {
return new Achievement(this);
}
/// <summary>Field number for the "timestamp" field.</summary>
public const int TimestampFieldNumber = 8;
private uint timestamp_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint Timestamp {
get { return timestamp_; }
set {
timestamp_ = value;
}
}
/// <summary>Field number for the "current" field.</summary>
public const int CurrentFieldNumber = 11;
private uint current_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint Current {
get { return current_; }
set {
current_ = value;
}
}
/// <summary>Field number for the "total" field.</summary>
public const int TotalFieldNumber = 6;
private uint total_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint Total {
get { return total_; }
set {
total_ = value;
}
}
/// <summary>Field number for the "id" field.</summary>
public const int IdFieldNumber = 14;
private uint id_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint Id {
get { return id_; }
set {
id_ = value;
}
}
/// <summary>Field number for the "status" field.</summary>
public const int StatusFieldNumber = 15;
private global::AchievementAllDataNotify.Types.Achievement.Types.Status status_ = global::AchievementAllDataNotify.Types.Achievement.Types.Status.Invalid;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::AchievementAllDataNotify.Types.Achievement.Types.Status Status {
get { return status_; }
set {
status_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as Achievement);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(Achievement other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Timestamp != other.Timestamp) return false;
if (Current != other.Current) return false;
if (Total != other.Total) return false;
if (Id != other.Id) return false;
if (Status != other.Status) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Timestamp != 0) hash ^= Timestamp.GetHashCode();
if (Current != 0) hash ^= Current.GetHashCode();
if (Total != 0) hash ^= Total.GetHashCode();
if (Id != 0) hash ^= Id.GetHashCode();
if (Status != global::AchievementAllDataNotify.Types.Achievement.Types.Status.Invalid) hash ^= Status.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Total != 0) {
output.WriteRawTag(48);
output.WriteUInt32(Total);
}
if (Timestamp != 0) {
output.WriteRawTag(64);
output.WriteUInt32(Timestamp);
}
if (Current != 0) {
output.WriteRawTag(88);
output.WriteUInt32(Current);
}
if (Id != 0) {
output.WriteRawTag(112);
output.WriteUInt32(Id);
}
if (Status != global::AchievementAllDataNotify.Types.Achievement.Types.Status.Invalid) {
output.WriteRawTag(120);
output.WriteEnum((int) Status);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Total != 0) {
output.WriteRawTag(48);
output.WriteUInt32(Total);
}
if (Timestamp != 0) {
output.WriteRawTag(64);
output.WriteUInt32(Timestamp);
}
if (Current != 0) {
output.WriteRawTag(88);
output.WriteUInt32(Current);
}
if (Id != 0) {
output.WriteRawTag(112);
output.WriteUInt32(Id);
}
if (Status != global::AchievementAllDataNotify.Types.Achievement.Types.Status.Invalid) {
output.WriteRawTag(120);
output.WriteEnum((int) Status);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Timestamp != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Timestamp);
}
if (Current != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Current);
}
if (Total != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Total);
}
if (Id != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Id);
}
if (Status != global::AchievementAllDataNotify.Types.Achievement.Types.Status.Invalid) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Status);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(Achievement other) {
if (other == null) {
return;
}
if (other.Timestamp != 0) {
Timestamp = other.Timestamp;
}
if (other.Current != 0) {
Current = other.Current;
}
if (other.Total != 0) {
Total = other.Total;
}
if (other.Id != 0) {
Id = other.Id;
}
if (other.Status != global::AchievementAllDataNotify.Types.Achievement.Types.Status.Invalid) {
Status = other.Status;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 48: {
Total = input.ReadUInt32();
break;
}
case 64: {
Timestamp = input.ReadUInt32();
break;
}
case 88: {
Current = input.ReadUInt32();
break;
}
case 112: {
Id = input.ReadUInt32();
break;
}
case 120: {
Status = (global::AchievementAllDataNotify.Types.Achievement.Types.Status) input.ReadEnum();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 48: {
Total = input.ReadUInt32();
break;
}
case 64: {
Timestamp = input.ReadUInt32();
break;
}
case 88: {
Current = input.ReadUInt32();
break;
}
case 112: {
Id = input.ReadUInt32();
break;
}
case 120: {
Status = (global::AchievementAllDataNotify.Types.Achievement.Types.Status) input.ReadEnum();
break;
}
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the Achievement message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
public enum Status {
[pbr::OriginalName("STATUS_INVALID")] Invalid = 0,
[pbr::OriginalName("STATUS_UNFINISHED")] Unfinished = 1,
[pbr::OriginalName("STATUS_FINISHED")] Finished = 2,
[pbr::OriginalName("STATUS_REWARD_TAKEN")] RewardTaken = 3,
}
}
#endregion
}
}
#endregion
}
#endregion
#endregion Designer generated code

View File

@@ -1,588 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: AchievementInfo.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021, 8981
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
/// <summary>Holder for reflection information generated from AchievementInfo.proto</summary>
public static partial class AchievementInfoReflection {
#region Descriptor
/// <summary>File descriptor for AchievementInfo.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static AchievementInfoReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChVBY2hpZXZlbWVudEluZm8ucHJvdG8iUAoPQWNoaWV2ZW1lbnRJdGVtEgsK",
"A3ByZRgBIAEoDRINCgVncm91cBgCIAEoDRIMCgRuYW1lGAMgASgJEhMKC2Rl",
"c2NyaXB0aW9uGAQgASgJIugBCg9BY2hpZXZlbWVudEluZm8SDwoHdmVyc2lv",
"bhgBIAEoCRIqCgVncm91cBgCIAMoCzIbLkFjaGlldmVtZW50SW5mby5Hcm91",
"cEVudHJ5EioKBWl0ZW1zGAMgAygLMhsuQWNoaWV2ZW1lbnRJbmZvLkl0ZW1z",
"RW50cnkaLAoKR3JvdXBFbnRyeRILCgNrZXkYASABKA0SDQoFdmFsdWUYAiAB",
"KAk6AjgBGj4KCkl0ZW1zRW50cnkSCwoDa2V5GAEgASgNEh8KBXZhbHVlGAIg",
"ASgLMhAuQWNoaWV2ZW1lbnRJdGVtOgI4AWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::AchievementItem), global::AchievementItem.Parser, new[]{ "Pre", "Group", "Name", "Description" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AchievementInfo), global::AchievementInfo.Parser, new[]{ "Version", "Group", "Items" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, })
}));
}
#endregion
}
#region Messages
public sealed partial class AchievementItem : pb::IMessage<AchievementItem>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<AchievementItem> _parser = new pb::MessageParser<AchievementItem>(() => new AchievementItem());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<AchievementItem> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::AchievementInfoReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AchievementItem() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AchievementItem(AchievementItem other) : this() {
pre_ = other.pre_;
group_ = other.group_;
name_ = other.name_;
description_ = other.description_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AchievementItem Clone() {
return new AchievementItem(this);
}
/// <summary>Field number for the "pre" field.</summary>
public const int PreFieldNumber = 1;
private uint pre_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint Pre {
get { return pre_; }
set {
pre_ = value;
}
}
/// <summary>Field number for the "group" field.</summary>
public const int GroupFieldNumber = 2;
private uint group_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint Group {
get { return group_; }
set {
group_ = value;
}
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 3;
private string name_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "description" field.</summary>
public const int DescriptionFieldNumber = 4;
private string description_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Description {
get { return description_; }
set {
description_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as AchievementItem);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(AchievementItem other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Pre != other.Pre) return false;
if (Group != other.Group) return false;
if (Name != other.Name) return false;
if (Description != other.Description) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Pre != 0) hash ^= Pre.GetHashCode();
if (Group != 0) hash ^= Group.GetHashCode();
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Description.Length != 0) hash ^= Description.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Pre != 0) {
output.WriteRawTag(8);
output.WriteUInt32(Pre);
}
if (Group != 0) {
output.WriteRawTag(16);
output.WriteUInt32(Group);
}
if (Name.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Name);
}
if (Description.Length != 0) {
output.WriteRawTag(34);
output.WriteString(Description);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Pre != 0) {
output.WriteRawTag(8);
output.WriteUInt32(Pre);
}
if (Group != 0) {
output.WriteRawTag(16);
output.WriteUInt32(Group);
}
if (Name.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Name);
}
if (Description.Length != 0) {
output.WriteRawTag(34);
output.WriteString(Description);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Pre != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Pre);
}
if (Group != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Group);
}
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (Description.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Description);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(AchievementItem other) {
if (other == null) {
return;
}
if (other.Pre != 0) {
Pre = other.Pre;
}
if (other.Group != 0) {
Group = other.Group;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.Description.Length != 0) {
Description = other.Description;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Pre = input.ReadUInt32();
break;
}
case 16: {
Group = input.ReadUInt32();
break;
}
case 26: {
Name = input.ReadString();
break;
}
case 34: {
Description = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
Pre = input.ReadUInt32();
break;
}
case 16: {
Group = input.ReadUInt32();
break;
}
case 26: {
Name = input.ReadString();
break;
}
case 34: {
Description = input.ReadString();
break;
}
}
}
}
#endif
}
public sealed partial class AchievementInfo : pb::IMessage<AchievementInfo>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<AchievementInfo> _parser = new pb::MessageParser<AchievementInfo>(() => new AchievementInfo());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<AchievementInfo> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::AchievementInfoReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AchievementInfo() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AchievementInfo(AchievementInfo other) : this() {
version_ = other.version_;
group_ = other.group_.Clone();
items_ = other.items_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AchievementInfo Clone() {
return new AchievementInfo(this);
}
/// <summary>Field number for the "version" field.</summary>
public const int VersionFieldNumber = 1;
private string version_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Version {
get { return version_; }
set {
version_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "group" field.</summary>
public const int GroupFieldNumber = 2;
private static readonly pbc::MapField<uint, string>.Codec _map_group_codec
= new pbc::MapField<uint, string>.Codec(pb::FieldCodec.ForUInt32(8, 0), pb::FieldCodec.ForString(18, ""), 18);
private readonly pbc::MapField<uint, string> group_ = new pbc::MapField<uint, string>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<uint, string> Group {
get { return group_; }
}
/// <summary>Field number for the "items" field.</summary>
public const int ItemsFieldNumber = 3;
private static readonly pbc::MapField<uint, global::AchievementItem>.Codec _map_items_codec
= new pbc::MapField<uint, global::AchievementItem>.Codec(pb::FieldCodec.ForUInt32(8, 0), pb::FieldCodec.ForMessage(18, global::AchievementItem.Parser), 26);
private readonly pbc::MapField<uint, global::AchievementItem> items_ = new pbc::MapField<uint, global::AchievementItem>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<uint, global::AchievementItem> Items {
get { return items_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as AchievementInfo);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(AchievementInfo other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Version != other.Version) return false;
if (!Group.Equals(other.Group)) return false;
if (!Items.Equals(other.Items)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Version.Length != 0) hash ^= Version.GetHashCode();
hash ^= Group.GetHashCode();
hash ^= Items.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Version.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Version);
}
group_.WriteTo(output, _map_group_codec);
items_.WriteTo(output, _map_items_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Version.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Version);
}
group_.WriteTo(ref output, _map_group_codec);
items_.WriteTo(ref output, _map_items_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Version.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Version);
}
size += group_.CalculateSize(_map_group_codec);
size += items_.CalculateSize(_map_items_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(AchievementInfo other) {
if (other == null) {
return;
}
if (other.Version.Length != 0) {
Version = other.Version;
}
group_.Add(other.group_);
items_.Add(other.items_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Version = input.ReadString();
break;
}
case 18: {
group_.AddEntriesFrom(input, _map_group_codec);
break;
}
case 26: {
items_.AddEntriesFrom(input, _map_items_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Version = input.ReadString();
break;
}
case 18: {
group_.AddEntriesFrom(ref input, _map_group_codec);
break;
}
case 26: {
items_.AddEntriesFrom(ref input, _map_items_codec);
break;
}
}
}
}
#endif
}
#endregion
#endregion Designer generated code

View File

@@ -1,341 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: CacheItem.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021, 8981
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
/// <summary>Holder for reflection information generated from CacheItem.proto</summary>
public static partial class CacheItemReflection {
#region Descriptor
/// <summary>File descriptor for CacheItem.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static CacheItemReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Cg9DYWNoZUl0ZW0ucHJvdG8iTQoJQ2FjaGVJdGVtEg8KB3ZlcnNpb24YASAB",
"KAUSEAoIY2hlY2tzdW0YAiABKAkSDAoEZXRhZxgDIAEoCRIPCgdjb250ZW50",
"GAQgASgMYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::CacheItem), global::CacheItem.Parser, new[]{ "Version", "Checksum", "Etag", "Content" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
public sealed partial class CacheItem : pb::IMessage<CacheItem>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CacheItem> _parser = new pb::MessageParser<CacheItem>(() => new CacheItem());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<CacheItem> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::CacheItemReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public CacheItem() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public CacheItem(CacheItem other) : this() {
version_ = other.version_;
checksum_ = other.checksum_;
etag_ = other.etag_;
content_ = other.content_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public CacheItem Clone() {
return new CacheItem(this);
}
/// <summary>Field number for the "version" field.</summary>
public const int VersionFieldNumber = 1;
private int version_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Version {
get { return version_; }
set {
version_ = value;
}
}
/// <summary>Field number for the "checksum" field.</summary>
public const int ChecksumFieldNumber = 2;
private string checksum_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Checksum {
get { return checksum_; }
set {
checksum_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "etag" field.</summary>
public const int EtagFieldNumber = 3;
private string etag_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Etag {
get { return etag_; }
set {
etag_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "content" field.</summary>
public const int ContentFieldNumber = 4;
private pb::ByteString content_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pb::ByteString Content {
get { return content_; }
set {
content_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as CacheItem);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(CacheItem other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Version != other.Version) return false;
if (Checksum != other.Checksum) return false;
if (Etag != other.Etag) return false;
if (Content != other.Content) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Version != 0) hash ^= Version.GetHashCode();
if (Checksum.Length != 0) hash ^= Checksum.GetHashCode();
if (Etag.Length != 0) hash ^= Etag.GetHashCode();
if (Content.Length != 0) hash ^= Content.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Version != 0) {
output.WriteRawTag(8);
output.WriteInt32(Version);
}
if (Checksum.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Checksum);
}
if (Etag.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Etag);
}
if (Content.Length != 0) {
output.WriteRawTag(34);
output.WriteBytes(Content);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Version != 0) {
output.WriteRawTag(8);
output.WriteInt32(Version);
}
if (Checksum.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Checksum);
}
if (Etag.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Etag);
}
if (Content.Length != 0) {
output.WriteRawTag(34);
output.WriteBytes(Content);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Version != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Version);
}
if (Checksum.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Checksum);
}
if (Etag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Etag);
}
if (Content.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(Content);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(CacheItem other) {
if (other == null) {
return;
}
if (other.Version != 0) {
Version = other.Version;
}
if (other.Checksum.Length != 0) {
Checksum = other.Checksum;
}
if (other.Etag.Length != 0) {
Etag = other.Etag;
}
if (other.Content.Length != 0) {
Content = other.Content;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Version = input.ReadInt32();
break;
}
case 18: {
Checksum = input.ReadString();
break;
}
case 26: {
Etag = input.ReadString();
break;
}
case 34: {
Content = input.ReadBytes();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
Version = input.ReadInt32();
break;
}
case 18: {
Checksum = input.ReadString();
break;
}
case 26: {
Etag = input.ReadString();
break;
}
case 34: {
Content = input.ReadBytes();
break;
}
}
}
}
#endif
}
#endregion
#endregion Designer generated code

View File

@@ -1,454 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: UpdateInfo.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021, 8981
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
/// <summary>Holder for reflection information generated from UpdateInfo.proto</summary>
public static partial class UpdateInfoReflection {
#region Descriptor
/// <summary>File descriptor for UpdateInfo.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static UpdateInfoReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChBVcGRhdGVJbmZvLnByb3RvIqwBCgpVcGRhdGVJbmZvEhMKC3ZlcnNpb25D",
"b2RlGAEgASgNEhMKC3ZlcnNpb25OYW1lGAIgASgJEhMKC2Rlc2NyaXB0aW9u",
"GAMgASgJEhMKC3BhY2thZ2VMaW5rGAQgASgJEhMKC2ZvcmNlVXBkYXRlGAUg",
"ASgIEhkKEWVuYWJsZUxpYkRvd25sb2FkGAYgASgIEhoKEmVuYWJsZUF1dG9E",
"b3dubG9hZBgHIAEoCGIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::UpdateInfo), global::UpdateInfo.Parser, new[]{ "VersionCode", "VersionName", "Description", "PackageLink", "ForceUpdate", "EnableLibDownload", "EnableAutoDownload" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
public sealed partial class UpdateInfo : pb::IMessage<UpdateInfo>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<UpdateInfo> _parser = new pb::MessageParser<UpdateInfo>(() => new UpdateInfo());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<UpdateInfo> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::UpdateInfoReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public UpdateInfo() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public UpdateInfo(UpdateInfo other) : this() {
versionCode_ = other.versionCode_;
versionName_ = other.versionName_;
description_ = other.description_;
packageLink_ = other.packageLink_;
forceUpdate_ = other.forceUpdate_;
enableLibDownload_ = other.enableLibDownload_;
enableAutoDownload_ = other.enableAutoDownload_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public UpdateInfo Clone() {
return new UpdateInfo(this);
}
/// <summary>Field number for the "versionCode" field.</summary>
public const int VersionCodeFieldNumber = 1;
private uint versionCode_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint VersionCode {
get { return versionCode_; }
set {
versionCode_ = value;
}
}
/// <summary>Field number for the "versionName" field.</summary>
public const int VersionNameFieldNumber = 2;
private string versionName_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string VersionName {
get { return versionName_; }
set {
versionName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "description" field.</summary>
public const int DescriptionFieldNumber = 3;
private string description_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Description {
get { return description_; }
set {
description_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "packageLink" field.</summary>
public const int PackageLinkFieldNumber = 4;
private string packageLink_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string PackageLink {
get { return packageLink_; }
set {
packageLink_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "forceUpdate" field.</summary>
public const int ForceUpdateFieldNumber = 5;
private bool forceUpdate_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool ForceUpdate {
get { return forceUpdate_; }
set {
forceUpdate_ = value;
}
}
/// <summary>Field number for the "enableLibDownload" field.</summary>
public const int EnableLibDownloadFieldNumber = 6;
private bool enableLibDownload_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool EnableLibDownload {
get { return enableLibDownload_; }
set {
enableLibDownload_ = value;
}
}
/// <summary>Field number for the "enableAutoDownload" field.</summary>
public const int EnableAutoDownloadFieldNumber = 7;
private bool enableAutoDownload_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool EnableAutoDownload {
get { return enableAutoDownload_; }
set {
enableAutoDownload_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as UpdateInfo);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(UpdateInfo other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (VersionCode != other.VersionCode) return false;
if (VersionName != other.VersionName) return false;
if (Description != other.Description) return false;
if (PackageLink != other.PackageLink) return false;
if (ForceUpdate != other.ForceUpdate) return false;
if (EnableLibDownload != other.EnableLibDownload) return false;
if (EnableAutoDownload != other.EnableAutoDownload) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (VersionCode != 0) hash ^= VersionCode.GetHashCode();
if (VersionName.Length != 0) hash ^= VersionName.GetHashCode();
if (Description.Length != 0) hash ^= Description.GetHashCode();
if (PackageLink.Length != 0) hash ^= PackageLink.GetHashCode();
if (ForceUpdate != false) hash ^= ForceUpdate.GetHashCode();
if (EnableLibDownload != false) hash ^= EnableLibDownload.GetHashCode();
if (EnableAutoDownload != false) hash ^= EnableAutoDownload.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (VersionCode != 0) {
output.WriteRawTag(8);
output.WriteUInt32(VersionCode);
}
if (VersionName.Length != 0) {
output.WriteRawTag(18);
output.WriteString(VersionName);
}
if (Description.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Description);
}
if (PackageLink.Length != 0) {
output.WriteRawTag(34);
output.WriteString(PackageLink);
}
if (ForceUpdate != false) {
output.WriteRawTag(40);
output.WriteBool(ForceUpdate);
}
if (EnableLibDownload != false) {
output.WriteRawTag(48);
output.WriteBool(EnableLibDownload);
}
if (EnableAutoDownload != false) {
output.WriteRawTag(56);
output.WriteBool(EnableAutoDownload);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (VersionCode != 0) {
output.WriteRawTag(8);
output.WriteUInt32(VersionCode);
}
if (VersionName.Length != 0) {
output.WriteRawTag(18);
output.WriteString(VersionName);
}
if (Description.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Description);
}
if (PackageLink.Length != 0) {
output.WriteRawTag(34);
output.WriteString(PackageLink);
}
if (ForceUpdate != false) {
output.WriteRawTag(40);
output.WriteBool(ForceUpdate);
}
if (EnableLibDownload != false) {
output.WriteRawTag(48);
output.WriteBool(EnableLibDownload);
}
if (EnableAutoDownload != false) {
output.WriteRawTag(56);
output.WriteBool(EnableAutoDownload);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (VersionCode != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(VersionCode);
}
if (VersionName.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(VersionName);
}
if (Description.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Description);
}
if (PackageLink.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(PackageLink);
}
if (ForceUpdate != false) {
size += 1 + 1;
}
if (EnableLibDownload != false) {
size += 1 + 1;
}
if (EnableAutoDownload != false) {
size += 1 + 1;
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(UpdateInfo other) {
if (other == null) {
return;
}
if (other.VersionCode != 0) {
VersionCode = other.VersionCode;
}
if (other.VersionName.Length != 0) {
VersionName = other.VersionName;
}
if (other.Description.Length != 0) {
Description = other.Description;
}
if (other.PackageLink.Length != 0) {
PackageLink = other.PackageLink;
}
if (other.ForceUpdate != false) {
ForceUpdate = other.ForceUpdate;
}
if (other.EnableLibDownload != false) {
EnableLibDownload = other.EnableLibDownload;
}
if (other.EnableAutoDownload != false) {
EnableAutoDownload = other.EnableAutoDownload;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
VersionCode = input.ReadUInt32();
break;
}
case 18: {
VersionName = input.ReadString();
break;
}
case 26: {
Description = input.ReadString();
break;
}
case 34: {
PackageLink = input.ReadString();
break;
}
case 40: {
ForceUpdate = input.ReadBool();
break;
}
case 48: {
EnableLibDownload = input.ReadBool();
break;
}
case 56: {
EnableAutoDownload = input.ReadBool();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
VersionCode = input.ReadUInt32();
break;
}
case 18: {
VersionName = input.ReadString();
break;
}
case 26: {
Description = input.ReadString();
break;
}
case 34: {
PackageLink = input.ReadString();
break;
}
case 40: {
ForceUpdate = input.ReadBool();
break;
}
case 48: {
EnableLibDownload = input.ReadBool();
break;
}
case 56: {
EnableAutoDownload = input.ReadBool();
break;
}
}
}
}
#endif
}
#endregion
#endregion Designer generated code

View File

@@ -1,14 +1,18 @@
using System.ComponentModel;
using Microsoft.Win32;
using System.ComponentModel;
using System.Diagnostics;
using System.IO.Pipes;
using System.Net;
using System.Net.Http.Headers;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Text;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.System.Console;
using Proto;
using YaeAchievement.AppCenterSDK;
using YaeAchievement.res;
using YaeAchievement.Win32;
namespace YaeAchievement;
@@ -46,7 +50,7 @@ public static class Utils {
cacheFile.Write(responseBytes, etag);
}
return responseBytes;
} catch (Exception e) {
} catch (Exception e) when(e is SocketException or TaskCanceledException) {
Console.WriteLine(App.NetworkError, e.Message);
Environment.Exit(-1);
return null!;
@@ -64,21 +68,27 @@ public static class Utils {
public static bool ToBooleanOrFalse(string? value) {
return value != null && bool.TryParse(value, out var result) && result;
}
public static void CopyToClipboard(string text) {
if (Native.OpenClipboard(IntPtr.Zero)) {
public static unsafe void CopyToClipboard(string text) {
if (Native.OpenClipboard(HWND.Null))
{
Native.EmptyClipboard();
var hGlobal = Marshal.AllocHGlobal((text.Length + 1) * 2);
var hPtr = Native.GlobalLock(hGlobal);
var hGlobal = (HANDLE) Marshal.AllocHGlobal((text.Length + 1) * 2);
var hPtr = (nint) Native.GlobalLock(hGlobal);
Marshal.Copy(text.ToCharArray(), 0, hPtr, text.Length);
Native.GlobalUnlock(hPtr);
Native.SetClipboardData(13, hGlobal);
Marshal.FreeHGlobal(hGlobal);
Native.CloseClipboard();
} else {
}
else
{
throw new Win32Exception();
}
}
// ReSharper disable once NotAccessedField.Local
private static UpdateInfo _updateInfo = null!;
public static void CheckUpdate(bool useLocalLib) {
var info = UpdateInfo.Parser.ParseFrom(GetBucketFileAsByteArray("schicksal/version"))!;
@@ -91,10 +101,7 @@ public static class Utils {
File.WriteAllBytes(tmpPath, GetBucketFileAsByteArray(info.PackageLink));
var updaterArgs = $"{Environment.ProcessId}|{Environment.ProcessPath}|{tmpPath}";
var updaterPath = Path.Combine(GlobalVars.DataPath, "update.exe");
var updaterHash = App.Updater.MD5Hash();
if (!File.Exists(updaterPath) || File.ReadAllBytes(updaterPath).MD5Hash() != updaterHash) {
File.WriteAllBytes(updaterPath, App.Updater);
}
File.WriteAllBytes(updaterPath, App.Updater);
ShellOpen(updaterPath, updaterArgs.ToBytes().ToBase64());
GlobalVars.PauseOnExit = false;
Environment.Exit(0);
@@ -110,18 +117,21 @@ public static class Utils {
} else if (info.EnableLibDownload) {
File.WriteAllBytes(GlobalVars.LibFilePath, GetBucketFileAsByteArray("schicksal/lib.dll"));
}
_updateInfo = info;
}
public static void CheckSelfIsRunning() {
Process.EnterDebugMode();
var cur = Process.GetCurrentProcess();
foreach (var process in Process.GetProcesses().Where(process => process.Id != cur.Id)) {
if (process.ProcessName == cur.ProcessName) {
Console.WriteLine(App.AnotherInstance);
Environment.Exit(302);
try {
Process.EnterDebugMode();
var cur = Process.GetCurrentProcess();
foreach (var process in Process.GetProcesses().Where(process => process.Id != cur.Id)) {
if (process.ProcessName == cur.ProcessName) {
Console.WriteLine(App.AnotherInstance);
Environment.Exit(302);
}
}
}
Process.LeaveDebugMode();
Process.LeaveDebugMode();
} catch (Win32Exception) {}
}
// ReSharper disable once UnusedMethodReturnValue.Global
@@ -143,9 +153,10 @@ public static class Utils {
}
// ReSharper disable once UnusedMethodReturnValue.Global
public static bool TryDisableQuickEdit() {
var handle = Native.GetStdHandle();
return Native.GetConsoleMode(handle, out var mode) && Native.SetConsoleMode(handle, mode&~64);
public static unsafe bool TryDisableQuickEdit() {
var handle = Native.GetStdHandle(STD_HANDLE.STD_INPUT_HANDLE);
CONSOLE_MODE mode = default;
return Native.GetConsoleMode(handle, &mode) && Native.SetConsoleMode(handle, mode & ~CONSOLE_MODE.ENABLE_QUICK_EDIT_MODE);
}
public static void CheckGenshinIsRunning() {
@@ -153,7 +164,7 @@ public static class Utils {
foreach (var process in Process.GetProcesses()) {
if (process.ProcessName is "GenshinImpact" or "YuanShen"
&& !process.HasExited
&& process.MainWindowHandle != IntPtr.Zero
&& process.MainWindowHandle != nint.Zero
) {
Console.WriteLine(App.GenshinIsRunning, process.Id);
Environment.Exit(301);
@@ -203,12 +214,12 @@ public static class Utils {
#if DEBUG
return true;
#else
return File.Exists(path) && File.ReadAllBytes(path).MD5Hash()
is "34433aa962523e55213c596d4e6b1f9c"
or "1fa8e1445b8121d5d1b5c1e6a8daa905"; // TODO: Use api
if (!File.Exists(path)) return false;
var hash = File.ReadAllBytes(path).MD5Hash();
return hash == _updateInfo.CurrentCNGameHash || hash == _updateInfo.CurrentOSGameHash;
#endif
}
// ReSharper disable once UnusedMethodReturnValue.Global
public static Thread StartAndWaitResult(string exePath, Func<string, bool> onReceive) {
if (!CheckGenshinIsLatestVersion(exePath)) {
@@ -223,8 +234,10 @@ public static class Utils {
if (!Injector.CreateProcess(exePath, out var hProcess, out var hThread, out var pid)) {
Environment.Exit(new Win32Exception().PrintMsgAndReturnErrCode("ICreateProcess fail"));
}
if (Injector.LoadLibraryAndInject(hProcess, GlobalVars.LibFilePath) != 0) {
if (!Native.TerminateProcess(hProcess, 0)) {
if (Injector.LoadLibraryAndInject(hProcess,Encoding.UTF8.GetBytes(GlobalVars.LibFilePath)) != 0)
{
if (!Native.TerminateProcess(hProcess, 0))
{
Environment.Exit(new Win32Exception().PrintMsgAndReturnErrCode("TerminateProcess fail"));
}
}
@@ -232,22 +245,27 @@ public static class Utils {
proc = Process.GetProcessById(Convert.ToInt32(pid));
proc.EnableRaisingEvents = true;
proc.Exited += (_, _) => {
if (GlobalVars.UnexpectedExit) {
if (GlobalVars.UnexpectedExit)
{
proc = null;
Console.WriteLine(App.GameProcessExit);
Environment.Exit(114514);
}
};
if (Native.ResumeThread(hThread) == 0xFFFFFFFF) {
if (Native.ResumeThread(hThread) == 0xFFFFFFFF)
{
var e = new Win32Exception();
if (!Native.TerminateProcess(hProcess, 0)) {
if (!Native.TerminateProcess(hProcess, 0))
{
new Win32Exception().PrintMsgAndReturnErrCode("TerminateProcess fail");
}
Environment.Exit(e.PrintMsgAndReturnErrCode("ResumeThread fail"));
}
if (!Native.CloseHandle(hProcess)) {
if (!Native.CloseHandle(hProcess))
{
Environment.Exit(new Win32Exception().PrintMsgAndReturnErrCode("CloseHandle fail"));
}
var ts = new ThreadStart(() => {
var server = new NamedPipeServerStream(GlobalVars.PipeName);
server.WaitForConnection();
@@ -267,8 +285,6 @@ public static class Utils {
th.Start();
return th;
}
#pragma warning disable CA1416
public static async Task CheckVcRuntime() {
using var root = Registry.LocalMachine;
@@ -286,7 +302,14 @@ public static class Utils {
if (!installed) {
Console.WriteLine(App.VcRuntimeDownload);
var pkgPath = Path.Combine(GlobalVars.DataPath, "vc_redist.x64.exe");
var bytes = await CHttpClient.GetByteArrayAsync("https://aka.ms/vs/17/release/vc_redist.x64.exe");
byte[] bytes;
try {
bytes = await CHttpClient.GetByteArrayAsync("https://aka.ms/vs/17/release/vc_redist.x64.exe");
} catch (Exception e) when(e is SocketException or TaskCanceledException) {
Console.WriteLine(App.NetworkError, e.Message);
Environment.Exit(-1);
return;
}
await File.WriteAllBytesAsync(pkgPath, bytes);
Console.WriteLine(App.VcRuntimeInstalling);
using var process = new Process {

View File

@@ -1,16 +0,0 @@
namespace YaeAchievement.Win32;
[Flags]
public enum AllocationType : uint {
Commit = 0x00001000,
Reserve = 0x00002000,
Reset = 0x00080000,
TopDown = 0x00100000,
WriteWatch = 0x00200000,
Physical = 0x00400000,
Rotate = 0x00800000,
ResetUndo = 0x01000000,
LargePages = 0x20000000,
Decommit = 0x00004000,
Release = 0x00008000
}

View File

@@ -1,9 +0,0 @@
namespace YaeAchievement.Win32;
[Flags]
public enum CreationFlags : uint {
CreateSuspended = 0x00000004,
DetachedProcess = 0x00000008,
CreateNoWindow = 0x08000000,
ExtendedStartupInfoPresent = 0x00080000
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel;
using YaeAchievement.AppCenterSDK;
namespace YaeAchievement.Win32;
public static class Extensions {
public static int PrintMsgAndReturnErrCode(this Win32Exception ex, string msg) {
Console.WriteLine($"{msg}: {ex.Message}");
AppCenter.TrackCrash(ex, false);
return ex.NativeErrorCode;
}
}

View File

@@ -1,16 +0,0 @@
namespace YaeAchievement.Win32;
[Flags]
public enum MemoryProtection : uint {
Execute = 0x10,
ExecuteRead = 0x20,
ExecuteReadWrite = 0x40,
ExecuteWriteCopy = 0x80,
NoAccess = 0x01,
ReadOnly = 0x02,
ReadWrite = 0x04,
WriteCopy = 0x08,
GuardModifierFlag = 0x100,
NoCacheModifierFlag = 0x200,
WriteCombineModifierFlag = 0x400
}

View File

@@ -1,119 +0,0 @@
using System.Runtime.InteropServices;
using System.Security;
namespace YaeAchievement.Win32;
#pragma warning disable CA1401, CA2101
public static class Native {
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern bool CreateProcess(
string lpApplicationName,
string? lpCommandLine,
ref SecurityAttributes lpProcessAttributes,
ref SecurityAttributes lpThreadAttributes,
bool bInheritHandles,
CreationFlags dwCreationFlags,
IntPtr lpEnvironment,
string? lpCurrentDirectory,
[In] ref StartupInfo lpStartupInfo,
out ProcessInformation lpProcessInformation
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool TerminateProcess(IntPtr hProcess, uint uExitCode);
[DllImport("kernel32.dll")]
public static extern bool WriteProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
char[] lpBuffer,
int nSize,
out IntPtr lpNumberOfBytesWritten
);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr GetModuleHandle(string lpModuleName);
[DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
public static extern IntPtr VirtualAllocEx(
IntPtr hProcess,
IntPtr lpAddress,
int dwSize,
AllocationType flAllocationType,
MemoryProtection flProtect
);
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
public static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, AllocationType dwFreeType);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern uint ResumeThread(IntPtr hThread);
[SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool CloseHandle(IntPtr hObject);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr CreateRemoteThread(
IntPtr hProcess,
IntPtr lpThreadAttributes,
int dwStackSize,
IntPtr lpStartAddress,
IntPtr lpParameter,
uint dwCreationFlags,
out IntPtr lpThreadId
);
// ReSharper disable once InconsistentNaming
private const int STD_INPUT_HANDLE = -10;
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetStdHandle(int nStdHandle = STD_INPUT_HANDLE);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool GetConsoleMode(IntPtr handle, out int lpMode);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetConsoleMode(IntPtr handle, int ioMode);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GlobalLock(IntPtr mem);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool GlobalUnlock(IntPtr mem);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool OpenClipboard(IntPtr owner);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("user32.dll", SetLastError = true)]
public static extern bool CloseClipboard();
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SetClipboardData(uint uFormat, IntPtr data);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool EmptyClipboard();
[DllImport("gdi32.dll", SetLastError = true)]
public static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr GetDC(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hdc);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern uint WaitForSingleObject(IntPtr handle, ulong dwMilliseconds);
}

View File

@@ -1,14 +0,0 @@
using System.Runtime.InteropServices;
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable FieldCanBeMadeReadOnly.Global
namespace YaeAchievement.Win32;
[StructLayout(LayoutKind.Sequential)]
public struct ProcessInformation {
public IntPtr hProcess;
public IntPtr hThread;
public uint dwProcessID;
public uint dwThreadID;
}

View File

@@ -1,12 +0,0 @@
using System.Runtime.InteropServices;
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable FieldCanBeMadeReadOnly.Global
namespace YaeAchievement.Win32;
[StructLayout(LayoutKind.Sequential)]
public struct SecurityAttributes {
public int nLength;
public IntPtr lpSecurityDescriptor;
}

View File

@@ -1,28 +0,0 @@
using System.Runtime.InteropServices;
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable FieldCanBeMadeReadOnly.Global
namespace YaeAchievement.Win32;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct StartupInfo {
public uint cb;
public string lpReserved;
public string lpDesktop;
public string lpTitle;
public uint dwX;
public uint dwY;
public uint dwXSize;
public uint dwYSize;
public uint dwXCountChars;
public uint dwYCountChars;
public uint dwFillAttribute;
public uint dwFlags;
public ushort wShowWindow;
public ushort cbReserved2;
public IntPtr lpReserved2;
public IntPtr hStdInput;
public IntPtr hStdOutput;
public IntPtr hStdError;
}