CC_SDK/Server/AsideFile/AsideFile.hpp
2025-04-25 19:37:53 +08:00

26 lines
757 B
C++

#ifndef ASIDE_FILE_HPP
#define ASIDE_FILE_HPP
#include "AsideFileClass.h"
#include "../Server.h"
class AsideFile {
public:
static void ReadData(CTL::Request &request, CTL::Response &response) {
CCVar Json = request.GetJson();
CTL::String DirPath = Json.get("Path");
DirPath = CCFile::NormalizePath(RootPath + DirPath);
CCVar Data = AsideFileClass::GetData(DirPath);
CTL::JSONObject JsonData;
JsonData.put("Buffer",Data);
response.Write(JsonData.to_String(),200);
}
static void ReadDataZip(CTL::Request &request, CTL::Response &response) {
response.ResourceDownload("E:/Download/BaiduWP.exe",1024);
}
private:
inline static CTL::String RootPath = "../static/";
};
#endif