Exemplo n.º 1
0
        /// <summary>
        /// Десериализует процесс
        /// </summary>
        /// <param name="br">Читатель из потока</param>
        protected virtual void DeserializeInternal(CustomBinaryReader br)
        {
            this.CompleteExecution = br.ReadBoolean();
            this.Id = br.ReadGuid();
            this.PopulateExceptions = br.ReadBoolean();
            this.Stage           = (BpStage)br.ReadByte();
            this.StartedOnServer = br.ReadNullableBoolean();
            this._status         = (BpStatus)br.ReadByte();
            this.TrackMode       = (BpTrackMode)br.ReadByte();
            this.StartTime       = br.ReadDateTime();
            this.FinishTime      = br.ReadDateTime();

            if (br.ReadBoolean())
            {
                this._contextData = new ContextData();
                this._contextData.DeserializeInternal(br);
            }

            int           count      = br.Read7BitEncodedInt();
            List <string> paramNames = new List <string>(count);

            this.Parameters = new Dictionary <string, object>(count);
            for (int i = 0; i < count; i++)
            {
                paramNames.Add(br.ReadString());
            }
            for (int i = 0; i < count; i++)
            {
                this.Parameters.Add(paramNames[i], br.ReadObject());
            }

            //this.Progress = (BpProgressData)br.ReadObject();
            //this.Result = (BpResultData)br.ReadObject();

            if (br.ReadBoolean())
            {
                this.Progress = this.GetProgressInstance();
                ((ICustomSerializable)this.Progress).DeserializeInternal(br);
            }

            if (br.ReadBoolean())
            {
                this.Result = this.GetResultInstance();
                ((ICustomSerializable)this.Result).DeserializeInternal(br);
            }

            count = br.Read7BitEncodedInt();
            this.ChildProcesses = new List <BizProcess>(count);
            for (int i = 0; i < count; i++)
            {
                BizProcess process = this.ReadChildProcess(br);
                this.AddChild(process);
            }

            BpRunningNode.Type brnType = (BpRunningNode.Type)br.ReadByte();
            string             brnName = br.ReadString();

            this.Node = new BpRunningNode(brnType, brnName);
        }