完成1.更新数据库2.获取导航栏

master
Mike Solar 2023-08-08 15:15:19 +08:00
parent 4220083ac3
commit 0ecf1bdf6a
22 changed files with 1365 additions and 636 deletions

Binary file not shown.

View File

@ -14,16 +14,18 @@
<ProjectGuid>{A49230DF-A869-4AA1-8ACA-3C7322530E46}</ProjectGuid> <ProjectGuid>{A49230DF-A869-4AA1-8ACA-3C7322530E46}</ProjectGuid>
<Keyword>QtVS_v304</Keyword> <Keyword>QtVS_v304</Keyword>
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild> <QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')"> <ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
@ -31,12 +33,12 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="QtSettings">
<QtInstall>5.6.3_msvc2015</QtInstall> <QtInstall>5.6.3_msvc2015</QtInstall>
<QtModules>core;gui;widgets;network</QtModules> <QtModules>core;gui;widgets;network;svg;sql;xml</QtModules>
<QtBuildConfig>debug</QtBuildConfig> <QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="QtSettings">
<QtInstall>5.6.3_msvc2015</QtInstall> <QtInstall>5.6.3_msvc2015</QtInstall>
<QtModules>core;gui;widgets</QtModules> <QtModules>core;gui;widgets;sql;svg;network;xml</QtModules>
<QtBuildConfig>release</QtBuildConfig> <QtBuildConfig>release</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')"> <Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
@ -60,11 +62,14 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:strictStrings- %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>/Zc:strictStrings- %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
@ -99,10 +104,12 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="buttonstruct.h" /> <ClInclude Include="buttonstruct.h" />
<ClInclude Include="config.h" /> <ClInclude Include="config.h" />
<QtMoc Include="exitmanager.h" />
<ClInclude Include="globalvariables.h" /> <ClInclude Include="globalvariables.h" />
<QtMoc Include="qminiblink.h" /> <QtMoc Include="qminiblink.h" />
<QtMoc Include="mysettingsdialog.h" /> <QtMoc Include="mysettingsdialog.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<QtMoc Include="sqlitehelper.h" />
<ClInclude Include="wke.h" /> <ClInclude Include="wke.h" />
<QtMoc Include="mainwindowlayout.h" /> <QtMoc Include="mainwindowlayout.h" />
<QtMoc Include="mainwindow.h" /> <QtMoc Include="mainwindow.h" />
@ -121,6 +128,7 @@
<ClCompile Include="navbar.cpp" /> <ClCompile Include="navbar.cpp" />
<ClCompile Include="netio.cpp" /> <ClCompile Include="netio.cpp" />
<ClCompile Include="qminiblink.cpp" /> <ClCompile Include="qminiblink.cpp" />
<ClCompile Include="sqlitehelper.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="mainscreen.ui" /> <QtUic Include="mainscreen.ui" />

View File

@ -22,11 +22,6 @@
<Extensions>ts</Extensions> <Extensions>ts</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup>
<QtRcc Include="OfficeAssistant_msvc.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="buttonstruct.h"> <ClInclude Include="buttonstruct.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
@ -69,6 +64,12 @@
<QtMoc Include="mysettingsdialog.h"> <QtMoc Include="mysettingsdialog.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="sqlitehelper.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="exitmanager.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
@ -83,9 +84,6 @@
<ClCompile Include="mainwindowlayout.cpp"> <ClCompile Include="mainwindowlayout.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="MyButton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="navbar.cpp"> <ClCompile Include="navbar.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -98,6 +96,12 @@
<ClCompile Include="mysettingsdialog.cpp"> <ClCompile Include="mysettingsdialog.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="sqlitehelper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MyButton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="navbar.ui"> <QtUic Include="navbar.ui">
@ -129,4 +133,9 @@
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</Image> </Image>
</ItemGroup> </ItemGroup>
<ItemGroup>
<QtRcc Include="OfficeAssistant_msvc.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
</ItemGroup>
</Project> </Project>

View File

