Browse Source

[cs] missing I/O files

Caue Waneck 13 năm trước cách đây
mục cha
commit
c86452899b

+ 20 - 0
std/cs/_std/system/BitConverter.hx

@@ -0,0 +1,20 @@
+package system;
+import cs.NativeArray;
+import cs.NativeArray;
+import cs.StdTypes;
+import haxe.Int64;
+
+@:native('System.BitConverter') extern class BitConverter 
+{
+	static var IsLittleEndian(default, null):Bool;
+	static function DoubleToInt64Bits(v:Float):Int64;
+	static function Int64BitsToDouble(v:Int64):Float;
+	static function GetBytes(d:Dynamic):NativeArray<UInt8>;
+	static function ToBoolean(b:NativeArray<UInt8>, startIndex:Int):Bool;
+	static function ToChar(b:NativeArray<UInt8>, startIndex:Int):Char16;
+	static function ToDouble(b:NativeArray<UInt8>, startIndex:Int):Float;
+	static function ToInt16(b:NativeArray<UInt8>, startIndex:Int):Int16;
+	static function ToInt32(b:NativeArray<UInt8>, startIndex:Int):Int;
+	static function ToInt64(b:NativeArray<UInt8>, startIndex:Int):Int64;
+	static function ToSingle(b:NativeArray<UInt8>, startIndex:Int):Single;
+}

+ 11 - 0
std/cs/_std/system/io/MemoryStream.hx

@@ -0,0 +1,11 @@
+package system.io;
+import cs.NativeArray;
+import cs.StdTypes;
+import haxe.Int64;
+import haxe.io.BytesData;
+
+@:native('System.IO.MemoryStream') extern class MemoryStream extends Stream 
+{
+	function new():Void;
+	function GetBuffer():NativeArray<UInt8>;
+}

+ 27 - 0
std/cs/_std/system/io/Stream.hx

@@ -0,0 +1,27 @@
+package system.io;
+import cs.StdTypes;
+import haxe.Int64;
+import haxe.io.BytesData;
+
+@:native('System.IO.Stream') extern class Stream 
+{
+	var CanRead(default, null):Bool;
+	var CanSeek(default, null):Bool;
+	var CanTimeout(default, null):Bool;
+	var CanWrite(default, null):Bool;
+	var Length(default, null):Bool;
+	var Position(default, null):Bool;
+	var ReadTimeout:Bool;
+	var WriteTimeout:Bool;
+	
+	function Close():Void;
+	function CopyTo(dest:Stream):Void;
+	function Dispose():Void;
+	function Flush():Void;
+	function Read(buf:BytesData, offset:Int, count:Int):Int;
+	function ReadByte():Int;
+	//function Seek(offset:Int64, 
+	function SetLength(value:Int64):Void;
+	function Write(buf:BytesData, offset:Int, count:Int):Void;
+	function WriteByte(value:UInt8):Void;
+}

+ 12 - 0
std/cs/_std/system/text/Encoding.hx

@@ -0,0 +1,12 @@
+package system.text;
+import cs.NativeArray;
+import cs.StdTypes;
+
+@:native("System.Text.Encoding") extern class Encoding
+{
+	static var UTF8(default, null):Encoding;
+	
+	function GetString(b:NativeArray<UInt8>, index:Int, count:Int):String;
+	function GetBytes(s:String):NativeArray<UInt8>;
+	
+}