Browse Source

优化 - 修复因路径而安装失败bug、优化对比版本号

chenrongqian 2 years ago
parent
commit
a02f26b310

+ 7 - 5
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/AppCore.cpp

@@ -60,8 +60,8 @@ void AppCore::InitAppTempPath()
  {
 	 wchar_t strTmpDir[MAX_PATH] = { 0 };
 	 GetTempPathW(MAX_PATH, strTmpDir);
-
-	 wstring temp = strTmpDir;
+	 wstring temp = wstring(strTmpDir);
+	 temp = L"";
 	 if (temp.empty() == false && temp != L"")
 	 {
 		 temp = temp + TempFolderName;//Temp»º´æÎļþ
@@ -78,9 +78,9 @@ void AppCore::InitAppTempPath()
 	 if (isCreate == FALSE)
 		 temp = L"";
 
-	 temp = temp+L"\\";
-	 PathCore::smPath_Temp = AppCore::ReplaceSubStr(temp, L"\\", L"/");
-
+	 /*temp = temp+L"\\";*/
+// PathCore::smPath_Temp = AppCore::ReplaceSubStr(temp, L"\\", L"/");
+	 PathCore::smPath_Temp = temp;
 
 	 isCreate = True;
 
@@ -92,6 +92,8 @@ void AppCore::InitAppTempPath()
 		 PathCore::smPath_Install = PathCore::smPath_Install + L"\\" + ExeCore::smName_AppName;
 		 if (!PathIsDirectoryW(PathCore::smPath_Install.c_str()))
 			 isCreate = CreateDirectory((PathCore::smPath_Install.c_str()), NULL);
+
+		 PathCore::smPath_DefaultInstall = PathCore::smPath_Install;
 	 }
  }
 

+ 23 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CCmd.cpp

@@ -29,6 +29,29 @@ BOOL CCmd::Installcmd()
 	return Executecmd(tc);
 }
 
+BOOL CCmd::InstallNetcmd()
+{
+	SYSTEM_INFO si;
+	GetNativeSystemInfo(&si);
+	std::wstring netframe;
+
+	if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ||
+		si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
+	{
+		netframe = L"C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319";
+	}
+	else
+	{
+		netframe = L"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319";
+	}
+
+	std::wstring cmd = L"";
+	cmd = L"/k cd " + netframe + L" & aspnet_regiis.exe -i /qb /qn /norestart";
+	WriteInIniFile("NET Framework4.0", cmd);
+	TCHAR* tc = (TCHAR*)(&cmd[0]);
+	return Executecmd(tc);
+}
+
 BOOL CCmd::OpenAppcmd()
 {
 	std::wstring cmd = L"";

+ 2 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CCmd.h

@@ -21,5 +21,7 @@ public:
 	 //²âÊÔ´úÂ룺ʼþÈÕÖ¾
 	 void WriteInIniFile(string contentType, wstring cmdContent);
 	 string GetVBAContent();
+
+	 BOOL InstallNetcmd();
 };
 

+ 3 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CDownLoadFile.cpp

@@ -7,6 +7,9 @@ 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);
+
 	DownloadProgress progress;
 	IBindStatusCallback* callback = (IBindStatusCallback*)&progress;
 

+ 3 - 2
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CFrameWnd.cpp

@@ -88,10 +88,11 @@ void CFrameWnd::SlotMsg(TNotifyUI& msg)
 LRESULT CFrameWnd::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
 	LRESULT lRes = 0;
-	//关闭窗口标识
+	//关闭窗口标识:任务栏右键菜单-》关闭窗口
 	if (wParam == 61536)
 	{
-		if (this->m_State.m_LayoutType == LayoutType::Installing)
+		//正在安装时,并且在联网的情况下,不允许退出程序窗口
+		if (this->m_State.m_LayoutType == LayoutType::Installing && NetWorkState::IsNetWorking())
 			return lRes;
 	}
 	lRes = CWindowWnd::HandleMessage(uMsg, wParam, lParam);

+ 2 - 1
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CMainPage.h

@@ -18,6 +18,7 @@
 #include "InstallingPage.h"
 #include "InstalledPage.h"
 #include "MessageBoxWnd.h"
+#include "ComparVersion.h"
 
 class CMainPage : public CNotifyPump
 {
@@ -48,6 +49,6 @@ public:
 	enum class LayoutType m_LayoutType = LayoutType::Home;
 	enum class VertionResultType m_VertionResultType = VertionResultType::None;
 	enum class InstallStateType m_InstallStateType = InstallStateType::None;
-
+	enum class InstallNetFrameworkType m_NetFrameworkType = InstallNetFrameworkType::None;
 
 }CurrentState;

