Bladeren bron

优化 - 头文件代码

chenrongqian@kdanmobile.com 2 jaren geleden
bovenliggende
commit
7aaee31a8f
21 gewijzigde bestanden met toevoegingen van 53 en 72 verwijderingen
  1. 1 2
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CAdsBanner.cpp
  2. 2 0
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CAdsBanner.h
  3. 25 29
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CCmd.cpp
  4. 6 4
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CCmd.h
  5. 1 9
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CDownLoadFile.cpp
  6. 3 0
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CDownLoadFile.h
  7. 1 13
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CFrameWnd.cpp
  8. 0 1
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CLanguage.cpp
  9. 0 3
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CSystemInfo.cpp
  10. 2 0
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CSystemInfo.h
  11. 0 1
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CharConvert.cpp
  12. 1 0
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CharConvert.h
  13. 1 2
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/ComparVersion.cpp
  14. 2 0
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/ComparVersion.h
  15. 0 3
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/FileCore.cpp
  16. 5 0
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/FileCore.h
  17. 0 1
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/InstallPage.cpp
  18. 1 0
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/InstallingPage.h
  19. 1 1
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/WndBanner.cpp
  20. 0 1
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/WndInstalled.cpp
  21. 1 2
      PDFReaderPro_Installer/PDFReaderPro_Insrtaller/WndInstalling.cpp

+ 1 - 2
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CAdsBanner.cpp

@@ -1,6 +1,5 @@
 #include "CAdsBanner.h"
