1
0
mirror of https://github.com/Escartem/AnimeWwise.git synced 2026-06-04 23:40:25 +08:00

improve error handling

This commit is contained in:
Escartem
2024-12-03 18:25:01 +01:00
parent 75821caf62
commit 4faf25df5a
4 changed files with 89 additions and 62 deletions

View File

@@ -8,9 +8,11 @@ class FileReader:
File reader for files, not much too say
"""
def __init__(self, file, endianness:str):
def __init__(self, file, endianness:str, name:str=None):
self.stream = file
self.endianness = endianness
if name:
self.name = name
def _read(self, mode:str, bufferLength:int, endianness:str=None) -> bytes:
# endianness override
@@ -76,3 +78,8 @@ class FileReader:
def GetRemainingLength(self) -> int:
return self.GetStreamLength() - self.GetBufferPos()
def GetName(self) -> str:
if self.name:
return self.name
return ""