1111
This commit is contained in:
@@ -56,4 +56,66 @@ class BlobEx extends blob {
|
||||
return stream_myreadstring(count);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class blobex extends blob {
|
||||
|
||||
//-----------------Metamethods--------------------//
|
||||
function _typeof() {
|
||||
return "blobex";
|
||||
}
|
||||
//-----------------Metamethods--------------------//
|
||||
|
||||
constructor(arg) {
|
||||
//通过blob构造
|
||||
if (typeof arg == "blob") {
|
||||
base.constructor(arg.len());
|
||||
writeblob(arg);
|
||||
}
|
||||
//直接构造
|
||||
else {
|
||||
base.constructor(arg);
|
||||
}
|
||||
}
|
||||
|
||||
function writeblob(B) {
|
||||
base.writeblob(B);
|
||||
seek(0);
|
||||
}
|
||||
|
||||
function GetUShort() {
|
||||
return readn('w');
|
||||
}
|
||||
|
||||
function GetShort() {
|
||||
return readn('s');
|
||||
}
|
||||
|
||||
function charPtrToInt(arr) {
|
||||
local value = ((arr[0]) << 0) |
|
||||
((arr[1]) << 8) |
|
||||
((arr[2]) << 16) |
|
||||
((arr[3]) << 24);
|
||||
return value;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user