-#include "KeyVar.h"
-#include "CLanguage.h"
+
 CAdsBanner::CAdsBanner()
 {
 

+ 2 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CAdsBanner.h

@@ -4,6 +4,8 @@
 #include <json/reader.h>
 #include <fstream>
 #include "FileCore.h"
+#include "KeyVar.h"
+#include "CLanguage.h"
 class CAdsBanner
 {
 public:

+ 25 - 29
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CCmd.cpp

@@ -1,7 +1,5 @@
 #include "CCmd.h"
-#include "KeyVar.h"
-#include <ShlObj.h>
-#include "Logini.h"
+
 #pragma region cmd指令说明
 // 【/k】:调用cmd进程时,必须调用此参数
 // //  【x:】:x为x盘符,cd到不同盘符下的文件夹路径之前,必须要要调用此参数,否则cd指令不生效;
@@ -129,19 +127,27 @@ BOOL CCmd::Executecmd(TCHAR pszCmdLine[],bool isVBA)
 		return TRUE;
 
 }
-bool CCmd::GetVBA() 
+
+#pragma region VBA脚本指令
+//编辑vba脚本内容-》生成文件vba文件到安装路径-》执行vba文件
+// vba作为静默安装的备用方案
+// 
+//因时间有限,暂时不进行排查修复UTF-16的vba脚本执行没反应的问题
+bool CCmd::GetVBA_UTF16()
 {
 	
 	std::wstring cmdd = L"";
 	std::wstring echoc = L"ECHO.";
+	//vba脚本内容
 	cmdd = L"@echo off\n" +
 		echoc + L"\n" +
 		PathCore::smPath_Install.substr(0, 1) + L": & " + L"cd " + L"%~dp0" + L"\n" +
 		echoc + L"\n" +
 		echoc + L"\n" +
-		L"start/wait " + Product::smName_InstallPackage + L" APPDIR=\""+ PathCore::smPath_Install +L"\" /qb /qn" + L"\n" +
+		L"start/wait " + Product::smName_InstallPackage + L" APPDIR=\"" + PathCore::smPath_Install + L"\" /qb /qn" + L"\n" +
 		echoc + L"\n" +
 		L"EXIT";
+
 	wstring Installpath = PathCore::smPath_Install + L"\\install.bat";
 	HANDLE hDevice = CreateFileW(Installpath.c_str(), GENERIC_READ | GENERIC_WRITE, 0, 0,
 		OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
@@ -151,10 +157,9 @@ bool CCmd::GetVBA()
 		DWORD errorCode = GetLastError();
 		return false;
 	}
-	
-	//char* chBuffer = d2;
+
 	DWORD dwWriteSize = 0;
-	auto chBuffer =cmdd.c_str();
+	auto chBuffer = cmdd.c_str();
 	DWORD nBytes;
 	WORD a = 0xFEFF;
 	WriteFile(hDevice, &a, sizeof(a), &nBytes, NULL);
@@ -176,23 +181,11 @@ bool CCmd::GetVBA()
 	//	//printf("chbuffer is %s /n", chBuffer);
 	//}
 	CloseHandle(hDevice);
-	Executecmd(nullptr,true);
+	Executecmd(nullptr, true);
 }
 
-bool CCmd::GetVBAContent()
+bool CCmd::GetVBA_UTF8()
 {
-
-	//std::wstring bat = L"";
-	//std::wstring echo = L"ECHO.";
-	//bat = L"@echo off\n" +
-	//	echo + L"\n" +
-	//	L"cd " + PathCore::smPath_Install.substr(0, 1) + L":" + L"%~dp0" + L"\n" +
-	//	echo + L"\n" +
-	//	echo + L"\n" +
-	//	L"start/wait " + Product::smName_InstallPackage + L" APPDIR=%cd% /qb /qn" + L"\n" +
-	//	echo + L"\n" +
-	//	L"EXIT";
-
 	wstring Installpath = PathCore::smPath_Install + L"\\install.bat";
 	LPCWSTR Installpathstr = Installpath.c_str();
 
@@ -210,10 +203,10 @@ bool CCmd::GetVBAContent()
 	std::string echoc = "ECHO.";
 	cmdd = "@echo off\n" +
 		echoc + "\n" +
-		rootch + ": & " + "cd " +  "%~dp0" + "\n" +
+		rootch + ": & " + "cd " + "%~dp0" + "\n" +
 		echoc + "\n" +
 		echoc + "\n" +
-		"start/wait " + InstallPackagech + " APPDIR=%cd%"+  +" /qb /qn" + "\n" +
+		"start/wait " + InstallPackagech + " APPDIR=%cd%" + +" /qb /qn" + "\n" +
 		echoc + "\n" +
 		"EXIT";
 	char* chBuffer = &cmdd[0];
@@ -227,20 +220,19 @@ bool CCmd::GetVBAContent()
 		return false;
 	}
 	DWORD dwSize = GetFileSize(hDevice, NULL);
-	//char* chBuffer = d2;
 	DWORD dwWriteSize = 0;
 	WORD a = 0xFEFF;
 	WriteFile(hDevice, &a, sizeof(a), &dwWriteSize, NULL);
-	 BOOL bRet = WriteFile(hDevice, chBuffer, lstrlenA(chBuffer) * sizeof(char), &dwWriteSize, NULL);
+	BOOL bRet = WriteFile(hDevice, chBuffer, lstrlenA(chBuffer) * sizeof(char), &dwWriteSize, NULL);
 	//BOOL bRet = WriteFile(hDevice, chBuffer, cmdd.length(), &dwWriteSize, NULL);
 	if (bRet)
 	{
 		return false;
 	}
-	FlushFileBuffers(hDevice);   //将缓冲区数据写入磁盘
+	FlushFileBuffers(hDevice);
 
 	LONG IDistance = 0;
-	DWORD dwPtr = SetFilePointer(hDevice, IDistance, NULL, FILE_BEGIN);  //调整文件指针到文件开头
+	DWORD dwPtr = SetFilePointer(hDevice, IDistance, NULL, FILE_BEGIN);
 	DWORD dwReadSize = 0;
 	/*bRet = ReadFile(hDevice, chBuffer, 10, &dwReadSize, NULL);
 	if (bRet)
@@ -251,4 +243,8 @@ bool CCmd::GetVBAContent()
 
 	return Executecmd(nullptr, true);;
 
-}
+}
+#pragma endregion
+
+
+

+ 6 - 4
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CCmd.h

@@ -2,7 +2,9 @@
 #include<string>
 #include <tchar.h>
 #include <windows.h>
-#include "CCmd.h"
+#include <ShlObj.h>
+#include "KeyVar.h"
+#include "Logini.h"
 #include "CharConvert.h"
 #include "FileCore.h"
 
@@ -15,11 +17,11 @@ public:
 	 CCmd();
 	//静默安装指令
 	 BOOL Installcmd();
-	//打开App指令
+	//打开App指令:暂时没有用到这个函数:直接使用启动程序接口来打开便可
 	 BOOL OpenAppcmd();
 	 BOOL Executecmd(TCHAR pszCmdLine[], bool isVBA = false);
-	 bool GetVBAContent();
-	 bool GetVBA();
+	 bool GetVBA_UTF8();
+	 bool GetVBA_UTF16();
 	 BOOL InstallNetcmd();
 };
 

+ 1 - 9
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CDownLoadFile.cpp

@@ -1,18 +1,10 @@
 #include "CDownLoadFile.h"
-#include <WinInet.h>
-#include "KeyVar.h"
-#include <tchar.h>
-
-
-//#include <Shlwapi.h>
 
 double DownloadProgress::Currentpercentage = 0;
 double DownloadProgress::pro_value = 0;
 double DownloadProgress::pro_Sum = 0;
 bool CDownLoadFile::GetInstallPackage(std::wstring SaveFolder)
-{/*
-	if (!PathIsDirectoryW(PathCore::smPath_Install.c_str()))
-		CreateDirectory((PathCore::smPath_Install.c_str()), NULL);*/
+{
 	FolderCore::GetOrCreateFolderPath(PathCore::smPath_Install.c_str());
 	DownloadProgress progress;
 	IBindStatusCallback* callback = (IBindStatusCallback*)&progress;

+ 3 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CDownLoadFile.h

@@ -5,6 +5,9 @@
 #pragma comment(lib, "urlmon.lib")
 #include "FileCore.h"
 #include "KeyVar.h"
+#include <WinInet.h>
+#include <tchar.h>
+
 class DownloadProgress : public IBindStatusCallback
 {
 

+ 1 - 13
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CFrameWnd.cpp

@@ -1,17 +1,5 @@
-#include "stdafx.h"
-#include <sstream>
-#include "CFrameWnd.h"
-#include<vector>
-#include <Utils/stb_image.h>
-#define UIMSG_SET_DPI WM_USER + 200
-
-#include <Windows.h>
 
-#include <AccCtrl.h>
-#include <AclAPI.h>
-#include <tchar.h>
-#include <iostream>
-#include<accctrl.h>
+#include "CFrameWnd.h"
 
 #pragma region ʼþÂß¼­´¦Àí
 

+ 0 - 1
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CLanguage.cpp

@@ -1,5 +1,4 @@
 
-//#include "stdafx.h"
 #include "Clanguage.h"
 #pragma region Ìí¼ÓÎÄ°¸
 std::wstring CLanguage::GetContent(TextType textType)

+ 0 - 3
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CSystemInfo.cpp

@@ -1,11 +1,8 @@
 #include "CSystemInfo.h"
-#include <string>
-
 #define APPCONFIG L"config.ini"
 #define THREADPROCESS "ThreadProcess"
 #define PID "pid"
 #define THREADID "TheardId"
-#include "KeyVar.h"
 
 CSystemInfo::CSystemInfo()
 {

+ 2 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CSystemInfo.h

@@ -1,6 +1,8 @@
 #pragma once
 #include "CharConvert.h"
 #include "LogIni.h"
+#include "KeyVar.h"
+#include <string>
 class CSystemInfo
 {
 public:

+ 0 - 1
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CharConvert.cpp

@@ -1,5 +1,4 @@
 #include "CharConvert.h"
-#include "stdafx.h"
 
 #pragma region ×Ö·û´®±àÂë´¦Àí
 

+ 1 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CharConvert.h

@@ -1,4 +1,5 @@
 #pragma once
+#include "stdafx.h"
 #include<string>
 using namespace std;
 

+ 1 - 2
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/ComparVersion.cpp

@@ -1,6 +1,5 @@
 #include "ComparVersion.h"
-#include "CCmd.h"
-#include "Logini.h"
+
 VertionResultType ComparVersion::GetProductInfo(wstring productName,wstring productUrl)
 {
 	DeviceProduct deviceProduct = DeviceProduct(productName);

+ 2 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/ComparVersion.h

@@ -3,6 +3,8 @@
 #include<string>
 #include "DeviceProduct.h"
 #include "OnlineProduct.h"
+#include "CCmd.h"
+#include "Logini.h"
 using namespace std;
 
 enum class InstallNetFrameworkType

+ 0 - 3
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/FileCore.cpp

@@ -1,7 +1,4 @@
 #include "FileCore.h"
-#include "stdafx.h"
-#include "KeyVar.h"
-#include <Shlwapi.h>
 
 #pragma region Îļþ
 

+ 5 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/FileCore.h

@@ -1,7 +1,12 @@
 #pragma once
 #include<string>
 using namespace std;
+#include <Shlwapi.h>
 #include<windows.h>
+
+#include "stdafx.h"
+#include "KeyVar.h"
+
 class FileCore
 {
 #pragma region Îļþ

+ 0 - 1
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/InstallPage.cpp

@@ -1,5 +1,4 @@
 #include "InstallPage.h"
-#include "KeyVar.h"
 
 InstallationPage::InstallationPage(CPaintManagerUI* m_pm)
 {

+ 1 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/InstallingPage.h

@@ -4,6 +4,7 @@
 #include "duilib.h"
 #include "resource.h"
 #include "DefineUI.h"
+#include "KeyVar.h"
 
 //°²×°ÖнçÃæ
 class InstallingPage

+ 1 - 1
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/WndBanner.cpp

@@ -1,5 +1,5 @@
 #include "CFrameWnd.h"
-#include "KeyVar.h"
+
 void CFrameWnd::Thread_LoadedBanner(ThreadData threadData)
 {
 	threadData.pFrame->GetBanner();

+ 0 - 1
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/WndInstalled.cpp

@@ -1,5 +1,4 @@
 #include "CFrameWnd.h"
-#include "KeyVar.h"
 
 void CFrameWnd::InitInstalledControls()
 {

+ 1 - 2
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/WndInstalling.cpp

@@ -1,5 +1,4 @@
 #include "CFrameWnd.h"
-#include "KeyVar.h"
 
 void CFrameWnd::InitInstallingControls()
 {
@@ -112,7 +111,7 @@ void CFrameWnd::Thread_Installing(ThreadData threadData)
 				{
 					if (FileCore::IsExistProductAppPath() == false)
 					{
-						cmd.GetVBAContent();
+						cmd.GetVBA_UTF8();
 					}
 					DownloadProgress::Currentpercentage = 0;
 					threadData.pFrame->m_InstallingPage->SetProgressValue(0);