public void Write(ByteArrayInstance array) { using (BinaryWriter writer = new BinaryWriter(_data)) { writer.Write(array.GetBytes()); } }
public ByteArrayInstance Read(int count) { using (BinaryReader reader = new BinaryReader(_data)) { ByteArrayInstance array = new ByteArrayInstance(Engine, reader.ReadBytes(count)); return array; } }
public ByteArrayInstance Concat(ByteArrayInstance array) { int start = _bytes.Length; byte[] bytes = new byte[array._bytes.Length + start]; Buffer.BlockCopy(_bytes, 0, bytes, 0, start); Buffer.BlockCopy(array._bytes, 0, bytes, start, array._bytes.Length); return new ByteArrayInstance(Engine, bytes); }
public void Write(ByteArrayInstance array) { _stream.Write(array.GetBytes(), 0, array.GetSize()); }
static string HashByteArray(ByteArrayInstance array, [DefaultParameterValue(false)] bool sha = false) { HashAlgorithm hash; if (sha) hash = SHA1.Create(); else hash = MD5.Create(); using (hash) { return GetHash(hash, array.GetBytes()); } }
static string CreateStringFromByteArray(ByteArrayInstance array) { byte[] data = array.GetBytes(); string result = ""; for (var i = 0; i < data.Length; ++i) result += (char)data[i]; return result; }