Наследование: Jurassic.Library.ObjectInstance
Пример #1
0
 public void Write(ByteArrayInstance array)
 {
     using (BinaryWriter writer = new BinaryWriter(_data))
     {
         writer.Write(array.GetBytes());
     }
 }
Пример #2
0
 public ByteArrayInstance Read(int count)
 {
     using (BinaryReader reader = new BinaryReader(_data))
     {
         ByteArrayInstance array = new ByteArrayInstance(Engine, reader.ReadBytes(count));
         return array;
     }
 }
Пример #3
0
 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);
 }
Пример #4
0
 public void Write(ByteArrayInstance array)
 {
     _stream.Write(array.GetBytes(), 0, array.GetSize());
 }
Пример #5
0
        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());
            }
        }
Пример #6
0
 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;
 }