Пример #1
0
 public ScriptTag(byte[] headerBytes, byte[] bodyBytes) : base(headerBytes)
 {
     if (Header.Filtered == 0)
     {
         MemoryStream memoryStream = new MemoryStream(bodyBytes);
         Name  = ScriptData.ReadData(memoryStream);
         Value = ScriptData.ReadData(memoryStream);
     }
     else
     {
         throw new UnsupportedFormat("Script tag with filter is not supported");
     }
 }
Пример #2
0
                    public StrictArray(Stream stream) : this()
                    {
                        byte[] lengthBytes = new byte[4];
                        stream.Read(lengthBytes, 0, lengthBytes.Length);
                        uint length = Util.ToUintBe(lengthBytes, 0, Util.UintType.Uint32);

                        for (int i = 0; i < length; i++)
                        {
                            ScriptData scriptData = ScriptData.ReadData(stream);
                            if (scriptData == null)
                            {
                                break;
                            }
                            Items.Add(scriptData);
                        }
                    }
Пример #3
0
                    public Object(Stream stream) : this()
                    {
                        while (true)
                        {
                            byte[] nameLengthBytes = new byte[2];
                            stream.Read(nameLengthBytes, 0, nameLengthBytes.Length);
                            uint   nameLength = Util.ToUintBe(nameLengthBytes, 0, Util.UintType.Uint16);
                            byte[] nameBytes  = new byte[nameLength];
                            stream.Read(nameBytes, 0, nameBytes.Length);
                            string name = Encoding.ASCII.GetString(nameBytes);

                            ScriptData scriptData = ScriptData.ReadData(stream);
                            if (scriptData == null || scriptData.ScriptDataType == ScriptDataType.ObjectEndMark)
                            {
                                break;
                            }
                            Items.Add(name, scriptData);
                        }
                    }