+ 2 - 2
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CSystemInfo.cpp

@@ -16,7 +16,7 @@ CSystemInfo::CSystemInfo()
 
 bool CSystemInfo::IsHanvedCurrentWindow()
 {
-	std::wstring ss1 = PathCore::smPath_Temp + APPCONFIG;
+	std::wstring ss1 = PathCore::smPath_Temp + L"\\" + APPCONFIG;
 	wchar_t* ptr = _wcsdup(ss1.c_str());
 	std::string ss = AppCore::GetWideCharToMultiByte(ptr);
 	HANDLE h = ::CreateMutex(NULL, TRUE, ExeCore::smName_ExeProcess.c_str());
@@ -67,7 +67,7 @@ bool CSystemInfo::IsHanvedCurrentWindow()
 
  bool CSystemInfo::isWriteAppProcessInfoToIni(HWND hwnd)
 {
-	std::wstring ss1 = PathCore::smPath_Temp + APPCONFIG;
+	std::wstring ss1 = PathCore::smPath_Temp + L"\\" + APPCONFIG;
 	wchar_t* ptr = _wcsdup(ss1.c_str());
 	std::string ss = AppCore::GetWideCharToMultiByte(ptr);
 	DWORD pid = 0;

+ 4 - 4
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CSystemInfo.h

@@ -5,12 +5,12 @@ class CSystemInfo
 {
 public:
 	CSystemInfo();
-	static bool IsHanvedCurrentWindow();
+	static bool IsHanvedCurrentWindow();//是否已显示当前窗口
 
-	static bool isWriteAppProcessInfoToIni(HWND hwnd);
+	static bool isWriteAppProcessInfoToIni(HWND hwnd);//记录程序进程PID和线程ID,用来识别窗口句柄
 
-	static DWORD WriteIntToini(LPCSTR lpAppNam, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName);
-	static DWORD ReadIntFromini(LPCSTR lpAppNam, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName);
+	static DWORD WriteIntToini(LPCSTR lpAppNam, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName);//写入ini内容
+	static DWORD ReadIntFromini(LPCSTR lpAppNam, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName);//读取ini内容
 
 };
 

+ 1 - 1
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/CharConvert.cpp

@@ -20,7 +20,7 @@ wchar_t* CharConvert::wstringToWchar_tPtrW(wstring ws)
 #pragma endregion
 
 #pragma region UnicodeºÍANSI
-
+ 
 wstring CharConvert::GetWideCharW(char* multiByte)
 {
 	char* ch = multiByte;

+ 37 - 3
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/ComparVersion.cpp

@@ -1,15 +1,27 @@
 #include "ComparVersion.h"
-
+#include "CCmd.h"
 VertionResultType ComparVersion::GetProductInfo(wstring productName,wstring productUrl)
 {
 	DeviceProduct deviceProduct = DeviceProduct(productName);
-	OnlineProduct onlineProduct = OnlineProduct(); 
+	OnlineProduct onlineProduct = OnlineProduct();
 	onlineProduct.GetInstallPageVersion(productUrl);
+	int re = GetCompareNETFramework(deviceProduct.GetNETTargetVersion(), deviceProduct.GetNETVersion());
+	if (re == 1)
+	{
+		NetFramework = InstallNetFrameworkType::V46;
+	}
+	else if (re == 2)
+	{
+		NetFramework = InstallNetFrameworkType::V40_46;
+	}
 
- return GetCompareVersion(deviceProduct.GetVersion(), onlineProduct.GetVersionW());
+	return GetCompareVersion(deviceProduct.GetVersion(), onlineProduct.GetVersionW());
 }
 VertionResultType ComparVersion::GetCompareVersion(wstring deviceVersion,wstring onlineVersion)
 {
+	CCmd  cmd;
+	wstring test = L"DeviceVersion:" + deviceVersion + L"--OnlineVersion:" + onlineVersion;
+	cmd.WriteInIniFile("DeviceVersion:", test);
 	VertionResultType state = VertionResultType::None;
 	if (deviceVersion.find(onlineVersion) != -1)
 	{
@@ -36,4 +48,26 @@ VertionResultType ComparVersion::GetCompareVersion(wstring deviceVersion,wstring
 	}
 
 	return state;
+}
+
+//值:0为已存在4.0和4.6以上版本;1为只存在4.0;2为4.0和4.6以上都不存在
+int ComparVersion::GetCompareNETFramework(wstring minVersion, wstring maxVersion)
+{
+	if (minVersion == L"" || maxVersion == L"")
+		return 0;
+
+	wstring minVersionStr = minVersion.substr(0, 3);
+	wstring maxVersionStr = maxVersion.substr(0, 3);
+
+	int n = minVersionStr.compare(L"4.0");
+	
+
+	int n2 = maxVersion.compare(L"4.6");
+	if (n < 0)
+		return 2;
+
+	if(n2 < 0)
+		return 1;
+
+	return 0;
 }

+ 14 - 0
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/ComparVersion.h

@@ -4,12 +4,26 @@
 #include "DeviceProduct.h"
 #include "OnlineProduct.h"
 using namespace std;
+
+enum class InstallNetFrameworkType
+{
+	None,
+	V40,//安装v4.0
+	V46,//安装v4.6
+	V40_46//安装v4.0和v4.6
+};
+
+
 class ComparVersion
 {
+public:
+	InstallNetFrameworkType NetFramework = InstallNetFrameworkType::None;
 public:
 	//获取在线产品信息、设备已安装产品的信息
 	VertionResultType GetProductInfo(wstring productName, wstring productUrl);
 	//对比版本:架上版本号、设备已安装版本号
 	VertionResultType GetCompareVersion(wstring deviceVersion, wstring onlineVersion);
+public:
+	static int GetCompareNETFramework(wstring minVersion, wstring maxVersion);
 };
 

+ 77 - 34
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/DeviceProduct.cpp

@@ -1,13 +1,13 @@
 #include "DeviceProduct.h"
 DeviceProduct::DeviceProduct()
 {
-
 }
 
 DeviceProduct::DeviceProduct(wstring ProductName)
 {
 	m_ProductName = ProductName;
-	OpenLocalMachineRootKey();
+	FindNETFramework();
+	OpenLocalMachineRootKey(RegeditCore::smPath_ProductsInfo.c_str());
 }
 
 DeviceProduct::~DeviceProduct()
@@ -25,49 +25,35 @@ wstring DeviceProduct::GetInstallLocation()
 	return m_InstallLocation;
 }
 
-bool DeviceProduct::OpenLocalMachineRootKey()
-{
-	long lRet;
-	HKEY hKey;
-	LPCTSTR lpSubKey;
-
-	lpSubKey = RegeditCore::smPath_ProductsInfo.c_str();
-	lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
-	bool state = false;
 
-	if (lRet == ERROR_SUCCESS)
-	{
-		state = SearchAllProducts(hKey);
-	}
-
-	return state;
+wstring DeviceProduct::GetNETVersion()
+{
+	return m_NETVersion;
 }
 
+wstring DeviceProduct::GetNETTargetVersion()
+{
+	return m_NETTargetVersion;
+}
 
-bool DeviceProduct::OpenLocalMachineSubKey(std::wstring AppKey)
+bool DeviceProduct::OpenLocalMachineRootKey(LPCTSTR productsInfoPath)
 {
-	bool state = false;
 	long lRet;
 	HKEY hKey;
 	LPCTSTR lpSubKey;
-
-	AppKey = RegeditCore::smPath_ProductsInfo + L"\\" + AppKey;
-	lpSubKey = AppKey.c_str();
+	lpSubKey = productsInfoPath;
 	lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
-	
+	bool state = false;
+
 	if (lRet == ERROR_SUCCESS)
 	{
-		state = FindProductInfo(hKey, lpSubKey);
-	}
-	else
-	{
-		m_Version = L"";
+		state = SearchAllProducts(hKey, lpSubKey);
 	}
-	
+
 	return state;
 }
 
-bool DeviceProduct::SearchAllProducts(HKEY hKey)
+bool DeviceProduct::SearchAllProducts(HKEY hKey, LPCTSTR productsInfoPath)
 {
 	bool state = false;
 	DWORD index = 0;
@@ -83,6 +69,8 @@ bool DeviceProduct::SearchAllProducts(HKEY hKey)
 
 		if (!strBuffer.empty())
 		{
+			wstring productsInfo(productsInfoPath);
+			strBuffer = productsInfo + L"\\" + strBuffer;
 			state = OpenLocalMachineSubKey(strBuffer);
 		
 			if (state)
@@ -99,6 +87,30 @@ bool DeviceProduct::SearchAllProducts(HKEY hKey)
 }
 
 
+bool DeviceProduct::OpenLocalMachineSubKey(std::wstring AppKey)
+{
+	bool state = false;
+	long lRet;
+	HKEY hKey;
+	LPCTSTR lpSubKey;
+
+	//AppKey = RegeditCore::smPath_ProductsInfo + L"\\" + AppKey;
+	lpSubKey = AppKey.c_str();
+	lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
+
+	if (lRet == ERROR_SUCCESS)
+	{
+		state = FindProductInfo(hKey, lpSubKey);
+	}
+	else
+	{
+		m_Version = L"";
+	}
+
+	return state;
+}
+
+
 bool DeviceProduct::FindProductInfo(HKEY hKey, LPCTSTR lpSubKey)
 {
 	bool state = false;
@@ -129,19 +141,19 @@ bool DeviceProduct::FindProductInfo(HKEY hKey, LPCTSTR lpSubKey)
 			if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, strMidReg.c_str(), 0, KEY_ALL_ACCESS | KEY_WOW64_64KEY, &hkRKey) == ERROR_SUCCESS)
 			{
 				RegQueryValueEx(hkRKey, L"DisplayName", 0, &dwType, (LPBYTE)szBufferAppInfo, &dwNameLen);
-
 				wstring displayNameTemp(szBufferAppInfo);
+				dwNameLen = 255;
+				memset(szBufferAppInfo, 0, 255);
 
 				if (displayNameTemp == m_ProductName)
 				{
 					RegQueryValueEx(hkRKey, L"DisplayVersion", 0, &dwType, (LPBYTE)szBufferAppInfo, &dwNameLen);
-
 					wstring displayVersionTemp(szBufferAppInfo);
-
 					m_Version = displayVersionTemp;
+					dwNameLen = 255;
+					memset(szBufferAppInfo, 0, 255);
 
 					RegQueryValueEx(hkRKey, L"InstallLocation", 0, &dwType, (LPBYTE)szBufferAppInfo, &dwNameLen);
-
 					wstring installLocationTemp(szBufferAppInfo);
 					m_InstallLocation = installLocationTemp;
 
@@ -163,3 +175,34 @@ bool DeviceProduct::FindProductInfo(HKEY hKey, LPCTSTR lpSubKey)
 	}
 	return state;
 }
+
+
+
+bool DeviceProduct::FindNETFramework()
+{
+	HKEY hkRKey;
+	TCHAR szBufferAppInfo[255] = { 0 };
+	DWORD dwNameLen = 255;
+	DWORD dwType = REG_BINARY | REG_DWORD | REG_EXPAND_SZ | REG_MULTI_SZ | REG_NONE | REG_SZ | REG_DWORD_LITTLE_ENDIAN | REG_DWORD_BIG_ENDIAN | REG_LINK | REG_RESOURCE_LIST | REG_FULL_RESOURCE_DESCRIPTOR | REG_RESOURCE_REQUIREMENTS_LIST | REG_QWORD_LITTLE_ENDIAN;
+
+	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, RegeditCore::smPath_NETFrameworkInfo.c_str(), 0, KEY_READ | KEY_WOW64_64KEY, &hkRKey) == ERROR_SUCCESS)
+	{
+
+		RegQueryValueEx(hkRKey, L"TargetVersion", 0, &dwType, (LPBYTE)szBufferAppInfo, &dwNameLen);
+		wstring displayVersionTemp(szBufferAppInfo);
+		m_NETTargetVersion = displayVersionTemp;
+		dwNameLen = 255;
+		memset(szBufferAppInfo, 0, 255);
+
+		RegQueryValueEx(hkRKey, L"Version", 0, &dwType, (LPBYTE)szBufferAppInfo, &dwNameLen);
+		wstring installLocationTemp(szBufferAppInfo);
+		m_NETVersion  = installLocationTemp;
+
+		dwNameLen = 255;
+		memset(szBufferAppInfo, 0, 255);
+		return true;
+	}	
+	return false;
+
+}
+

+ 9 - 3
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/DeviceProduct.h

@@ -40,25 +40,31 @@ public:
 
 private:
 	DeviceProduct();
-	
 private:
 	wstring m_Version;
 	wstring m_ProductName;
 	wstring m_InstallLocation;
+
+	wstring m_NETVersion;
+	wstring m_NETTargetVersion;
 public:
 	//产品版本号
 	wstring GetVersion();
 	//产品安装路径
 	wstring GetInstallLocation();
+	wstring GetNETVersion();
+	wstring GetNETTargetVersion();
 private:
 	//访问LocalMachine主键
-	bool OpenLocalMachineRootKey();
+	bool OpenLocalMachineRootKey(LPCTSTR productsInfoPath);
 
 	//搜索所有产品
-	bool SearchAllProducts(HKEY hKey);
+	bool SearchAllProducts(HKEY hKey, LPCTSTR productsInfoPath);
 	//产找产品信息
 	bool FindProductInfo(HKEY hKey, LPCTSTR lpSubKey);
 	//访问LocalMachine下指定的路径
 	bool OpenLocalMachineSubKey(wstring AppKey);
 
+	bool FindNETFramework();
+
 };

+ 3 - 8
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/FileCore.cpp

@@ -19,13 +19,9 @@ bool FileCore::IsExistProductAppPath()
 
 bool FileCore::SourceFileMoveToDestionPath(wstring sourceFile, wstring destPath)
 {
-	SHFILEOPSTRUCT fop = { 0 };
-	fop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
-	fop.wFunc = FO_MOVE;//FO_COPY,FO_DELETE,FO_RENAME,FO_MOVE
-	fop.pFrom = (PCZZWSTR)&sourceFile;
-	fop.pTo = (PCZZWSTR)&destPath;
-	SHFileOperation(&fop);
-	return true;
+	wstring dest = destPath + L"\\" + Product::smName_InstallPackage;
+	bool issuccess = MoveFileExW(sourceFile.c_str(), dest.c_str(), MOVEFILE_REPLACE_EXISTING);
+	return issuccess;
 }
 #pragma endregion
 
@@ -136,7 +132,6 @@ bool DiskCore::IsEnoughDisk(wstring smPath)
 		if (Product::unFreeDiskMinSize > qwFreeBytesToCaller)
 			return false;
 	}