@ -5,9 +5,9 @@
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtLastBackgroundBuild>2023-08-03T08:03:42.8435391Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2023-08-06T14:26:06.9540300Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtLastBackgroundBuild>2023-08-03T08:03:43.2818738Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2023-08-08T01:58:34.1935757Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -10,9 +10,11 @@ typedef struct taButtonStruct{
QImage *image; QImage *image;
QImage *image_cover; QImage *image_cover;
QString text; QString text;
QString orig_name;
QString url; QString url;
QString background_color; QString background_color;
QColor text_color; QColor text_color;
QColor text_cover_color; QColor text_cover_color;
QString path;
}ButtonStruct; }ButtonStruct;
#endif //OFFICEASSISTANT_BUTTONSTRUCT_H #endif //OFFICEASSISTANT_BUTTONSTRUCT_H

View File

@ -18,4 +18,5 @@
#define ADD_SHORTCUT 2 #define ADD_SHORTCUT 2
#define VERSION "1.0.0" //软件版本 #define VERSION "1.0.0" //软件版本
#define RELEASE "20230801" //Release #define RELEASE "20230801" //Release
#define SOFTWARE_URL "http://softapi.1.y01.cn/addons/Kmdsoft/Index/soft"
#endif //OFFICEASSISTANT_CONFIG_H #endif //OFFICEASSISTANT_CONFIG_H

View File

@ -0,0 +1,52 @@
#pragma once
#include <QObject>
#include <QList>
template <typename T>
class AutoDeleteList
{
public:
// 添加对象
void add(T *obj)
{
objs.append(obj);
}
// 析构对象列表
~AutoDeleteList()
{
qDeleteAll(objs);
}
private:
QList<T *> objs;
};
class ExitManager : public QObject
{
Q_OBJECT
public:
// 添加需要在退出时自动析构的对象
template <typename T>
void add(T *obj)
{
autoDeleteList.add(obj);
}
// 退出应用程序
void exit(int exitCode = 0)
{
// 发射退出应用程序信号
emit exitApplication(exitCode);
}
signals:
// 退出应用程序信号
void exitApplication(int exitCode);
private:
// 自动析构对象列表
AutoDeleteList<QObject> autoDeleteList;
};

View File

@ -4,7 +4,9 @@
#ifndef OFFICEASSISTANT_GLOBALVARIABLES_H #ifndef OFFICEASSISTANT_GLOBALVARIABLES_H
#define OFFICEASSISTANT_GLOBALVARIABLES_H #define OFFICEASSISTANT_GLOBALVARIABLES_H
#include "exitmanager.h"
class MainWindowLayout; class MainWindowLayout;
extern ExitManager exit_manager;
extern double scale; extern double scale;
extern MainWindowLayout *mainWindowLayout; extern MainWindowLayout *mainWindowLayout;
extern QString url_param; extern QString url_param;

View File

@ -7,6 +7,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_MainWindow.h" #include "ui_MainWindow.h"
#include "config.h" #include "config.h"
ExitManager exit_manager;
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), ui(new Ui::MainWindow) { QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this); ui->setupUi(this);

View File

