Explorar o código

Restore hxd.fs.FileEntry.getSign (#1028)

Pavel Alexandrov %!s(int64=3) %!d(string=hai) anos
pai
achega
6a4ac85622
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      hxd/fs/FileEntry.hx

+ 8 - 0
hxd/fs/FileEntry.hx

@@ -36,6 +36,14 @@ class FileEntry {
 			throw new haxe.io.Eof();
 	}
 
+	/**
+		Read first 4 bytes of the file.
+	**/
+	public function getSign() : Int {
+		var bytes = fetchBytes(0, 4);
+		return bytes.get(0) | (bytes.get(1) << 8) | (bytes.get(2) << 16) | (bytes.get(3) << 24);
+	}
+
 	public function getText() return getBytes().toString();
 	public function open() return @:privateAccess new FileInput(this);