Skip to content

Commit

Permalink
Update to v1.129
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiYueCommentary committed Oct 6, 2022
1 parent 82d53e4 commit 5da94f5
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Installer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

[assembly: Guid("3155949e-f58b-43a9-b305-4f7a730a6e84")]

[assembly: AssemblyVersion("1.128")]
[assembly: AssemblyFileVersion("1.128")]
[assembly: AssemblyVersion("1.129")]
[assembly: AssemblyFileVersion("1.129")]
Binary file modified Installer/Resources/zipFile.zip
Binary file not shown.
1 change: 0 additions & 1 deletion MultiLang/SimplifiedChinese.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
static constexpr MultiLang::string illegal_graphics3d_mode = "非法3D显示模式,显示模式为0到7之间的值。";
static constexpr MultiLang::string unable_close_gxgraphics_instance = "无法关闭gxGraphics实例";
static constexpr MultiLang::wstring runtime_error = L"运行时错误!";
static constexpr MultiLang::wstring opencc_configure_not_found = L"找不到OpenCC设置!";
static constexpr MultiLang::string illegal_frame_count = "非法帧数";
static constexpr MultiLang::string illegal_first_frame = "非法第一帧";
static constexpr MultiLang::string not_enough_frames_bitmap = "位图帧数不足";
Expand Down
1 change: 0 additions & 1 deletion MultiLang/TraditionalChinese.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
static constexpr MultiLang::string illegal_graphics3d_mode = "非法3D顯示模式,顯示模式為0到7之間的值。";
static constexpr MultiLang::string unable_close_gxgraphics_instance = "無法關閉gxGraphics實例";
static constexpr MultiLang::wstring runtime_error = L"運行時錯誤!";
static constexpr MultiLang::wstring opencc_configure_not_found = L"找不到OpenCC設置!";
static constexpr MultiLang::string illegal_frame_count = "非法幀數";
static constexpr MultiLang::string illegal_first_frame = "非法第一幀";
static constexpr MultiLang::string not_enough_frames_bitmap = "位圖幀數不足";
Expand Down
69 changes: 66 additions & 3 deletions bbruntime/bbfilesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,60 @@ void bbDeleteDir(BBStr* d) {
delete d;
}

inline bool IsDirectory(const char* pDir)
{
char szCurPath[500];
ZeroMemory(szCurPath, 500);
sprintf_s(szCurPath, 500, "%s//*", pDir);
WIN32_FIND_DATAA FindFileData;
ZeroMemory(&FindFileData, sizeof(WIN32_FIND_DATAA));

HANDLE hFile = FindFirstFileA(szCurPath, &FindFileData);

if (hFile == INVALID_HANDLE_VALUE)
{
FindClose(hFile);
return false;
}
else
{
FindClose(hFile);
return true;
}
}

void bbDeleteFolder(BBStr* d) {
char szCurPath[MAX_PATH];
_snprintf(szCurPath, MAX_PATH, "%s//*.*", d->c_str());
WIN32_FIND_DATAA FindFileData;
ZeroMemory(&FindFileData, sizeof(WIN32_FIND_DATAA));
HANDLE hFile = FindFirstFileA(szCurPath, &FindFileData);
bool IsFinded = true;
while (IsFinded)
{
IsFinded = FindNextFile(hFile, &FindFileData);
if (strcmp(FindFileData.cFileName, ".") && strcmp(FindFileData.cFileName, ".."))
{
std::string strFileName = "";
strFileName = strFileName + d->c_str() + "//"s + FindFileData.cFileName;
std::string strTemp;
strTemp = strFileName;
if (IsDirectory(strFileName.c_str()))
{
bbDeleteFolder(new BBStr(strTemp));
}
else
{
DeleteFile(strTemp.c_str());
}
}
}
FindClose(hFile);

RemoveDirectory(d->c_str());
delete d;
}

int bbFileType(BBStr* f) {
std::string t = *f; delete f;
int n = gx_filesys->getFileType(t);
Expand All @@ -128,8 +182,9 @@ int bbFileSize(BBStr* f) {

BBStr* bbFileExtension(BBStr* f) {
std::string t = *f; delete f;
if(t.find_last_of(".") != std::string::npos)
if (t.find_last_of(".") != std::string::npos) {
return new BBStr(t.substr(t.find_last_of(".") + 1));
}
return new BBStr("");
}

Expand All @@ -149,7 +204,7 @@ void bbDeleteFile(BBStr* f) {
delete f;
}

void UnZip(BBStr* src, BBStr* dst, BBStr* password) {
void bbUnzip(BBStr* src, BBStr* dst, BBStr* password) {
HZIP hz = OpenZip(src->c_str(), password->c_str());
SetUnzipBaseDir(hz, dst->c_str());
ZIPENTRY ze;
Expand All @@ -164,6 +219,12 @@ void UnZip(BBStr* src, BBStr* dst, BBStr* password) {
delete src, dst, password;
}

BBStr* bbAbsolutePath(BBStr* path) {
std::string file = path->c_str();
delete path;
return new BBStr(std::filesystem::absolute(file).generic_string());
}

bool filesystem_create() {
if(gx_filesys = gx_runtime->openFileSystem(0)) {
return true;
Expand Down Expand Up @@ -192,13 +253,15 @@ void filesystem_link(void(*rtSym)(const char*, void*)) {
rtSym("ChangeDir$dir", bbChangeDir);
rtSym("CreateDir$dir", bbCreateDir);
rtSym("DeleteDir$dir", bbDeleteDir);
rtSym("DeleteFolder$dir", bbDeleteFolder);

rtSym("%FileSize$file", bbFileSize);
rtSym("%FileType$file", bbFileType);
rtSym("$FileExtension$file", bbFileExtension);
rtSym("CopyFile$file$to", bbCopyFile);
rtSym("DeleteFile$file", bbDeleteFile);
rtSym("CreateFile$filename", bbCreateFile);
rtSym("$AbsolutePath$path", bbAbsolutePath);

rtSym("UnZip$src$dst$password=\"\"", UnZip);
rtSym("Unzip$src$dst$password=\"\"", bbUnzip);
}
6 changes: 3 additions & 3 deletions bbruntime/bbsockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ void bbTCPTimeouts(int rt, int at) {
accept_timeout = at;
}

std::string exec(const char* cmd) {
inline std::string exec(const char* cmd) {
FILE* pipe = _popen(cmd, "r");
if (!pipe) return "";
char buffer[128];
Expand All @@ -478,7 +478,7 @@ std::string exec(const char* cmd) {
return result;
}

std::string clearTabLeft(std::string src) {
inline std::string clearTabLeft(std::string src) {
int pos = 0;
std::string result = src;
for (;;) {
Expand Down Expand Up @@ -508,7 +508,7 @@ BBStr* bbParseDomainTXT(BBStr* txt, BBStr* name) {
}

BBStr* bbGetDomainTXT(BBStr* domain) {
std::string result = exec(std::format("nslookup -qt=TXT {0}", domain->c_str()).data());
std::string result = exec(("nslookup -qt=TXT {0}"s + domain->c_str()).data());
result = clearTabLeft(result);
if (result[0] == '\"') result = result.substr(1);
if (result[result.length() - 2] == '\"') result = result.substr(0, result.length() - 2);
Expand Down
4 changes: 2 additions & 2 deletions config/config.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef CONFIG_H
#define CONFIG_H

#define BASE_VER 1128
#define BASE_VER 1129
#define PRO_F 0x010000
#define VERSION (BASE_VER|PRO_F)
#define CHINESE_SIMP
#define CHINESE_TRAD

#endif

0 comments on commit 5da94f5

Please sign in to comment.