46 lines
935 B
Plaintext
46 lines
935 B
Plaintext
|
|
/*
|
||
|
|
文件名:BlobExClass.nut
|
||
|
|
路径:BaseClass/BaseTool/BlobExClass.nut
|
||
|
|
创建日期:2024-05-07 17:34
|
||
|
|
文件用途:拓展的Blob类
|
||
|
|
*/
|
||
|
|
class BlobEx extends blob {
|
||
|
|
|
||
|
|
constructor(BaseBlob) {
|
||
|
|
base.constructor(BaseBlob.len());
|
||
|
|
writeblob(BaseBlob);
|
||
|
|
}
|
||
|
|
|
||
|
|
function writeblob(B) {
|
||
|
|
base.writeblob(B);
|
||
|
|
seek(0);
|
||
|
|
}
|
||
|
|
|
||
|
|
function GetUShort() {
|
||
|
|
return readn('s');
|
||
|
|
}
|
||
|
|
|
||
|
|
function GetShort() {
|
||
|
|
return readn('w');
|
||
|
|
}
|
||
|
|
|
||
|
|
function GetInt() {
|
||
|
|
local CurTPos = tell();
|
||
|
|
local Ret = charPtrToInt([this[CurTPos], this[CurTPos + 1], this[CurTPos + 2], this[CurTPos + 3]]);
|
||
|
|
seek(4, 'c');
|
||
|
|
return Ret;
|
||
|
|
}
|
||
|
|
|
||
|
|
function Get256() {
|
||
|
|
local Buf = readn('c');
|
||
|
|
return (256.0 + Buf.tofloat()) % 256.0;
|
||
|
|
}
|
||
|
|
|
||
|
|
function GetFloat() {
|
||
|
|
return readn('f');
|
||
|
|
}
|
||
|
|
|
||
|
|
function GetString(count) {
|
||
|
|
return stream_myreadstring(count);
|
||
|
|
}
|
||
|
|
}
|