コード例 #1
0
        private void readClassDataField(ClassField cf)
        {
            print(cf.GetName());
            increaseIndent();
            var value = readFieldValue(cf.GetTypeCode());

            cf.SetValue(value);

            decreaseIndent();
        }
コード例 #2
0
        // TODO
        //  return cdd or cd ??
        private object readNewArray()
        {
            var b1 = _bb.GetByte();

            print("TC_ARRAY - 0x" + string.Format("{0:X2}", b1));
            if (b1 != 0x75)
            {
                throw new Exception("Error: Illegal value for TC_ARRAY (should be 0x75)");
            }

            increaseIndent();

            ClassDataDesc cdd = readClassDesc();

            if (cdd.GetClassCount() != 1)
            {
                throw new Exception("Error: Array class description made up of more than one class.");
            }

            ClassDetails cd = cdd.GetClassDetails(0);

            if (cd.ClassName[0] != '[')
            {
                throw new Exception("Error: Array class name does not begin with '['.");
            }

            var handle = newHandle();

            _globalObjects[handle] = cdd;

            var size = _bb.GetInt32BE();

            print("Values");
            increaseIndent();

            for (int i = 0; i < size; i++)
            {
                print("Index " + i + ":");
                increaseIndent();

                var cf    = new ClassField((byte)cd.ClassName[1]);
                var value = readFieldValue(cf.GetTypeCode());
                cf.SetValue(value);
                cd.AddField(cf);
                decreaseIndent();
            }

            decreaseIndent();

            decreaseIndent();

            return(cd);
        }