
#pragma once
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>
#include <time.h> //或者 #include <ctime>
#include <io.h>
#pragma comment(lib,"version.lib")
#include "../cJson/cJSON.h"
#include <vector>
#include <string>
using namespace std;
namespace Global
{
	//////////////////////////////////////////////////////////////////////////
	// 全局变量;
	extern TCHAR g_szCurModuleDir[MAX_PATH];
	extern TCHAR g_szCurModulePath[MAX_PATH];
	extern TCHAR g_szFna[MAX_PATH];
	extern TCHAR g_szConfig[MAX_PATH];

	extern bool g_bEnableLog;
	extern TCHAR g_szLogPath[MAX_PATH];
	extern COleDateTime g_lastTime;
	extern time_t g_time;
	extern FILE *gp_log_fp;

	typedef struct _TLOG_{
		string report_type;
		string report_data;
	}TLog, *pTLog;

	//////////////////////////////////////////////////////////////////////////
	// 全局函数;
	bool GetVersion(IN const TCHAR *fname, OUT WORD *pdwFileVersion, OUT WORD *pdwProductVerion);
	BOOL GetVersion(IN HMODULE hModule, OUT DWORD(&dwFVArray)[4], OUT DWORD(&dwPVArray)[4]);
	void WriteTextLog(const TCHAR *format, ...);
	void WritePythonLog(const TCHAR *msg);
	void ClosePythonLog();
	std::string EnCode_UTF8URL(IN const CHAR* pText);
	std::string &trim(std::string &str);
	// 字符串是否由数字、字母、符号组成;
	BOOL IsValidString(LPCTSTR lpszString);
	string DeCode_URLUNICODE(IN const CHAR* pURLText);
};