-	else
 		return true;
 }
 

+ 13 - 2
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/InstalledPage.cpp

@@ -38,6 +38,17 @@ void InstalledPage::InitValue()
 void InstalledPage::RefreshInstalledPath(wstring sFolder)
 {
 	LbInstalledPath->SetToolTipWidth(LbInstalledPath->GetWidth());
-	LbInstalledPath->SetToolTip(sFolder.c_str());
-	LbInstalledPath->SetText(sFolder.c_str());
+	//路径超过一定的长度,字符串末尾显示省略号
+	if (sFolder.length() > 70)
+	{
+		wstring str = sFolder.substr(0, 70) + L"...";
+		LbInstalledPath->SetToolTip(sFolder.c_str());
+		LbInstalledPath->SetText(str.c_str());
+	}
+	else
+	{
+		LbInstalledPath->SetToolTip(L"");
+		LbInstalledPath->SetText(sFolder.c_str());
+	}
+	
 }

+ 1 - 1
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/OnlineProduct.cpp

@@ -14,7 +14,7 @@ OnlineProduct::~OnlineProduct()
 const char* OnlineProduct::GetInstallPageVersion(wstring productUrl)
 {
 	//ÏÂÔØxmlÎļþ
-	wstring SaveFolder = AppCore::GetOrCreateFolderPath(PathCore::smPath_Temp) + L"/" + L"test.xml";
+	wstring SaveFolder = AppCore::GetOrCreateFolderPath(PathCore::smPath_Temp) + L"\\" + L"test.xml";
 	HRESULT Hfile = URLDownloadToFile(NULL, productUrl.c_str(), SaveFolder.c_str(), 0, NULL);
 
 	char* pStr = CharConvert::GetMultiByteW(SaveFolder.c_str());

+ 4 - 2
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/PDFReaderPro_Insrtaller.vcxproj

@@ -37,7 +37,7 @@
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
     <PlatformToolset>v143</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <WholeProgramOptimization>false</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@@ -217,7 +217,9 @@
     <ClCompile Include="WndInstall.cpp" />
     <ClCompile Include="WndInstalling.cpp" />
     <ClCompile Include="InstallingPage.cpp" />
-    <ClCompile Include="main.cpp" />
+    <ClCompile Include="main.cpp">
+      <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/utf-8 %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
     <ClCompile Include="src\lib_json\json_reader.cpp" />
     <ClCompile Include="src\lib_json\json_value.cpp" />
     <ClCompile Include="src\lib_json\json_writer.cpp" />

+ 14 - 10
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/WndInstall.cpp

@@ -92,7 +92,7 @@ void CFrameWnd::Install_Click()
 			MessageBoxWnd::Show(m_hWnd, MessageContentType::DiskNoSpace);
 			return;
 		}
