Пример #1
0
        /**
         * Instantiates a new psd descriptor.
         *
         * @param stream the stream
         * @throws IOException Signals that an I/O exception has occurred.
         */
        public PsdDescriptor(BinaryReverseReader stream)
        {
            int    unicstrlength = stream.ReadInt32() * 2;
            string unicstr       = Encoding.Unicode.GetString(stream.ReadBytes(unicstrlength));
            int    classlength   = stream.ReadInt32();

            if (classlength != 0)
            {
                classId = Encoding.Default.GetString(stream.ReadBytes(classlength));
            }
            else
            {
                classId = Encoding.Default.GetString(stream.ReadBytes(4));
            }
            // Unicode string: name from classID
            // int nameLen = stream.ReadInt32() * 2;
            //stream.ReadBytes(nameLen);

            //classId = stream.ReadString();
            int itemsCount = stream.ReadInt32();

            for (int i = 0; i < itemsCount; i++)
            {
                int size = stream.ReadInt32();
                if (size == 0)
                {
                    size = 4;
                }

                String key = Encoding.Default.GetString(stream.ReadBytes(size));
                objects.Add(key, PsdObjectFactory.loadPsdObject(stream));
                //objects.Add(key, new PsdObject());
            }
        }
Пример #2
0
        /**
         * Instantiates a new psd list.
         *
         * @param stream the stream
         * @throws IOException Signals that an I/O exception has occurred.
         */
        public PsdList(BinaryReverseReader stream)
        {
            int itemsCount = stream.ReadInt32();

            for (int i = 0; i < itemsCount; i++)
            {
                objects.Add(PsdObjectFactory.loadPsdObject(stream));
            }
        }