| 260 | |
| 261 | @staticmethod |
| 262 | def LoadCachePicture(filePath): |
| 263 | try: |
| 264 | c = CTime() |
| 265 | formatList = [".jpg", ".png", ".gif", ".webp", ".bmp", ".apng"] |
| 266 | for mat in formatList: |
| 267 | if filePath[-4:] in formatList: |
| 268 | path = filePath |
| 269 | elif filePath[-5:] in formatList: |
| 270 | path = filePath |
| 271 | else: |
| 272 | path = filePath + mat |
| 273 | if not os.path.isfile(path): |
| 274 | continue |
| 275 | |
| 276 | with open(path, "rb") as f: |
| 277 | data = f.read() |
| 278 | c.Refresh("LoadCache", path) |
| 279 | if len(data) < 20: |
| 280 | Log.Debug(f"load_fail_picture, {path}") |
| 281 | continue |
| 282 | return data |
| 283 | |
| 284 | except Exception as es: |
| 285 | Log.Error(es) |
| 286 | return None |
| 287 | |
| 288 | @staticmethod |
| 289 | def SavePicture(data, path, format): |