Ejemplo n.º 1
0
        /// <summary>
        /// Deserialize <see cref="IGetDataOptionArgument"/>.
        /// </summary>
        /// <returns>A <see cref="IGetDataOptionArgument"/> object</returns>
        private RequestGetData.IGetDataOptionArgument DeserializeGetDataOptionArgument()
        {
            RequestGetData.IGetDataOptionArgument optionArgument;
            bool isNull = this.binaryReader.ReadBoolean();

            if (isNull)
            {
                optionArgument = null;
            }
            else
            {
                RequestGetData.GetDataOptions options = (RequestGetData.GetDataOptions) this.binaryReader.ReadByte();

                if (options == RequestGetData.GetDataOptions.FaultbackOnParentDataWithMatch)
                {
                    var    condition = (RequestGetData.GetDataOptionArgumentForMatch.Comparison) this.binaryReader.ReadByte();
                    int    pos       = this.binaryReader.ReadInt32();
                    byte[] bytes     = this.DeserializeByteArray();
                    optionArgument = new RequestGetData.GetDataOptionArgumentForMatch(bytes, pos, condition);
                }
                else
                {
                    optionArgument = null;
                }
            }

            return(optionArgument);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deserialize <see cref="RequestGetData"/>
        /// </summary>
        /// <param name="uid"><c>uid</c> associated with the request</param>
        /// <param name="path">Path associated with the request</param>
        /// <returns>The deserialized request</returns>
        private RequestGetData DeserializeRequestGetData(ulong uid, string path)
        {
            IWatcher watcher = this.DeserializeWatcher();

            RequestGetData.GetDataOptions options = RequestGetData.GetDataOptions.None;

            byte readByte = this.binaryReader.ReadByte();

            options = (RequestGetData.GetDataOptions)readByte;

            RequestGetData.IGetDataOptionArgument optionArgument = null;
            if (this.serializationVersionUsed >= SerializationFormatVersions.Version14)
            {
                optionArgument = this.DeserializeGetDataOptionArgument();
            }

            if (options == RequestGetData.GetDataOptions.FaultbackOnParentData)
            {
                // If the option was Faultback on parent data, we will use an argumentformatch to simulate it.
                optionArgument = new RequestGetData.GetDataOptionArgumentForMatch(null, 0, RequestGetData.GetDataOptionArgumentForMatch.Comparison.Different);
            }

            return(new RequestGetData(path, options, optionArgument, watcher, uid));
        }