-		
+
 		m_InstallingPage->installNotWork->SetText(CLanguage::GetDuiText(TextType::Text_Installing));
 		m_isCanInstall = GetVersionState();
 
@@ -107,8 +107,8 @@ void CFrameWnd::Install_Click()
 
 			thread installingThread(Thread_Installing, m_threadData);
 			installingThread.detach();
-
 		}
+
 	}
 	else
 	{
@@ -116,7 +116,7 @@ void CFrameWnd::Install_Click()
 
 		m_InstallingPage->NetWorkUI(m_bOnline);
 		SelectLayout(LayoutType::Installing);
-		
+
 	}
 	
 }
@@ -127,16 +127,19 @@ void CFrameWnd::Install_Click()
 void CFrameWnd::SetSelectedFolder()
 {
 	wstring sFolder = FolderCore::FolderBrowser(m_hWnd);
-
-	if (FolderCore::IsRootDirectoryW(sFolder) == true)
+	if (sFolder.empty() != true && sFolder != L"")
 	{
-		sFolder = FolderCore::AddSubFolderFromRootDirW(sFolder, ExeCore::smName_AppName);
-	}
+		if (FolderCore::IsRootDirectoryW(sFolder) == true)
+		{
+			sFolder = FolderCore::AddSubFolderFromRootDirW(sFolder, ExeCore::smName_AppName);
+		}
+
+		m_InstalledPage->RefreshInstalledPath(sFolder);
 
-	m_InstalledPage->RefreshInstalledPath(sFolder); 
+		PathCore::smPath_Install = sFolder;
+		m_InstallationPage->EdFilepath->SetText(sFolder.c_str());
+	}
 