@ -10,6 +10,7 @@
#include "mainwindowlayout.h" #include "mainwindowlayout.h"
#include <QIcon> #include <QIcon>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; } namespace Ui { class MainWindow; }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -7,13 +7,16 @@
#include "mainwindowlayout.h" #include "mainwindowlayout.h"
#include "ui_MainWindowLayout.h" #include "ui_MainWindowLayout.h"
#include "mysettingsdialog.h" #include "mysettingsdialog.h"
#include "sqlitehelper.h"
MainWindowLayout::MainWindowLayout(QWidget *parent) : MainWindowLayout::MainWindowLayout(QWidget *parent) :
QWidget(parent), ui(new Ui::MainWindowLayout) { QWidget(parent), ui(new Ui::MainWindowLayout) {
ui->setupUi(this); ui->setupUi(this);
setContentsMargins(0, 0, 0, 0); setContentsMargins(0, 0, 0, 0);
layout=new QVBoxLayout(this); layout=new QVBoxLayout(this);
mainWindowLayout = this; mainWindowLayout = this;
SQLiteHelper sqlite_helper;
QList<ButtonStruct> list;
sqlite_helper.get_software(&list);
ConfigRequest *configRequest = new ConfigRequest; ConfigRequest *configRequest = new ConfigRequest;
configResponse = new ConfigResponse; configResponse = new ConfigResponse;
configRequest->sendRequest(configResponse); configRequest->sendRequest(configResponse);

View File

@ -11,7 +11,7 @@ MySettingsDialog::MySettingsDialog(QWidget *parent)
setWindowFlags(Qt::WindowCloseButtonHint); setWindowFlags(Qt::WindowCloseButtonHint);
this->setFixedSize(width(), height()); this->setFixedSize(width(), height());
HKEY hRoot = HKEY_CURRENT_USER; HKEY hRoot = HKEY_CURRENT_USER;
wchar_t *szSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; wchar_t *szSubKey = (wchar_t *)"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
HKEY hKey; HKEY hKey;
DWORD dwDisposition = REG_OPENED_EXISTING_KEY; // 如果不存在不创建 DWORD dwDisposition = REG_OPENED_EXISTING_KEY; // 如果不存在不创建
LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL, LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL,
@ -44,7 +44,7 @@ void MySettingsDialog::autoStart(int state)
{ {
if (state == Qt::Checked) { if (state == Qt::Checked) {
HKEY hRoot = HKEY_CURRENT_USER; HKEY hRoot = HKEY_CURRENT_USER;
wchar_t *szSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; wchar_t *szSubKey = (wchar_t*)L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
HKEY hKey; HKEY hKey;
DWORD dwDisposition = REG_OPENED_EXISTING_KEY; // 如果不存在不创建 DWORD dwDisposition = REG_OPENED_EXISTING_KEY; // 如果不存在不创建
LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL, LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL,
@ -65,7 +65,7 @@ void MySettingsDialog::autoStart(int state)
} }
else if (state == Qt::Unchecked) { else if (state == Qt::Unchecked) {
HKEY hRoot = HKEY_CURRENT_USER; HKEY hRoot = HKEY_CURRENT_USER;
wchar_t *szSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; wchar_t *szSubKey = (wchar_t*)L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
HKEY hKey; HKEY hKey;
DWORD dwDisposition = REG_OPENED_EXISTING_KEY; DWORD dwDisposition = REG_OPENED_EXISTING_KEY;
LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL, LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL,

View File

@ -14,8 +14,10 @@
#include "globalvariables.h" #include "globalvariables.h"
#ifdef _DEBUG #ifdef _DEBUG
#pragma comment(lib, "Qt5Svgd.lib") #pragma comment(lib, "Qt5Svgd.lib")
#pragma comment(lib, "Qt5Sqld.lib")
#else #else
#pragma comment(lib, "Qt5Svg.lib") #pragma comment(lib, "Qt5Svg.lib")
#pragma comment(lib, "Qt5Sql.lib")
#endif #endif
QString url_param; QString url_param;
void ConvertImageToTransparent(QImage &img) void ConvertImageToTransparent(QImage &img)
@ -46,7 +48,7 @@ NavBar::NavBar(ConfigResponse *configResponse, MainScreen *mainScreen,QWidget *p
setStyleSheet(style);*/ setStyleSheet(style);*/
//setStyleSheet("margin:0"); //setStyleSheet("margin:0");
setContentsMargins(0, 0, 0, 0); setContentsMargins(0, 0, 0, 0);
if (configResponse->succeed&&configResponse->menus.empty()!=true) { if (configResponse->succeed&&configResponse->buttons.empty()!=true) {
getLogoFromInternet(configResponse); getLogoFromInternet(configResponse);
} }
else { else {
@ -141,7 +143,7 @@ void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
logo = new QImage(); logo = new QImage();
logo->loadFromData(*buffer); logo->loadFromData(*buffer);
buffer->clear(); buffer->clear();
for (auto button : configResponse->menus) { for (auto button : configResponse->buttons) {
QUrl url_image(button.img); QUrl url_image(button.img);
QNetworkRequest *request_image = new QNetworkRequest(url_image); QNetworkRequest *request_image = new QNetworkRequest(url_image);
reply = manager->get(*request_image); reply = manager->get(*request_image);

View File

@ -23,6 +23,7 @@
#include <ctime> #include <ctime>
#include <qDebug> #include <qDebug>
#include "globalvariables.h" #include "globalvariables.h"
#include "buttonstruct.h"
#pragma comment(lib, "wbemuuid.lib") #pragma comment(lib, "wbemuuid.lib")
#ifdef _DEBUG #ifdef _DEBUG
#pragma comment(lib, "Qt5Networkd.lib") #pragma comment(lib, "Qt5Networkd.lib")
@ -221,7 +222,7 @@ void ConfigRequest::sendRequest(ConfigResponse *configResponse) {
delete httpMgr; delete httpMgr;
return; return;
} }
qDebug() << result.toJson(); //qDebug() << result.toJson();
//如果数据完整 //如果数据完整
if(result.isObject()){ if(result.isObject()){
@ -240,13 +241,15 @@ void ConfigRequest::sendRequest(ConfigResponse *configResponse) {
auto i=0; auto i=0;
for(auto value:array){ for(auto value:array){
QJsonObject object=value.toObject(); QJsonObject object=value.toObject();
Menu menu; Button button;
menu.img=object.value("img").toString(); button.img=object.value("img").toString();
menu.img_cover=object.value("img_cover").toString(); // button.img_cover=object.value("img_cover").toString();
menu.title=object.value("title").toString(); button.title=object.value("title").toString();
menu.func=object.value("func").toString(); button.categroy_id = object.value("category_id").toString();
menu.url=object.value("url").toString(); button.op = object.value("op").toString();
configResponse->menus << menu; button.func=object.value("func").toString();
button.url=object.value("url").toString();
configResponse->buttons << button;
i++; i++;
} }
configResponse->succeed = true; configResponse->succeed = true;
@ -572,3 +575,70 @@ DeviceRequest::DeviceRequest() : RequestBodyBase() {
eventLoop.exec(); eventLoop.exec();
delete httpMgr; delete httpMgr;
} }
bool SoftwareRequest::sendRequest(QHash<QString, Record> *records)
{
timer = new QTimer(this);
QNetworkAccessManager* httpMgr = new QNetworkAccessManager();
QNetworkRequest requestInfo;
//HTTP请求
//请求头
QJsonArray array;
for(auto record : *records)
{
array.append(record.orig_name);
}
QJsonObject obj_root = qJsonDocument.object();
obj_root.insert("orig_names", array);
qJsonDocument.setObject(obj_root);
QString url = SOFTWARE_URL;
requestInfo.setUrl(url);
requestInfo.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/json"));
//保存响应的变量
reply = httpMgr->post(requestInfo, qJsonDocument.toJson());
qDebug() << qJsonDocument.toJson();
//开启一个循环,直到超时或者获取到数据为止
connect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
//设置定时器防止超时
connect(timer, &QTimer::timeout, this, &SoftwareRequest::cancelDownload);
timer->start(5000);
//启动循环
eventLoop.exec();
timer->stop();
QJsonDocument result;
// auto error = reply->error();
//如果没有错误
if (reply->error() == QNetworkReply::NoError) {
result = QJsonDocument::fromJson(reply->readAll());
}
else {
//如果有错误
delete timer;
delete httpMgr;
return false;
}
//qDebug() << result.toJson();
//如果数据完整
if (result.isObject()) {
QJsonObject obj_root2 = result.object();
QJsonArray array = obj_root2.value("data").toObject().value("menu").toArray();
for (auto value : array) {
QJsonObject object = value.toObject();
QString orig_name = object.value("orig_name").toString();
(*records)[orig_name].logo = object.value("img").toString();
(*records)[orig_name].op = object.value("op").toString();
(*records)[orig_name].func = object.value("func").toString();
(*records)[orig_name].url = object.value("url").toString();
}
}
else {
//数据不完整
//delete reply;
delete timer;
delete httpMgr;
return false;
}
delete httpMgr;
return true;
}

View File

@ -12,15 +12,19 @@
#include <QJsonObject> #include <QJsonObject>
#include <Windows.h> #include <Windows.h>
#include <QtNetwork/QtNetwork> #include <QtNetwork/QtNetwork>
#include "buttonstruct.h"
#include "sqlitehelper.h"
typedef struct { typedef struct {
QString img; QString img;
QString img_cover; QString img_cover;
QString title; QString title;
QString orig_name;
QString categroy_id;
QString op;
QString func; QString func;
QString url; QString url;
} Menu; } Button;
typedef struct { typedef struct {
bool succeed; bool succeed;
struct { struct {
@ -32,7 +36,7 @@ typedef struct {
QString title_color; QString title_color;
QString title_cover_color; QString title_cover_color;
}basic; }basic;
QList<Menu> menus; QList<Button> buttons;
}ConfigResponse; }ConfigResponse;
class RequestBodyBase:public QObject{ class RequestBodyBase:public QObject{
@ -111,6 +115,8 @@ inline QString getMachineGUID() {
} }
class SoftwareRequest :public RequestBodyBase { class SoftwareRequest :public RequestBodyBase {
public:
SoftwareRequest():RequestBodyBase(){}
bool sendRequest(QHash<QString, Record>*records);
}; };
#endif //OFFICEASSISTANT_NETIO_H #endif //OFFICEASSISTANT_NETIO_H

View File

@ -0,0 +1,519 @@
#include "sqlitehelper.h"
#include <QMessageBox>
#include "globalvariables.h"
#include "MyButton.h"
#include <Windows.h>
#include <ShObjIdl.h>
#include <PropKey.h>
#include <ShlObj.h>
#include <QtXml/QtXml>
#include <QtSvg/QtSvg>
#include "navbar.h"
#include "netio.h"
#include "config.h"
#ifdef _DEBUG
#pragma comment (lib,"Qt5Xmld.lib")
#else
#pragma comment (lib,"Qt5Xml.lib")
#endif
#pragma comment (lib,"Shell32.lib")
#if _MSC_VER >=1936
#include <filesystem>
namespace fs = std::filesystem;
#else
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif
SQLiteHelper::SQLiteHelper(QObject *parent)
: QObject(parent)
{
if (QSqlDatabase::contains("qt_sql_default_connection"))
{
db = QSqlDatabase::database("qt_sql_default_connection");
}
else
{
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("OfficeAssistant.db");
}
if (!db.open())
{
QMessageBox::critical(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("无法打开数据库"));
exit_manager.exit(1);
}
}
SQLiteHelper::~SQLiteHelper()
{
db.close();
}
bool SQLiteHelper::update_software()
{
HKEY hKeyUninstall = nullptr;
QMap<QString, Record> records;
QList<QString> paths;
/*QSqlQuery query;
QString sql = "select * from kmd_menu;";
query.exec(sql);
while(query.next())
{
Record record;
record.id = query.value("id").toInt();
record.sort = query.value("sort").toInt();
record.app_id = query.value("app_id").toString();
record.locked = query.value("locked").toBool();
record.type = query.value("type").toString();
record.category_id = query.value("category_id").toString();
record.name = query.value("name").toString();
record.orig_name = query.value("orig_name").toString();
record.version = query.value("version").toString();
record.dev = query.value("dev").toString();
record.create_time = query.value("create_time").toLongLong();
record.use_time = query.value("use_time").toLongLong();
record.op = query.value("op").toString();
record.func = query.value("func").toString();
record.path = query.value("path").toString();
record.url = query.value("url").toString();
QStringList path_list = record.path.split("\\");
path_list.removeLast();
QString path;
for(auto str : path_list)
{
path.append(str);
path.append("\\");
}
path.remove(path.length() - 1, 1);
records.insert(path, record);
}*/
//开始菜单中已安装软件列表
WCHAR path[MAX_PATH];
HRESULT hr = SHGetFolderPathW(nullptr, CSIDL_COMMON_PROGRAMS, nullptr, 0, path);//获取ProgramData中开始菜单的路径
std::wstring path_str(path);
for(auto file : fs::directory_iterator(path_str))
{
Record record;
if(fs::is_regular_file(file))
{
if(file.path().extension().wstring()==L".lnk")
{
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
IShellItem* pShellItem;
hr = SHCreateItemFromParsingName(file.path().wstring().c_str(), nullptr, IID_PPV_ARGS(&pShellItem));
if (SUCCEEDED(hr))
{
IPersistFile* pPersistFile;
hr = pShellItem->QueryInterface(IID_PPV_ARGS(&pPersistFile));
if (SUCCEEDED(hr))
{
WCHAR szTargetPath[MAX_PATH];
LPOLESTR pszTargetPath = szTargetPath;
hr = pPersistFile->Load(nullptr, STGM_READ);
if (SUCCEEDED(hr))
{
hr = pPersistFile->GetCurFile(&pszTargetPath);
if (SUCCEEDED(hr))
{
paths<<QString::fromWCharArray(szTargetPath);
}
else
{
pPersistFile->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
}else
{
pPersistFile->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
pPersistFile->Release();
}else
{
pShellItem->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
pShellItem->Release();
}else
{
CoUninitialize();
return false;
}
CoUninitialize();
}
}
}
}
for(int i=0;i<sizeof(path)/sizeof(wchar_t);i++)
{
path[i] = 0;
}
hr = SHGetFolderPathW(nullptr, CSIDL_PROGRAMS, nullptr, 0, path);//获取用户文件夹中开始菜单的路径
path_str.clear();
path_str = std::wstring(path);
for (auto file : fs::directory_iterator(path_str))
{
Record record;
if (fs::is_regular_file(file))
{
if (file.path().extension().wstring() == L".lnk")
{
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
IShellItem* pShellItem;
hr = SHCreateItemFromParsingName(file.path().wstring().c_str(), nullptr, IID_PPV_ARGS(&pShellItem));
if (SUCCEEDED(hr))
{
IPersistFile* pPersistFile;
hr = pShellItem->QueryInterface(IID_PPV_ARGS(&pPersistFile));
if (SUCCEEDED(hr))
{
WCHAR szTargetPath[MAX_PATH];
LPOLESTR pszTargetPath = szTargetPath;
hr = pPersistFile->Load(nullptr, STGM_READ);
if (SUCCEEDED(hr))
{
hr = pPersistFile->GetCurFile(&pszTargetPath);
if (SUCCEEDED(hr))
{
paths << QString::fromWCharArray(szTargetPath);
}
else
{
pPersistFile->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
}
else
{
pPersistFile->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
pPersistFile->Release();
}
else
{
pShellItem->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
pShellItem->Release();
}
else
{
CoUninitialize();
return false;
}
CoUninitialize();
}
}
}
}
// 打开注册表中的已安装软件列表
QHash<QString, Record> reg_records;
HKEY hKey;
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
// 枚举该列表下所有子键
for (DWORD i = 0; ; i++)
{
WCHAR szSubKey[MAX_PATH] = { 0 };
DWORD dwSize = MAX_PATH;
if (RegEnumKeyExW(hKey, i, szSubKey, &dwSize, NULL, NULL, NULL, NULL)
== ERROR_SUCCESS)
{
// 读取软件属性值
HKEY hSubKey;
if (RegOpenKeyExW(hKey, szSubKey, 0, KEY_READ, &hSubKey) == ERROR_SUCCESS)
{
Record record;
WCHAR szProductPath[MAX_PATH] = { 0 };
WCHAR buffer[MAX_PATH] = { 0 };
DWORD buffer_num;
dwSize = MAX_PATH * sizeof(WCHAR);
//安装文件夹
if (RegQueryValueExW(hSubKey, L"InstallLocation", NULL, NULL,
(LPBYTE)szProductPath, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
QString path = QString::fromWCharArray(szProductPath);
//软件名
if (RegQueryValueExW(hSubKey, L"DisplayName", NULL, NULL,
(LPBYTE)buffer, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
record.name = QString::fromWCharArray(buffer);
record.orig_name = QString::fromWCharArray(buffer);
//图标
if (RegQueryValueExW(hSubKey, L"DisplayIcon", NULL, NULL,
(LPBYTE)buffer, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
record.logo = QString::fromWCharArray(buffer);
//主版本号
if (RegQueryValueExW(hSubKey, L"VersionMajor", NULL, NULL,
(LPBYTE)buffer_num, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
QString versionMajor = QString::number(buffer_num);
//次版本号
if (RegQueryValueExW(hSubKey, L"VersionMinor", NULL, NULL,
(LPBYTE)buffer_num, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
QString versionMinor = QString::number(buffer_num);
//将主版本号和次版本号拼接在一起
QString version = versionMajor + "." + versionMinor;
record.version = version;
//开发者
if (RegQueryValueExW(hSubKey, L"Publisher", NULL, NULL,
(LPBYTE)buffer, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
record.dev = QString::fromWCharArray(buffer);
record.type = "app";
record.locked = false;
RegCloseKey(hSubKey);
reg_records.insert(path, record);
}
}
else
{
break;
}
}
RegCloseKey(hKey);
}
//对比两个路径,找出公共部分
QHash<QString, Record> public_programs_list;
for(auto path:paths)
{
QStringList path_list = path.split("\\");
path_list.removeLast();
QString path2;
for(auto str : path_list)
{
path2.append(str);
path2.append("\\");
}
path2.remove(path2.length() - 1, 1);
if(reg_records.contains(path2))
{
reg_records[path2].path = path;
public_programs_list.insert(reg_records[path2].orig_name, reg_records[path2]);
}
}
//进行网络请求,补全字段
SoftwareRequest software_request;
if(!software_request.sendRequest(&public_programs_list))
{
return false;
}
QSqlQuery begin("begin;");
if (!begin.exec())
{
return false;
}
for(auto key : public_programs_list.keys())
{
QString sql_find = "select sort from kmd_menu where orig_name='";
sql_find += key;
sql_find += "';";
QSqlQuery query_find(sql_find);
if(!query_find.exec())
{
QSqlQuery rollback("rollback;");
rollback.exec();
return false;
}
QString sql;
if(query_find.next())
{
sql = "update kmd_menu set";
sql += " path='";
sql += public_programs_list[key].path;
sql += "'";
sql += " op=";
sql += public_programs_list[key].op;
sql += " func=";
sql += public_programs_list[key].func;
sql += " url=";
sql += public_programs_list[key].url;
sql += " where orig_name='";
sql += key;
sql += "';";
}
else
{
sql = "insert into kmd_menu (sort,app_id,locked,type,category_id,name,orig_name,version,dev,create_time,use_time,op,func,path,url) values (";
sql += "50";
sql += ",'";
sql += public_programs_list[key].app_id;
sql += "',";
sql += QString::number(public_programs_list[key].locked);
sql += ",'";
sql += public_programs_list[key].type;
sql += "','";
sql += public_programs_list[key].category_id;
sql += "','";
sql += public_programs_list[key].name;
sql += "','";
sql += public_programs_list[key].orig_name;
sql += "','";
sql += public_programs_list[key].version;
sql += "','";
sql += public_programs_list[key].dev;
sql += "',";
sql += QString::number(public_programs_list[key].create_time);
sql += ",";
sql += QString::number(public_programs_list[key].use_time);
sql += ",'";
sql += public_programs_list[key].op;
sql += "','";
sql += public_programs_list[key].func;
sql += "','";
sql += public_programs_list[key].path;
sql += "','";
sql += public_programs_list[key].url;
sql += "');";
}
QSqlQuery query(sql);
if(!query.exec())
{
QSqlQuery rollback("rollback;");
rollback.exec();
return false;
}
}
QSqlQuery commit("commit;");
commit.exec();
return true;
}
void SetSVGBackColor(QDomElement& elem, QString strtagname, QString strattr, QString strattrval)
{
if (elem.tagName().compare(strtagname) == 0)
{
QString before_color = elem.attribute(strattr);
elem.setAttribute(strattr, strattrval);
QString color = elem.attribute(strattr);
}
for (int i = 0; i < elem.childNodes().count(); i++)
{
if (!elem.childNodes().at(i).isElement())
{
continue;
}
SetSVGBackColor(elem.childNodes().at(i).toElement(), strtagname, strattr, strattrval);
}
}
bool SQLiteHelper::get_software(QList<ButtonStruct>* buttons)
{
QSqlQuery query(db);
QString sql = "select * from kmd_menu;";
if (!query.exec(sql))
{
return false;
}
QByteArray* buffer = new QByteArray;
while (query.next())
{
QNetworkAccessManager manager;
downloadSuccess = true;
ButtonStruct button_struct;
button_struct.path = query.value("path").toString();
button_struct.text = query.value("name").toString();
button_struct.orig_name = query.value("orig_name").toString();
QUrl url_image(query.value("logo").toString());
QNetworkRequest* request_image = new QNetworkRequest(url_image);
reply = manager.get(*request_image);
QTimer timer;
timer.setInterval(5000);
connect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
connect(&timer, &QTimer::timeout, this, &SQLiteHelper::cancelDownload);
eventLoop.exec();
timer.stop();
QImage* image = new QImage(200, 200, QImage::Format_ARGB32);
if (downloadSuccess) {
*buffer = reply->readAll();
QSvgRenderer* render_image = new QSvgRenderer(*buffer);
QPainter painter_image(image);
painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布
painter_image.fillRect(image->rect(), Qt::transparent); // 填充透明色
painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值
render_image->render(&painter_image);
buffer->clear();
delete render_image;
}
else
{
QString icon = QApplication::applicationDirPath() + "/icon/default.svg";
QFile file(icon);
if(!file.open(QIODevice::ReadOnly))
{
return false;
}
QByteArray svg_buffer = file.readAll();
file.close();
QDomDocument doc;
doc.setContent(svg_buffer);
QColor color;
color.setNamedColor(DEFAULT_COLOR);
SetSVGBackColor(doc.documentElement(), "path", "fill",QColor() );
}
reply->close();
button_struct.image = image;
*buttons << button_struct;
}
return true;
}
void SQLiteHelper::cancelDownload() {
disconnect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
eventLoop.quit();
reply->abort();
downloadSuccess = false;
}
bool SQLiteHelper::update_others()
{
}

View File

@ -0,0 +1,49 @@
#pragma once
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
#include <QtSql/QSqlQuery>
#include <QString>
#include <QObject>
#include <QDate>
#include <QtNetwork/QtNetwork>
#include "buttonstruct.h"
typedef struct {
int id;
int sort;
QString app_id;
bool locked;
QString type;
QString category_id;
QString logo;
QString name;
QString orig_name;
QString version;
QString dev;
time_t create_time;
time_t use_time;
QString op;
QString func;
QString path;
QString url;
}Record;
class SQLiteHelper : public QObject
{
Q_OBJECT
public:
SQLiteHelper(QObject *parent = nullptr);
bool update_software();
bool get_software(QList<ButtonStruct>* buttons);
bool update_others();
~SQLiteHelper();
private:
QNetworkReply* reply;
QEventLoop eventLoop;
bool downloadSuccess;
QSqlDatabase db;
void cancelDownload();
};

BIN
identifier.sqlite Normal file

Binary file not shown.

0
kmd.db Normal file
View File

View File

@ -22,32 +22,32 @@
<ProjectGuid>{4433F5C3-0237-403B-A997-264E56C78F53}</ProjectGuid> <ProjectGuid>{4433F5C3-0237-403B-A997-264E56C78F53}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>startcalc</RootNamespace> <RootNamespace>startcalc</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@ -28,26 +28,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>