-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaseHeader.py
executable file
·38 lines (28 loc) · 1.17 KB
/
BaseHeader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import VMSBackupHelper
import VMSBackupRAMCache
class BaseHeader :
def __init__(self) -> None :
self.kCache = {}
self.kBuffer = bytearray()
#end
def LoadHeaderFromFile(self, kFile : VMSBackupRAMCache.VMSBackupRAMCache) -> None :
self.kBuffer += kFile.read(self.kAddressData.length())
#end
def ExtendHeaderFromFile(self, kFile : VMSBackupRAMCache.VMSBackupRAMCache) -> None :
if len(self.kBuffer) < self.kAddressData.length() :
self.kBuffer += kFile.read(self.kAddressData.length() - len(self.kBuffer))
#end
#end
def LoadHeaderFromBuffer(self, kBlock : bytes) -> None :
assert(len(kBlock) >= self.kAddressData.length())
self.kBuffer += kBlock[0:self.kAddressData.length()]
#end
def ExtendHeaderFromBuffer(self, kBlock : bytes) -> None :
if len(self.kBuffer) < self.kAddressData.length() :
self.kBuffer += kBlock[len(self.kBuffer):self.kAddressData.length()]
#end
#end
kAddressData : VMSBackupHelper.addr = None
kBuffer : bytearray = None
kCache : dict = None
#end