//object 시작과 끝
        // readNewObject에서만 사용
        private void readClassData(ClassDataDesc cdd)
        {
            // ClassDetails cd;
            print("<<classdata>>");
            increaseIndent();

            if (cdd != null)
            {
                for (int classIndex = cdd.GetClassCount() - 1; classIndex >= 0; --classIndex)
                {
                    var cd = cdd.GetClassDetails(classIndex);

                    print(cd.GetClassName());
                    increaseIndent();

                    if (cd.IsSC_SERIALIZABLE())
                    {
                        print("values - final");
                        increaseIndent();

                        foreach (ClassField cf in cd.GetFields())
                        {
                            readClassDataField(cf);
                        }

                        decreaseIndent();
                    }
                    if ((cd.IsSC_SERIALIZABLE() && cd.IsSC_WRITE_METHOD()) ||
                        (cd.IsSC_EXTERNALIZABLE() && cd.IsSC_BLOCKDATA()))
                    {
                        print("objectAnnotation");
                        increaseIndent();
                        while (_bb.Peek() != 0x78)
                        {
                            readContentElement();
                        }

                        _bb.Skip(1);
                        print("TC_ENDBLOCKDATA - 0x78");
                    }
                    if ((cd.IsSC_EXTERNALIZABLE()) && (!cd.IsSC_BLOCKDATA()))
                    {
                        print("externalContents");
                        increaseIndent();
                        print("Unable to parse externalContents as the format is specific to the implementation class.");
                        throw new Exception("Error: Unable to parse externalContents element.");
                    }

                    decreaseIndent();
                }
            }
            else
            {
                print("N/A");
            }

            decreaseIndent();
        }
Beispiel #2
0
 public void AddSuperClassDesc(ClassDataDesc scdd)
 {
     if (scdd != null)
     {
         for (int i = 0; i < scdd.GetClassCount(); i++)
         {
             this._classDetails.Add(scdd.GetClassDetails(i));
         }
     }
 }
Beispiel #3
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);
        }