1
0
mirror of https://github.com/fumiama/ReiBot.git synced 2026-06-18 09:40:33 +08:00
This commit is contained in:
源文雨
2022-06-10 19:58:48 +08:00
parent e3c0d5efd6
commit 72390b4c09
14 changed files with 845 additions and 20 deletions

20
lazy.go Normal file
View File

@@ -0,0 +1,20 @@
package rei
import (
"errors"
"strings"
"unicode"
"github.com/FloatTech/zbputils/file"
)
// 下载并获取本 engine 文件夹下的懒加载数据
func (e *Engine) GetLazyData(filename string, isDataMustEqual bool) ([]byte, error) {
if e.datafolder == "" {
return nil, errors.New("datafolder is empty")
}
if !strings.HasSuffix(e.datafolder, "/") || !strings.HasPrefix(e.datafolder, "data/") || !unicode.IsUpper(rune(e.datafolder[5])) {
return nil, errors.New("invalid datafolder")
}
return file.GetLazyData(e.datafolder+filename, isDataMustEqual)
}