Use new funcs in other modules
This commit is contained in:
parent
204a752a96
commit
99e3920008
@ -10,7 +10,7 @@ namespace Utils
|
|||||||
if (mimeType)
|
if (mimeType)
|
||||||
{
|
{
|
||||||
std::wstring wMimeType(mimeType);
|
std::wstring wMimeType(mimeType);
|
||||||
return std::string(wMimeType.begin(), wMimeType.end());
|
return String::Convert(wMimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "application/octet-stream";
|
return "application/octet-stream";
|
||||||
|
@ -396,7 +396,7 @@ namespace Utils
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebIO::formatPath(std::string &path, bool win)
|
void WebIO::formatPath(std::string& path, bool win)
|
||||||
{
|
{
|
||||||
size_t nPos;
|
size_t nPos;
|
||||||
std::string find = "\\";
|
std::string find = "\\";
|
||||||
@ -408,7 +408,7 @@ namespace Utils
|
|||||||
replace = "\\";
|
replace = "\\";
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((nPos = path.find(find)) != std::wstring::npos)
|
while ((nPos = path.find(find)) != std::string::npos)
|
||||||
{
|
{
|
||||||
path = path.replace(nPos, find.length(), replace);
|
path = path.replace(nPos, find.length(), replace);
|
||||||
}
|
}
|
||||||
@ -445,7 +445,7 @@ namespace Utils
|
|||||||
return (FtpRenameFileA(this->hConnect, directory.data(), newDir.data()) == TRUE); // According to the internetz, this should work
|
return (FtpRenameFileA(this->hConnect, directory.data(), newDir.data()) == TRUE); // According to the internetz, this should work
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebIO::listElements(const std::string& directory, std::vector<std::string> &list, bool files)
|
bool WebIO::listElements(const std::string& directory, std::vector<std::string>& list, bool files)
|
||||||
{
|
{
|
||||||
list.clear();
|
list.clear();
|
||||||
|
|
||||||
@ -483,12 +483,12 @@ namespace Utils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebIO::listDirectories(const std::string& directory, std::vector<std::string> &list)
|
bool WebIO::listDirectories(const std::string& directory, std::vector<std::string>& list)
|
||||||
{
|
{
|
||||||
return this->listElements(directory, list, false);
|
return this->listElements(directory, list, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebIO::listFiles(const std::string& directory, std::vector<std::string> &list)
|
bool WebIO::listFiles(const std::string& directory, std::vector<std::string>& list)
|
||||||
{
|
{
|
||||||
return this->listElements(directory, list, true);
|
return this->listElements(directory, list, true);
|
||||||
}
|
}
|
||||||
@ -532,7 +532,7 @@ namespace Utils
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebIO::downloadFileData(const std::string& file, std::string &data)
|
bool WebIO::downloadFileData(const std::string& file, std::string& data)
|
||||||
{
|
{
|
||||||
data.clear();
|
data.clear();
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ namespace Utils
|
|||||||
bool deleteDirectory(const std::string& directory);
|
bool deleteDirectory(const std::string& directory);
|
||||||
bool renameDirectory(const std::string& directory, const std::string& newDir);
|
bool renameDirectory(const std::string& directory, const std::string& newDir);
|
||||||
|
|
||||||
bool listDirectories(const std::string& directory, std::vector<std::string> &list);
|
bool listDirectories(const std::string& directory, std::vector<std::string>& list);
|
||||||
bool listFiles(const std::string& directory, std::vector<std::string> &list);
|
bool listFiles(const std::string& directory, std::vector<std::string>& list);
|
||||||
|
|
||||||
bool deleteFile(const std::string& file);
|
bool deleteFile(const std::string& file);
|
||||||
bool renameFile(const std::string& file, const std::string& newFile);
|
bool renameFile(const std::string& file, const std::string& newFile);
|
||||||
@ -60,7 +60,7 @@ namespace Utils
|
|||||||
bool downloadFile(const std::string& file, const std::string& localfile);
|
bool downloadFile(const std::string& file, const std::string& localfile);
|
||||||
|
|
||||||
bool uploadFileData(const std::string& file,const std::string& data);
|
bool uploadFileData(const std::string& file,const std::string& data);
|
||||||
bool downloadFileData(const std::string& file, std::string &data);
|
bool downloadFileData(const std::string& file, std::string& data);
|
||||||
|
|
||||||
void setProgressCallback(Utils::Slot<void(size_t, size_t)> callback);
|
void setProgressCallback(Utils::Slot<void(size_t, size_t)> callback);
|
||||||
void cancelDownload() { this->cancel = true; }
|
void cancelDownload() { this->cancel = true; }
|
||||||
@ -104,7 +104,7 @@ namespace Utils
|
|||||||
|
|
||||||
std::string execute(const char* command, const std::string& body, WebIO::Params headers = WebIO::Params(), bool* success = nullptr);
|
std::string execute(const char* command, const std::string& body, WebIO::Params headers = WebIO::Params(), bool* success = nullptr);
|
||||||
|
|
||||||
bool listElements(const std::string& directory, std::vector<std::string> &list, bool files);
|
bool listElements(const std::string& directory, std::vector<std::string>& list, bool files);
|
||||||
|
|
||||||
void openSession(const std::string& useragent);
|
void openSession(const std::string& useragent);
|
||||||
void closeSession();
|
void closeSession();
|
||||||
@ -112,6 +112,6 @@ namespace Utils
|
|||||||
bool openConnection();
|
bool openConnection();
|
||||||
void closeConnection();
|
void closeConnection();
|
||||||
|
|
||||||
void formatPath(std::string &path, bool win); /* if (win == true): / -> \\ */
|
void formatPath(std::string& path, bool win); /* if (win == true): / -> \\ */
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user