diff --git a/CMakeLists.txt b/CMakeLists.txt index 715d51e..cc8a03f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,8 +56,6 @@ set(resource_src set(ithvnr_src gui/command.cpp - gui/CustomFilter.cpp - gui/CustomFilter.h gui/ITH.h gui/language.cpp gui/language.h diff --git a/gui/CustomFilter.cpp b/gui/CustomFilter.cpp deleted file mode 100644 index 9fe03f0..0000000 --- a/gui/CustomFilter.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com) - * This file is part of the Interactive Text Hooker. - - * Interactive Text Hooker is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "CustomFilter.h" - -void CustomFilter::Insert(WORD number) -{ - set.insert(number); -} - -void CustomFilter::Erase(WORD number) -{ - set.erase(number); -} - -bool CustomFilter::Find(WORD number) const -{ - return set.find(number) != set.end(); -} - -void CustomFilter::Clear() -{ - set.clear(); -} - -void CustomFilter::Traverse(CustomFilterCallBack callback, PVOID param) -{ - for (auto ch = set.begin(); ch != set.end(); ++ch) - callback(*ch, param); -} diff --git a/gui/CustomFilter.h b/gui/CustomFilter.h deleted file mode 100644 index fb298a0..0000000 --- a/gui/CustomFilter.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 2010-2012 kaosu (qiupf2000@gmail.com) - * This file is part of the Interactive Text Hooker. - - * Interactive Text Hooker is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include "ITH.h" - -typedef void (*CustomFilterCallBack) (WORD, PVOID); - -class CustomFilter -{ -public: - bool Find(WORD number) const; - void Insert(WORD number); - void Erase(WORD number); - void Clear(); - void Traverse(CustomFilterCallBack callback, PVOID param); -private: - std::set set; -}; diff --git a/gui/main.cpp b/gui/main.cpp index 7ccda17..70381e2 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -19,7 +19,6 @@ #include "host/host.h" #include "host/hookman.h" #include "host/settings.h" -#include "CustomFilter.h" #include "profile/Profile.h" #include "ProfileManager.h" @@ -36,8 +35,6 @@ extern "C" { void IthCloseSystemService(); } -CustomFilter* uni_filter; -CustomFilter* mb_filter; HookManager* man; Settings* setman; LONG split_time, cyclic_remove, global_filter; @@ -94,10 +91,6 @@ void SaveSettings() auto root = doc.root().append_child(L"ITH_Setting"); for (auto it = setting.begin(); it != setting.end(); ++it) root.append_attribute(it->first.c_str()).set_value(it->second); - auto filter = root.append_child(L"SingleCharFilter"); - filter.append_child(pugi::xml_node_type::node_pcdata); - mb_filter->Traverse(RecordMBChar, &filter); - uni_filter->Traverse(RecordUniChar, &filter); doc.save(fw); } } @@ -169,32 +162,6 @@ void LoadSettings() if (it != setting.end()) it->second = std::stoul(attr->value()); } - auto filter = root.child(L"SingleCharFilter"); - if (filter) - { - for (auto attr = filter.attributes_begin(); attr != filter.attributes_end(); ++attr) - { - if (attr->name()[0] == L'm') - { - DWORD c = std::stoul(attr->name() + 1, NULL, 16); - mb_filter->Insert(c & 0xFFFF); - } - else if (attr->name()[0] == L'u') - { - DWORD c = std::stoul(attr->name() + 1, NULL, 16); - uni_filter->Insert(c & 0xFFFF); - } - } - std::wstring filter_value = filter.text().get(); - for (auto it = filter_value.begin(); it != filter_value.end(); ++it) - { - WCHAR filter_unichar[2] = { *it, L'\0' }; - char filter_mbchar[4]; - WC_MB(filter_unichar, filter_mbchar, 4); - mb_filter->Insert(*(WORD*)filter_mbchar); - uni_filter->Insert(*it); - } - } } } @@ -254,8 +221,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine setman->splittingInterval = 200; MonitorFlag = true; pfman = new ProfileManager(); - mb_filter = new CustomFilter(); - uni_filter = new CustomFilter(); DefaultSettings(); LoadSettings(); InitializeSettings(); diff --git a/gui/window.cpp b/gui/window.cpp index fe84a05..2c49b79 100644 --- a/gui/window.cpp +++ b/gui/window.cpp @@ -24,7 +24,6 @@ #include "version.h" #include "ProfileManager.h" #include "host/settings.h" -#include "CustomFilter.h" #include "profile/Profile.h" #include "TextBuffer.h" #include "profile/misc.h" @@ -45,8 +44,6 @@ ProcessWindow* pswnd; TextBuffer* texts; extern ProfileManager* pfman; // ProfileManager.cpp extern HookManager* man; // main.cpp -extern CustomFilter* mb_filter; // main.cpp -extern CustomFilter* uni_filter; // main.cpp extern Settings* setman; // main.cpp #define COMMENT_BUFFER_LENGTH 512 static WCHAR comment_buffer[COMMENT_BUFFER_LENGTH];