コード例 #1
0
        /// <summary>
        /// Parse next object from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Parse(FastTransferStream stream)
        {
            base.Parse(stream);
            this.Length = stream.ReadInt32();

            if (LexicalTypeHelper.IsCodePageType(this.PropType))
            {
                CodePageType type = (CodePageType)this.PropType;
                switch (type)
                {
                    case CodePageType.PtypCodePageUnicode:
                        PtypString pstring = new PtypString();
                        pstring.Parse(stream);
                        this.ValueArray = pstring;
                        break;
                    case CodePageType.PtypCodePageUnicodeBigendian:
                    case CodePageType.PtypCodePageWesternEuropean:
                        PtypString8 pstring8 = new PtypString8();
                        pstring8.Parse(stream);
                        this.ValueArray = pstring8;
                        break;
                    default:
                        PtypString8 defaultstring8 = new PtypString8();
                        defaultstring8.Parse(stream);
                        break;
                }
            }
            else
            {
                PropertyDataType type = (PropertyDataType)this.PropType;
                switch (type)
                {
                    case PropertyDataType.PtypInteger32:
                    case PropertyDataType.PtypBinary:
                        // PidTagParentSourceKey, PidTagParentSourceKey, PidTagChangeKey
                        if (this.PropInfo.PropID == 0x65E0 || this.PropInfo.PropID == 0x65E1 || this.PropInfo.PropID == 0x65E2)
                        {
                            if (this.Length != 0)
                            {
                                XID tmpXID = new XID(this.Length);
                                tmpXID.Parse(stream);
                                this.ValueArray = tmpXID;
                            }
                        }
                        else if (this.PropInfo.PropID == 0x65E3) // PidTagPredecessorChangeList
                        {
                            PredecessorChangeList tmpPredecessorChangeList = new PredecessorChangeList(this.Length);
                            tmpPredecessorChangeList.Parse(stream);
                            this.ValueArray = tmpPredecessorChangeList;
                        }
                        else if (this.PropInfo.PropID == 0x402D || this.PropInfo.PropID == 0x402E || this.PropInfo.PropID == 0x67E5 || this.PropInfo.PropID == 0x4021 || this.PropInfo.PropID == 0x6793)
                        {
                            if (this.Length != 0)
                            {
                                int begionPosition = (int)stream.Position;
                                int EveLength = this.Length;
                                List<IDSET_REPLID> InterIDSET_REPLID = new List<IDSET_REPLID>();
                                while (EveLength > 0)
                                {
                                    IDSET_REPLID tmpIDSET_REPLID = new IDSET_REPLID();
                                    tmpIDSET_REPLID.Parse(stream);
                                    InterIDSET_REPLID.Add(tmpIDSET_REPLID);
                                    EveLength -= ((int)stream.Position - begionPosition);
                                }
                                this.ValueArray = InterIDSET_REPLID.ToArray();
                            }
                        }
                        else if (this.PropInfo.PropID == 0x4017 || this.PropInfo.PropID == 0x6796 || this.PropInfo.PropID == 0x67DA || this.PropInfo.PropID == 0x67D2)
                        {
                            if (this.Length != 0)
                            {
                                int begionPosition = (int)stream.Position;
                                int EveLength = this.Length;
                                List<IDSET_REPLGUID> InterIDSET_REPLGUID = new List<IDSET_REPLGUID>();
                                while (EveLength > 0)
                                {
                                    IDSET_REPLGUID tmpIDSET_REPLGUID = new IDSET_REPLGUID();
                                    tmpIDSET_REPLGUID.Parse(stream);
                                    InterIDSET_REPLGUID.Add(tmpIDSET_REPLGUID);
                                    EveLength -= ((int)stream.Position - begionPosition);
                                }
                                this.ValueArray = InterIDSET_REPLGUID.ToArray();
                            }
                        }
                        else
                        {
                            this.ValueArray = stream.ReadBlock(this.Length);
                        }
                        break;
                    case PropertyDataType.PtypString:
                        PtypString pstring = new PtypString();
                        pstring.Parse(stream);
                        this.ValueArray = pstring;
                        break;
                    case PropertyDataType.PtypString8:
                        PtypString8 pstring8 = new PtypString8();
                        pstring8.Parse(stream);
                        this.ValueArray = pstring8;
                        break;
                    case PropertyDataType.PtypServerId:
                        PtypServerId pserverId = new PtypServerId();
                        pserverId.Parse(stream);
                        this.ValueArray = pserverId;
                        break;
                    case PropertyDataType.PtypObject_Or_PtypEmbeddedTable:
                        this.ValueArray = stream.ReadBlock(this.Length);
                        break;
                    default:
                        this.ValueArray = stream.ReadBlock(this.Length);
                        break;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// The method to return the object of PropertyValue.
        /// </summary>
        /// <param name="dataType">The Property data type.</param>
        /// <param name="s">A stream containing the PropertyValue structure</param>
        /// <param name="ptypMultiCountSize">The Count wide size of ptypMutiple type.</param>
        /// <returns>The object of PropertyValue.</returns>
        public object ReadPropertyValue(PropertyDataType dataType, Stream s, CountWideEnum ptypMultiCountSize = CountWideEnum.twoBytes)
        {
            base.Parse(s);
            object propertyValue;
            switch (dataType)
            {
                case PropertyDataType.PtypInteger16:
                    {
                        PtypInteger16 tempPropertyValue = new PtypInteger16();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypInteger32:
                    {
                        PtypInteger32 tempPropertyValue = new PtypInteger32();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypFloating32:
                    {
                        PtypFloating32 tempPropertyValue = new PtypFloating32();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypFloating64:
                    {
                        PtypFloating64 tempPropertyValue = new PtypFloating64();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypCurrency:
                    {
                        PtypCurrency tempPropertyValue = new PtypCurrency();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypFloatingTime:
                    {
                        PtypFloatingTime tempPropertyValue = new PtypFloatingTime();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypErrorCode:
                    {
                        PtypErrorCode tempPropertyValue = new PtypErrorCode();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypBoolean:
                    {
                        PtypBoolean tempPropertyValue = new PtypBoolean();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypInteger64:
                    {
                        PtypInteger64 tempPropertyValue = new PtypInteger64();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypString:
                    {
                        PtypString tempPropertyValue = new PtypString();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypString8:
                    {
                        PtypString8 tempPropertyValue = new PtypString8();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypTime:
                    {
                        PtypTime tempPropertyValue = new PtypTime();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypGuid:
                    {
                        PtypGuid tempPropertyValue = new PtypGuid();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypServerId:
                    {
                        PtypServerId tempPropertyValue = new PtypServerId();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypRestriction:
                    {
                        PtypRestriction tempPropertyValue = new PtypRestriction();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypRuleAction:
                    {
                        PtypRuleAction tempPropertyValue = new PtypRuleAction();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypUnspecified:
                    {
                        PtypUnspecified tempPropertyValue = new PtypUnspecified();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypNull:
                    {
                        PtypNull tempPropertyValue = new PtypNull();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypBinary:
                    {
                        PtypBinary tempPropertyValue = new PtypBinary(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleInteger16:
                    {
                        PtypMultipleInteger16 tempPropertyValue = new PtypMultipleInteger16(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleInteger32:
                    {
                        PtypMultipleInteger32 tempPropertyValue = new PtypMultipleInteger32(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleFloating32:
                    {
                        PtypMultipleFloating32 tempPropertyValue = new PtypMultipleFloating32(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleFloating64:
                    {
                        PtypMultipleFloating64 tempPropertyValue = new PtypMultipleFloating64(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleCurrency:
                    {
                        PtypMultipleCurrency tempPropertyValue = new PtypMultipleCurrency(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleFloatingTime:
                    {
                        PtypMultipleFloatingTime tempPropertyValue = new PtypMultipleFloatingTime(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleInteger64:
                    {
                        PtypMultipleInteger64 tempPropertyValue = new PtypMultipleInteger64(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleString:
                    {
                        PtypMultipleString tempPropertyValue = new PtypMultipleString(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleString8:
                    {
                        PtypMultipleString8 tempPropertyValue = new PtypMultipleString8(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleTime:
                    {
                        PtypMultipleTime tempPropertyValue = new PtypMultipleTime(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleGuid:
                    {
                        PtypMultipleGuid tempPropertyValue = new PtypMultipleGuid(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypMultipleBinary:
                    {
                        PtypMultipleBinary tempPropertyValue = new PtypMultipleBinary(ptypMultiCountSize);
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;
                    }
                case PropertyDataType.PtypObject_Or_PtypEmbeddedTable:
                    {
                        PtypObject_Or_PtypEmbeddedTable tempPropertyValue = new PtypObject_Or_PtypEmbeddedTable();
                        tempPropertyValue.Parse(s);
                        propertyValue = tempPropertyValue;
                        break;

                    }
                default:
                    propertyValue = null;
                    break;
            }
            return propertyValue;
        }
コード例 #3
0
 /// <summary>
 /// Parse MetaPropValue from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public override void Parse(FastTransferStream stream)
 {
     this.PropType = stream.ReadUInt16();
     this.PropID = stream.ReadUInt16();
     if (PropID != 0x4011 && PropID != 0x4008)
     {
         this.PropValue = stream.ReadUInt32();
     }
     else
     {
         if (PropID != 0x4011)
         {
             FolderReplicaInfo FolderReplicaInfo = new FolderReplicaInfo();
             FolderReplicaInfo.Parse(stream);
             this.PropValue = FolderReplicaInfo;
         }
         else
         {
             PtypString8 pstring8 = new PtypString8();
             pstring8.Parse(stream);
             this.PropValue = pstring8;
         }
     }
 }