Skip to content

Commit

Permalink
版本检测优化 移除无用项目 优化编译过程
Browse files Browse the repository at this point in the history
  • Loading branch information
aiqinxuancai committed Feb 5, 2024
1 parent cc2106d commit c4b47f2
Show file tree
Hide file tree
Showing 22 changed files with 24,917 additions and 567 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}

- name: Set Version
run: powershell -Command "(gc $env:GITHUB_WORKSPACE\AutoLinker.h) -replace '0.0.0', '$env:GITHUB_REF_NAME' | Out-File $env:GITHUB_WORKSPACE\AutoLinker.h"

- name: Set Build
run: powershell -Command "(gc $env:GITHUB_WORKSPACE\AutoLinker.h) -replace '1000000', '$env:GITHUB_RUN_NUMBER' | Out-File $env:GITHUB_WORKSPACE\AutoLinker.h"

- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
Expand Down
37 changes: 24 additions & 13 deletions AutoLinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "WindowHelper.h"
#include <future>
#include "WinINetUtil.h"
#include "Version.h"

#pragma comment(lib, "comctl32.lib")

Expand Down Expand Up @@ -558,31 +559,41 @@ BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
}

void FneCheckNewVersion(void* pParams) {
OutputStringToELog("检测新版本");
Sleep(1000);

OutputStringToELog("AutoLinker开源下载地址:https://github.com/aiqinxuancai/AutoLinker");
std::string url = "https://api.github.com/repos/aiqinxuancai/AutoLinker/releases/latest";
//std::string customHeaders = "user-agent: Mozilla/5.0";
auto response = PerformGetRequest(url);

if (response.second == 200) {
std::string nowGithubVersion = "0.0.0";
std::string currentVersion = "{VERSION}"; //TODO 需要用脚本替换
std::string currentVersion = AUTOLINKER_VERSION;

if (strcmp(AUTOLINKER_VERSION, "0.0.0") == 0) {
//自行编译,无需检查版本更新

} else {
if (!response.first.empty()) {
auto releases = json::parse(response.first);
for (const auto& release : releases) {
if (!release["prerelease"].get<bool>()) {
nowGithubVersion = release["tag_name"];
break;
}
}

if (!response.first.empty()) {
auto pos = response.first.find("\"tag_name\"");
if (pos != std::string::npos) {
auto start = response.first.find('"', pos + 10) + 1;
auto end = response.first.find('"', start);
std::string tagName = response.first.substr(start, end - start);
Version nowGithubVersionObj(nowGithubVersion);
Version currentVersionObj(AUTOLINKER_VERSION);

nowGithubVersion = tagName;
if (nowGithubVersionObj > currentVersionObj) {
OutputStringToELog(std::format("有新版本 {}", nowGithubVersion));
}
else {

if (nowGithubVersion != currentVersion) {
OutputStringToELog("新版本");
OutputStringToELog(nowGithubVersion);
}
}
}

}
else {
OutputStringToELog("无新版本");
Expand Down
12 changes: 9 additions & 3 deletions AutoLinker.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
#include <detver.h>
#include <detours.h>
#include <string>
#include <json.hpp>


using json = nlohmann::json;

#define LIBARAYNAME "AutoLinker_MessageNotify"

#define AUTOLINKER_VERSION "0.0.0"

typedef DWORD(* OriginalFunctionWithDebugStart)(DWORD*, DWORD, DWORD);

Expand All @@ -31,17 +36,18 @@ void UpdateCurrentOpenSourceFile();

EXTERN_C INT WINAPI AutoLinker_MessageNotify(INT nMsg, DWORD dwParam1, DWORD dwParam2);


#ifndef __E_STATIC_LIB
#define LIB_GUID_STR "EA968347-300C-4515-8888-F1D3BA3DF67E" /*GUID串*/
#define LIB_MajorVersion 1 /*库主版本号*/
#define LIB_MinorVersion 2 /*库次版本号*/
#define LIB_BuildNumber 20231009 /*构建版本号*/
#define LIB_MinorVersion 0 /*库次版本号*/
#define LIB_BuildNumber 1000000 /*构建版本号*/
#define LIB_SysMajorVer 3 /*系统主版本号*/
#define LIB_SysMinorVer 7 /*系统次版本号*/
#define LIB_KrnlLibMajorVer 5 /*核心库主版本号*/
#define LIB_KrnlLibMinorVer 3 /*核心库次版本号*/
#define LIB_NAME_STR "AutoLinker" /*支持库名*/
#define LIB_DESCRIPTION_STR "AutoLinker" /*功能描述*/
#define LIB_DESCRIPTION_STR "AutoLinker 0.0.0.1000000,实现指定单.e文件的链接器,编译及调试时.ec成对的自动切换,重写核心库函数等功能。开源地址:https://github.com/aiqinxuancai/AutoLinker" /*功能描述*/
#define LIB_Author "aiqinxuancai" /*作者名称*/
#define LIB_ZipCode "" /*邮政编码*/
#define LIB_Address "" /*通信地址*/
Expand Down
4 changes: 3 additions & 1 deletion AutoLinker.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@
</Link>
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ELIB_FNE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)elib;.\detours;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)elib;.\detours;.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand Down Expand Up @@ -444,6 +444,7 @@
<ClCompile Include="MouseBack.cpp" />
<ClCompile Include="PathHelper.cpp" />
<ClCompile Include="StringHelper.cpp" />
<ClCompile Include="Version.cpp" />
<ClCompile Include="WindowHelper.cpp" />
<ClCompile Include="WinINetUtil.cpp" />
</ItemGroup>
Expand All @@ -468,6 +469,7 @@
<ClInclude Include="MouseBack.h" />
<ClInclude Include="PathHelper.h" />
<ClInclude Include="StringHelper.h" />
<ClInclude Include="Version.h" />
<ClInclude Include="WindowHelper.h" />
<ClInclude Include="WinINetUtil.h" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions AutoLinker.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
<ClCompile Include="WinINetUtil.cpp">
<Filter>Utils</Filter>
</ClCompile>
<ClCompile Include="Version.cpp">
<Filter>Utils</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="AutoLinker.h" />
Expand Down Expand Up @@ -124,6 +127,9 @@
<ClInclude Include="WinINetUtil.h">
<Filter>Utils</Filter>
</ClInclude>
<ClInclude Include="Version.h">
<Filter>Utils</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="AutoLinker.def" />
Expand Down
97 changes: 0 additions & 97 deletions AutoLinkerBuild/AutoLinkerBuild.cpp

This file was deleted.

4 changes: 0 additions & 4 deletions AutoLinkerBuild/AutoLinkerBuild.def

This file was deleted.

13 changes: 0 additions & 13 deletions AutoLinkerBuild/AutoLinkerBuild.h

This file was deleted.

Loading

0 comments on commit c4b47f2

Please sign in to comment.