Exemple #1
0
    } //TestPointer::Reuse()

    public TestPointer Copy(TestPointer from_)
    {
        if (null == from_ || this == from_) {
            return this;
        }
        if (null == from_.self) {
            this.self = null;
        } else {
            if (null == this.self) { this.self = new TestPointer(); }
            this.self.Copy(from_.self);
        }
        this.stringValue = from_.stringValue;
        if (null == from_.other) {
            this.other = null;
        } else {
            if (null == this.other) { this.other = new Custom(); }
            this.other.Copy(from_.other);
        }
        if (null == from_.listI08) {
            this.listI08 = null;
        } else {
            if (null == this.listI08) { this.listI08 = new List<SByte>(); }
            else { this.listI08.Clear(); }
            this.listI08.AddRange(from_.listI08);
        }
        if (null == from_.dictI08) {
            this.dictI08 = null;
        } else {
            if (null == this.dictI08) { this.dictI08 = new Dictionary<SByte,SByte>(); }
            else { this.dictI08.Clear(); }
            foreach (var dictI08Iter in from_.dictI08) {
                this.dictI08.Add(dictI08Iter.Key, dictI08Iter.Value);
            }
        }
        if (null == from_.listNested) {
            this.listNested = null;
        } else {
            if (null == this.listNested) { this.listNested = new List<List<List<List<TestPointer>>>>(); }
            else { this.listNested.Clear(); }
            this.listNested.AddRange(from_.listNested);
        }
        this.numberSingle = from_.numberSingle;
        this.enumValue = from_.enumValue;
        if (null == from_.hotfix) {
            this.hotfix = null;
        } else {
            if (null == this.hotfix) { this.hotfix = new Dictionary<String,String>(); }
            else { this.hotfix.Clear(); }
            foreach (var hotfixIter in from_.hotfix) {
                this.hotfix.Add(hotfixIter.Key, hotfixIter.Value);
            }
        }
        return this;
    } //TestPointer::Copy(...)
Exemple #2
0
 public TestPointer SetSelf(TestPointer value) { this.self = value; return this; }
Exemple #3
0
    } //TestPointer::Copy(...)

    public void Read(BinaryReader r)
    {
        sbyte selfExists = r.ReadSByte();
        if ((sbyte)0x01 == selfExists) {
            if (this.self == null) { this.self = new TestPointer(); }
            this.self.Read(r);
        }
        else if ((sbyte)0x00 == selfExists) { this.self = null; }
        else { throw new IOException("Protoc read error: The value of 'selfExists' is invalid.", 497); }
        sbyte stringValueExists = r.ReadSByte();
        if ((sbyte)0x01 == stringValueExists) {
            this.stringValue = Encoding.UTF8.GetString(r.ReadBytes(r.ReadInt32()));
        }
        else if ((sbyte)0x00 == stringValueExists) { this.stringValue = null; }
        else { throw new IOException("Protoc read error: The value of 'stringValueExists' is invalid.", 496); }
        sbyte otherExists = r.ReadSByte();
        if ((sbyte)0x01 == otherExists) {
            if (this.other == null) { this.other = new Custom(); }
            this.other.Read(r);
        }
        else if ((sbyte)0x00 == otherExists) { this.other = null; }
        else { throw new IOException("Protoc read error: The value of 'otherExists' is invalid.", 497); }
        sbyte listI08Exists = r.ReadSByte();
        if ((sbyte)0x01 == listI08Exists) {
            if (this.listI08 == null) { this.listI08 = new List<SByte>(); }
            UInt32 lenListI08 = r.ReadUInt32();
            for (UInt32 iListI08 = 0; iListI08 < lenListI08; iListI08++) {
                SByte n1 = r.ReadSByte();
                this.listI08.Add(n1);
            }
        }
        else if ((sbyte)0x00 == listI08Exists) { this.listI08 = null; }
        else { throw new IOException("Protoc read error: The value of 'listI08Exists' is invalid.", 498); }
        sbyte dictI08Exists = r.ReadSByte();
        if ((sbyte)0x01 == dictI08Exists) {
            if (this.dictI08 == null) { this.dictI08 = new Dictionary<SByte,SByte>(); }
            UInt32 lenDictI08 = r.ReadUInt32();
            for (UInt32 iDictI08 = 0; iDictI08 < lenDictI08; iDictI08++) {
                SByte k1 = r.ReadSByte();
                SByte v1 = r.ReadSByte();
                if (!this.dictI08.ContainsKey(k1)) {
                    this.dictI08.Add(k1, v1);
                } else {
                    this.dictI08[k1] = v1;
                }
            }
        }
        else if ((sbyte)0x00 == dictI08Exists) { this.dictI08 = null; }
        else { throw new IOException("Protoc read error: The value of 'dictI08Exists' is invalid.", 498); }
        sbyte listNestedExists = r.ReadSByte();
        if ((sbyte)0x01 == listNestedExists) {
            if (this.listNested == null) { this.listNested = new List<List<List<List<TestPointer>>>>(); }
            UInt32 lenListNested = r.ReadUInt32();
            for (UInt32 iListNested = 0; iListNested < lenListNested; iListNested++) {
                List<List<List<TestPointer>>> n1 = new List<List<List<TestPointer>>>(); //read.vec.head
                UInt32 lenN1 = r.ReadUInt32();
                for (UInt32 iN1 = 0; iN1 < lenN1; iN1++) {
                    List<List<TestPointer>> n2 = new List<List<TestPointer>>(); //read.vec.head
                    UInt32 lenN2 = r.ReadUInt32();
                    for (UInt32 iN2 = 0; iN2 < lenN2; iN2++) {
                        List<TestPointer> n3 = new List<TestPointer>(); //read.vec.head
                        UInt32 lenN3 = r.ReadUInt32();
                        for (UInt32 iN3 = 0; iN3 < lenN3; iN3++) {
                            TestPointer n4 = new TestPointer();
                            n4.Read(r);
                            n3.Add(n4);
                        }
                        n2.Add(n3);
                    }
                    n1.Add(n2);
                }
                this.listNested.Add(n1);
            }
        }
        else if ((sbyte)0x00 == listNestedExists) { this.listNested = null; }
        else { throw new IOException("Protoc read error: The value of 'listNestedExists' is invalid.", 498); }
        this.numberSingle = r.ReadSingle();
        this.enumValue = (Gender)Enum.ToObject(typeof(Gender), r.ReadInt32());
        sbyte hotfixExists = r.ReadSByte();
        if ((sbyte)0x01 == hotfixExists) {
            if (this.hotfix == null) { this.hotfix = new Dictionary<String,String>(); }
            UInt32 lenHotfix = r.ReadUInt32();
            for (UInt32 iHotfix = 0; iHotfix < lenHotfix; iHotfix++) {
                String k1 = Encoding.UTF8.GetString(r.ReadBytes(r.ReadInt32()));
                String v1 = Encoding.UTF8.GetString(r.ReadBytes(r.ReadInt32()));
                if (!this.hotfix.ContainsKey(k1)) {
                    this.hotfix.Add(k1, v1);
                } else {
                    this.hotfix[k1] = v1;
                }
            }
        }
        else if ((sbyte)0x00 == hotfixExists) { this.hotfix = null; }
        else { throw new IOException("Protoc read error: The value of 'hotfixExists' is invalid.", 498); }
    } //TestPointer::Read(...)