mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Added MattKing's code to allow a user to set the path and name of the text file to have Debug=2 write to. This will allow persistence for html files retrieved by WebParser, so they can be parsed as a local file as needed.
Usage: [WebParserMeasure] Debug2File="[path\]Filename.ext" Debug=2 Examples: [WebParserMeasure] Debug2File="Debug2File.txt" (saves to current skin folder) Debug=2 [WebParserMeasure] Debug2File="#SKINSPATH#DebugFiles\Debug2File.txt" (saves to \DebugFiles under the \Skins folder) Debug=2 Notes: Must be enclosed in quotes. Must include at least a filename. Path alone will not work. Must be a directory which already exists. Does not create the target directory. If the Debug2File= parameter is not used, WebParser will save webparserdbump.txt in the root of C: as it always has.
This commit is contained in:
parent
f8bd5fb2eb
commit
dd1369c440
@ -61,6 +61,7 @@ struct UrlData
|
|||||||
std::wstring downloadedFile;
|
std::wstring downloadedFile;
|
||||||
std::wstring iniFile;
|
std::wstring iniFile;
|
||||||
int debug;
|
int debug;
|
||||||
|
std::wstring debugFileLocation;
|
||||||
HANDLE threadHandle;
|
HANDLE threadHandle;
|
||||||
HANDLE dlThreadHandle;
|
HANDLE dlThreadHandle;
|
||||||
};
|
};
|
||||||
@ -192,6 +193,15 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
|||||||
data->finishAction = ReadConfigString(section, L"FinishAction", L"");
|
data->finishAction = ReadConfigString(section, L"FinishAction", L"");
|
||||||
data->errorString = ReadConfigString(section, L"ErrorString", L"");
|
data->errorString = ReadConfigString(section, L"ErrorString", L"");
|
||||||
data->proxy = ReadConfigString(section, L"ProxyServer", L"");
|
data->proxy = ReadConfigString(section, L"ProxyServer", L"");
|
||||||
|
data->debugFileLocation = ReadConfigString(section, L"Debug2File", L"c:\\WebParserDump.txt");
|
||||||
|
|
||||||
|
if(data->debugFileLocation.find(L"\\") == -1)
|
||||||
|
{
|
||||||
|
std::wstring str = data->iniFile.substr(0,data->iniFile.find_last_of(L"\\")+1);
|
||||||
|
str += data->debugFileLocation;
|
||||||
|
Log(str.c_str());
|
||||||
|
data->debugFileLocation = str;
|
||||||
|
}
|
||||||
|
|
||||||
tmpSz = ReadConfigString(section, L"StringIndex", L"0");
|
tmpSz = ReadConfigString(section, L"StringIndex", L"0");
|
||||||
if (tmpSz)
|
if (tmpSz)
|
||||||
@ -363,7 +373,11 @@ DWORD WINAPI NetworkThreadProc(LPVOID pParam)
|
|||||||
if (urlData->debug == 2)
|
if (urlData->debug == 2)
|
||||||
{
|
{
|
||||||
// Dump to a file
|
// Dump to a file
|
||||||
FILE* file = fopen("C:\\WebParserDump.txt", "wb");
|
|
||||||
|
// Convert to a narrow string
|
||||||
|
std::string path(urlData->debugFileLocation.begin(), urlData->debugFileLocation.end());
|
||||||
|
|
||||||
|
FILE* file = fopen(path.c_str(), "wb");
|
||||||
fwrite(data, sizeof(BYTE), dwSize, file);
|
fwrite(data, sizeof(BYTE), dwSize, file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user