Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.5 #40

Merged
merged 8 commits into from
Feb 18, 2022
Merged

v0.5 #40

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Hijacker/Hijacker.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,13 @@
<ClInclude Include="framework.h" />
<ClInclude Include="helper.hpp" />
<ClInclude Include="ipc.hpp" />
<ClInclude Include="ipc_window.hpp" />
<ClInclude Include="match.hpp" />
<ClInclude Include="pch.h" />
<ClInclude Include="pinyin.hpp" />
<ClInclude Include="PinyinSearch.hpp" />
<ClInclude Include="PinyinSearchEdit.hpp" />
<ClInclude Include="PinyinSearchPcre.hpp" />
<ClInclude Include="quick_select.hpp" />
<ClInclude Include="resource.h" />
<ClInclude Include="search_history.hpp" />
Expand All @@ -185,6 +190,13 @@
<ClCompile Include="config.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="ipc.cpp" />
<ClCompile Include="ipc_window.cpp" />
<ClCompile Include="match.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MaxSpeed</Optimization>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MaxSpeed</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Default</BasicRuntimeChecks>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Default</BasicRuntimeChecks>
</ClCompile>
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
Expand All @@ -193,6 +205,9 @@
</ClCompile>
<ClCompile Include="pinyin.cpp" />
<ClCompile Include="pinyin_data.cpp" />
<ClCompile Include="PinyinSearch.cpp" />
<ClCompile Include="PinyinSearchEdit.cpp" />
<ClCompile Include="PinyinSearchPcre.cpp" />
<ClCompile Include="quick_select.cpp" />
<ClCompile Include="search_history.cpp" />
</ItemGroup>
Expand All @@ -206,5 +221,6 @@
<Import Project="C:\L\C++\packages\IbWinCppLib\IbWinCppLib.props" />
<Import Project="C:\L\C++\packages\IbDllHijackLib\IbDllHijackLib.props" />
<Import Project="C:\L\C++\packages\IbEverythingLib\IbEverythingLib.props" />
<Import Project="C:\L\C++\packages\IbPinyinLib\IbPinyinLib.props" />
</ImportGroup>
</Project>
30 changes: 30 additions & 0 deletions Hijacker/Hijacker.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@
<ClInclude Include="config.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PinyinSearchPcre.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PinyinSearch.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PinyinSearchEdit.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ipc_window.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="match.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
Expand All @@ -68,6 +83,21 @@
<ClCompile Include="config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PinyinSearchPcre.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PinyinSearch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PinyinSearchEdit.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ipc_window.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="match.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Hijacker.rc">
Expand Down
21 changes: 21 additions & 0 deletions Hijacker/PinyinSearch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "pch.h"
#include "PinyinSearch.hpp"
#include "PinyinSearchPcre.hpp"
#include "PinyinSearchEdit.hpp"

std::unique_ptr<PinyinSearch> make_pinyin_search(PinyinSearchMode mode, std::wstring& instance_name, HWND ipc_window) {
if (mode == PinyinSearchMode::Auto) {
try {
return std::make_unique<PinyinSearchPcre>();
} catch (const std::runtime_error& e) {
mode = PinyinSearchMode::Edit;
}
}

switch (mode) {
case PinyinSearchMode::Pcre:
return std::make_unique<PinyinSearchPcre>();
case PinyinSearchMode::Edit:
return std::make_unique<PinyinSearchEdit>(instance_name, ipc_window);
}
}
23 changes: 23 additions & 0 deletions Hijacker/PinyinSearch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once
#include <memory>
#include <string>

#include <vector>
#define IB_PINYIN_ENCODING 32
#include <IbPinyinLib/Pinyin.hpp>

enum class PinyinSearchMode {
Auto,
Pcre,
Edit
};

class PinyinSearch {
public:
virtual ~PinyinSearch() {}

virtual void everything_created() {}
virtual void edit_created(HWND edit) {}
};

std::unique_ptr<PinyinSearch> make_pinyin_search(PinyinSearchMode mode, std::wstring& instance_name, HWND ipc_window);
Loading