Beispiel #1
0
        public FTContext(byte[] data)
        {
            MemoryStream stream = new MemoryStream(data);
            BinaryReader reader = new BinaryReader(stream);

            uint _headerLen = reader.ReadUInt32();

            _version  = reader.ReadUInt32();
            _fileSize = reader.ReadUInt64();
            _type     = (FTType)reader.ReadUInt32();
            _filename = Encoding.Unicode.GetString(reader.ReadBytes(520)).Replace("\0", String.Empty).Trim();
            //_unknown1 = Convert.FromBase64String (Encoding.Unicode.GetString(reader.ReadBytes(30)));
            //_unknown2 = (uint)BitUtility.ToInt32 (reader.ReadBytes(4), 0, false);

            if (data.Length > _headerLen)
            {
                // Picture previw
                _preview = new byte[data.Length - _headerLen];
                Array.Copy(data, _headerLen, _preview, 0, _preview.Length);
            }

            reader.Close();
            stream.Close();
        }
Beispiel #2
0
 public FTObject(FTType type, object value)
 {
     Type = type;
     Value = value;
 }
Beispiel #3
0
 private void CheckType3(FTType type1, FTType type2, FTType type3)
 {
     Pop3();
     if (a3.Type != type3 || a2.Type != type2 || a1.Type != type1)
         throw new FTWrongTypeException(string.Format("Wrong Argument Types for Command: '{0}'\r\nExpecting {1}, {2}, {3}", word, type1, type2, type3));
 }
Beispiel #4
0
 private void CheckType2(FTType type1, FTType type2)
 {
     Pop2();
     if (a1.Type != type1 || a2.Type != type2)
         throw new FTWrongTypeException(string.Format("Wrong Argument Types for Command: '{0}'\r\nExpecting {1}, {2}", word, type1, type2));
 }
Beispiel #5
0
 private void CheckType1(FTType type)
 {
     Pop1();
     if (a1.Type != type)
         throw new FTWrongTypeException(string.Format("Wrong Argument Types for Command: '{0}'\r\nExpecting {1}", word, type));
 }
Beispiel #6
0
        public FTContext(byte[] data)
        {
            MemoryStream stream = new MemoryStream(data);
            BinaryReader reader = new BinaryReader(stream);

            uint _headerLen = reader.ReadUInt32();
            _version = reader.ReadUInt32();
            _fileSize = reader.ReadUInt64();
            _type = (FTType)reader.ReadUInt32();
            _filename = Encoding.Unicode.GetString(reader.ReadBytes(520)).Replace("\0", String.Empty).Trim();
            //_unknown1 = Convert.FromBase64String (Encoding.Unicode.GetString(reader.ReadBytes(30)));
            //_unknown2 = (uint)BitUtility.ToInt32 (reader.ReadBytes(4), 0, false);

            if (data.Length > _headerLen)
            {
                // Picture previw
                _preview = new byte[data.Length - _headerLen];
                Array.Copy(data, _headerLen, _preview, 0, _preview.Length);
            }

            reader.Close();
            stream.Close();
        }