1
0
mirror of https://github.com/FloatTech/zbpdata.git synced 2025-04-22 04:02:10 +09:00

Merge branch 'FloatTech:main' into main

This commit is contained in:
莫思潋 2022-06-17 18:47:52 +08:00 committed by GitHub
commit 2c787501f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 22 deletions

BIN
Fortune/ASoul.zip Normal file

Binary file not shown.

BIN
MockingBird/wj.wav Normal file

Binary file not shown.

40
main.go
View File

@ -10,11 +10,9 @@ import (
"io/fs" "io/fs"
"os" "os"
"strings" "strings"
"sync"
"unicode" "unicode"
"unsafe" "unsafe"
"github.com/FloatTech/zbputils/process"
"github.com/fumiama/go-registry" "github.com/fumiama/go-registry"
"github.com/wdvxdr1123/ZeroBot/utils/helper" "github.com/wdvxdr1123/ZeroBot/utils/helper"
) )
@ -41,31 +39,29 @@ func main() {
*(*unsafe.Pointer)(unsafe.Pointer(&md5s[i])) = unsafe.Pointer(&buf) *(*unsafe.Pointer)(unsafe.Pointer(&md5s[i])) = unsafe.Pointer(&buf)
*(*uintptr)(unsafe.Add(unsafe.Pointer(&md5s[i]), unsafe.Sizeof(uintptr(0)))) = uintptr(16) *(*uintptr)(unsafe.Add(unsafe.Pointer(&md5s[i]), unsafe.Sizeof(uintptr(0)))) = uintptr(16)
} }
r := registry.NewRegedit("reilia.westeurope.cloudapp.azure.com:32664", "fumiama", os.Getenv("REILIA_SPS")) r := registry.NewRegedit("reilia.fumiama.top:32664", "fumiama", os.Getenv("REILIA_SPS"))
err := r.Connect() err := r.Connect()
if err != nil { if err != nil {
panic(err) panic(err)
} }
defer r.Close()
var wg sync.WaitGroup
wg.Add(len(files))
for i, fn := range files { for i, fn := range files {
go func(i int, fn string) { for c := 0; c < 5; c++ {
defer wg.Done() err = r.Set("data/"+fn, md5s[i])
for c := 0; c < 5; c++ { fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i])))
err = r.Set("data/"+fn, md5s[i]) if err == nil {
fmt.Println("set", "data/"+fn, "=", hex.EncodeToString(helper.StringToBytes(md5s[i]))) break
if err == nil {
break
}
if c >= 4 {
panic("ERROR:" + err.Error() + "max retry times exceeded")
} else {
fmt.Println("ERROR:", err, ", retry times:", c)
}
process.SleepAbout1sTo2s()
} }
}(i, fn) if c >= 4 {
panic("ERROR:" + err.Error() + "max retry times exceeded")
} else {
fmt.Println("ERROR:", err, ", retry times:", c)
}
_ = r.Close()
err = r.Connect()
if err != nil {
panic(err)
}
}
} }
wg.Wait() _ = r.Close()
} }