示例#1
0
        //internal void WriteObjectEnd(NameInfo memberNameInfo, NameInfo typeNameInfo)
        //{
        //}

        internal void WriteObjectString(int objectId, string value)
        {
            this.InternalWriteItemNull();
            if (this._binaryObjectString == null)
            {
                this._binaryObjectString = new BinaryObjectString();
            }
            this._binaryObjectString.Set(objectId, value);
            this._binaryObjectString.Write(this);
        }
示例#2
0
        private void ReadObjectString(BinaryHeaderEnum binaryHeaderEnum)
        {
            if (_objectString == null)
            {
                _objectString = new BinaryObjectString();
            }
            if (binaryHeaderEnum == BinaryHeaderEnum.ObjectString)
            {
                _objectString.Read(this);
            }
            else
            {
                if (_crossAppDomainString == null)
                {
                    _crossAppDomainString = new BinaryCrossAppDomainString();
                }
                _crossAppDomainString.Read(this);
                _objectString.Value = objectReader.CrossAppDomainArrayAt(_crossAppDomainString._value) as string;
                if (_objectString.Value == null)
                {
                    throw new SerializationException(RemotingResources.SerializationCrossDomainError.Format(nameof(String), (int)_crossAppDomainString._value));
                }
                _objectString.ObjectId = _crossAppDomainString._objectId;
            }
            PRs.Init();
            PRs.parseTypeEnum = ParseTypeEnum.Object;
            PRs.objectId      = objectReader.GetId((long)_objectString.ObjectId);
            if (PRs.objectId == topId)
            {
                PRs.objectPositionEnum = ObjectPositionEnum.Top;
            }
            PRs.objectTypeEnum = ObjectTypeEnum.Object;
            ObjectProgress progress = (ObjectProgress)stack.Peek();

            PRs.value      = _objectString.Value;
            PRs.keyDt      = "System.String";
            PRs.dtType     = Converter.s_typeofString;
            PRs.dtTypeCode = PrimitiveTypeEnum.Invalid;
            PRs.varValue   = _objectString.Value;
            if (progress == null)
            {
                PRs.parseTypeEnum = ParseTypeEnum.Object;
                PRs.name          = "System.String";
            }
            else
            {
                PRs.parseTypeEnum   = ParseTypeEnum.Member;
                PRs.memberValueEnum = MemberValueEnum.InlineValue;
                ObjectTypeEnum ee = progress._objectTypeEnum;
                if (ee == ObjectTypeEnum.Object)
                {
                    PRs.name           = progress._name;
                    PRs.memberTypeEnum = MemberTypeEnum.Field;
                }
                else
                {
                    if (ee != ObjectTypeEnum.Array)
                    {
                        throw new SerializationException(RemotingResources.SerializationObjectTypeEnum.Format(progress._objectTypeEnum.ToString()));
                    }
                    PRs.memberTypeEnum = MemberTypeEnum.Item;
                }
            }
            objectReader.Parse(PRs);
        }