#pragma once
#include "stdafx.h"
#include "duilib.h"
#include <Shlwapi.h>
#include "KeyVar.h"

class FileCore
{
#pragma region 文件
public:
	static bool IsExistTheFileW(wstring filePath);
	static bool IsExistProductAppPath();//安装后的产品应用程序绝对路径
	static bool SourceFileMoveToDestionPath(wstring sourceFile,wstring destPath);//
#pragma endregion

};

class FolderCore
{
#pragma region 文件夹
public:
	static wstring GetNewSaveFolder(wstring saveFilePath, wstring oldchar, wstring newchar);
	static wstring GetOrCreateFolderPath(wstring saveFilePath);

	static bool IsExistTheFolderW(wstring folderPath);
	//是否存在根目录
	static bool IsRootDirectoryW(wstring folderPath);
	//在根目录下预设子文件夹路径，此时未创建子文件夹
	static wstring AddSubFolderFromRootDirW(wstring folderPath, wstring newSubFolderName);
	//文件夹选择器
	static wstring FolderBrowser(HWND m_hWnd);
	/// <summary>
/// 获取系统路径
/// </summary>
/// <param name="csidl">系统指定的路径名称，例如user\\kdan\\文档</param>
/// <returns>系统路径</returns>
	static wstring  SetSHGetFolderPath(_In_ int csidl);
	static void InitAppTempPath();
	/// <summary>
	/// 获取缓存路径，并在缓存路径下创建一个文件夹
	/// </summary>
	/// <returns>如果获取不到缓存路径，就更换为文档路径；若两个路径都获取不到，就返回空字符串</returns>
	static wstring  GetAppTempPath();
	static void ClearAllTempFolder();
	static void RemoveFolder(wstring path);
#pragma endregion


};

class DiskCore
{
public:
	//磁盘空间是否充足
	static bool IsEnoughDisk(wstring smPath);
	//系统盘的盘符
	static wstring GetSystemDriveLetter();

	//路径长度是否合理，isDowndPackgeBefore为是否在下载安装包之前判断（因为安装包文件名也有长度）
	static bool IsMeetInstallPathMaxLength(bool isDowndPackgeBefore);
};