-	PathCore::smPath_Install = sFolder;
-	m_InstallationPage->EdFilepath->SetText(sFolder.c_str());
 }
 
 void CFrameWnd::Thread_GetVerstion(ThreadData threadData)
@@ -149,6 +152,7 @@ bool CFrameWnd::GetVersionState()
 {
 	ComparVersion comparVersion;
 	VertionResultType state = comparVersion.GetProductInfo(ExeCore::smName_AppName, Product::URI_AppXml);
+	m_State.m_NetFrameworkType = comparVersion.NetFramework;
 	int stateBtn;
 	bool result = false;
 

+ 6 - 2
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/WndInstalling.cpp

@@ -30,7 +30,7 @@ void CFrameWnd::Thread_Installing(ThreadData threadData)
 	CDownLoadFile downLoadFile;
 	bool isDownloadSuccess = false;
 	CFrameWnd::m_SilenceInstallingType = SilenceInstallingType::DownLoading;
-
+	
 	isDownloadSuccess = downLoadFile.GetInstallPackage(PathCore::smPath_Install.c_str());
 
 	if (isDownloadSuccess == false)
@@ -65,6 +65,10 @@ void CFrameWnd::Thread_Installing(ThreadData threadData)
 		
 
 	CCmd cmd;
+	if (threadData.pFrame->m_State.m_NetFrameworkType == InstallNetFrameworkType::V40_46)
+	{
+		cmd.InstallNetcmd();
+	}
 
 	threadData.pFrame->StartTimer(TIMER_SILENTINSTALL_ID);
 	if (cmd.Installcmd())
@@ -106,7 +110,7 @@ void CFrameWnd::Thread_Installing(ThreadData threadData)
 		threadData.pFrame->SelectLayout(LayoutType::Installed);
 		std::wstring path = L"";
 		path = CLanguage::GetText(TextType::Btn_GoToFilesPath).c_str() + PathCore::smPath_Install;
-		threadData.pFrame->m_InstalledPage->LbInstalledPath->SetText(path.c_str());
+		threadData.pFrame->m_InstalledPage->RefreshInstalledPath(path);
 
 	}
 

+ 1 - 2
PDFReaderPro_Installer/PDFReaderPro_Insrtaller/main.cpp

@@ -35,10 +35,9 @@ bool LoadedResources(HINSTANCE hInstance)
 	return true;
 }
 
-
 int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpCmdLine*/, int nCmdShow)
 {
-	//初始化缓存路径
+
 	AppCore::InitAppTempPath();
 
 	// 初始化UI管理器