Skip to content

Commit

Permalink
Add checking and logs of bmsonFile
Browse files Browse the repository at this point in the history
  • Loading branch information
Shimi9999 committed Sep 27, 2021
1 parent 0e6313e commit 6bae76b
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ func (w *BmsCheckerWindow) updateLogText() {
case *checkbms.BmsFile:
bmsFile := w.logSource.(*checkbms.BmsFile)
updatedLog = bmsFileLog(bmsFile, w.setting.Language)
case *checkbms.BmsonFile:
bmsonFile := w.logSource.(*checkbms.BmsonFile)
updatedLog = bmsonFileLog(bmsonFile, w.setting.Language)
case *checkbms.DiffBmsDirResult:
result := w.logSource.(*checkbms.DiffBmsDirResult)
updatedLog = diffBmsDirResultLog(result, w.setting.Language)
Expand All @@ -345,15 +348,25 @@ func checkBmsOrDirectory(path, lang string, diff bool) (logSource interface{}, _
checkbms.CheckBmsDirectory(bmsDir, diff)
return bmsDir, nil
} else if checkbms.IsBmsFile(path) {
bmsFile, err := checkbms.ReadBmsFile(path)
bmsFileBase, err := checkbms.ReadBmsFileBase(path)
if err != nil {
return nil, err
}
if err := bmsFile.ScanBmsFile(); err != nil {
return nil, err
if checkbms.IsBmsonFile(path) {
bmsonFile := checkbms.NewBmsonFile(bmsFileBase)
if err = bmsonFile.ScanBmsonFile(); err != nil {
return nil, err
}
checkbms.CheckBmsonFile(bmsonFile)
return bmsonFile, nil
} else {
bmsFile := checkbms.NewBmsFile(bmsFileBase)
if err := bmsFile.ScanBmsFile(); err != nil {
return nil, err
}
checkbms.CheckBmsFile(bmsFile)
return bmsFile, nil
}
checkbms.CheckBmsFile(bmsFile)
return bmsFile, nil
}
notBmsMessage := multiLangString{
en: "ERROR: Not bms file/folder",
Expand All @@ -369,6 +382,11 @@ func bmsDirectoryLog(bmsDir *checkbms.Directory, lang string) (log string) {
logs = append(logs, bmsFile.LogStringWithLang(true, lang))
}
}
for _, bmsonFile := range bmsDir.BmsonFiles {
if len(bmsonFile.Logs) > 0 {
logs = append(logs, bmsonFile.LogStringWithLang(true, lang))
}
}
if len(bmsDir.Logs) > 0 {
logs = append(logs, bmsDir.LogStringWithLang(true, lang))
}
Expand All @@ -394,6 +412,16 @@ func bmsFileLog(bmsFile *checkbms.BmsFile, lang string) (log string) {
return log
}

func bmsonFileLog(bmsonFile *checkbms.BmsonFile, lang string) (log string) {
if len(bmsonFile.Logs) > 0 {
log = bmsonFile.LogStringWithLang(true, lang)
}
if log == "" {
log = "All OK"
}
return log
}

func diffBmsDirResultLog(result *checkbms.DiffBmsDirResult, lang string) (log string) {
log = result.LogStringWithLang(lang)
if log == "" {
Expand Down

0 comments on commit 6bae76b

Please sign in to comment.