Ejemplo n.º 1
0
        private ABCFile.Multiname readMultiname()
        {
            var r = new ABCFile.Multiname();

            r.kind = (ASType)readU8();
            switch (r.kind)
            {
            case ASType.QName:
            case ASType.QNameA:
                r.QName.ns   = readU30();
                r.QName.name = readU30();
                break;

            case ASType.RTQName:
            case ASType.RTQNameA:
                r.RTQName.name = readU30();
                break;

            case ASType.RTQNameL:
            case ASType.RTQNameLA:
                break;

            case ASType.Multiname:
            case ASType.MultinameA:
                r.MultiName.name  = readU30();
                r.MultiName.nsSet = readU30();
                break;

            case ASType.MultinameL:
            case ASType.MultinameLA:
                r.MultinameL.nsSet = readU30();
                break;

            case ASType.TypeName:
                r.TypeName.name       = readU30();
                r.TypeName.parameters = new uint[readU30()];
                for (int i = 0; i < r.TypeName.parameters.Length; i++)
                {
                    r.TypeName.parameters[i] = readU30();
                }
                break;

            default:
                throw new Exception("Unknown Multiname kind");
            }
            return(r);
        }
Ejemplo n.º 2
0
        private void writeMultiname(ABCFile.Multiname v)
        {
            writeU8((byte)v.kind);
            switch (v.kind)
            {
            case ASType.QName:
            case ASType.QNameA:
                writeU30(v.QName.ns);
                writeU30(v.QName.name);
                break;

            case ASType.RTQName:
            case ASType.RTQNameA:
                writeU30(v.RTQName.name);
                break;

            case ASType.RTQNameL:
            case ASType.RTQNameLA:
                break;

            case ASType.Multiname:
            case ASType.MultinameA:
                writeU30(v.MultiName.name);
                writeU30(v.MultiName.nsSet);
                break;

            case ASType.MultinameL:
            case ASType.MultinameLA:
                writeU30(v.MultinameL.nsSet);
                break;

            case ASType.TypeName:
                writeU30(v.TypeName.name);
                writeU30((uint)v.TypeName.parameters.Length);
                foreach (var value in v.TypeName.parameters)
                {
                    writeU30(value);
                }
                break;

            default:
                throw new Exception("Unknown Multiname kind");
            }
        }