Ejemplo n.º 1
0
        /// <summary>
        /// 通过序列化信息解析数据
        /// </summary>
        /// <param name="force">强制解析</param>
        /// <param name="behaviorSource"></param>
        /// <returns></returns>
        public bool CheckForSerialization(bool force, BehaviorSource behaviorSource = null)
        {
            bool flag = (behaviorSource == null) ? this.HasSerialized : behaviorSource.HasSerialized;

            if (!flag || force)
            {
                if (behaviorSource != null)
                {
                    behaviorSource.HasSerialized = true;
                }
                else
                {
                    this.HasSerialized = true;
                }
                if (this.mTaskData != null && !string.IsNullOrEmpty(this.mTaskData.JSONSerialization))
                {
                    JSONDeserialization.Load(this.mTaskData, (behaviorSource != null) ? behaviorSource : this);
                }
                else
                {
                    BinaryDeserialization.Load(this.mTaskData, (behaviorSource != null) ? behaviorSource : this);
                }
                return(true);
            }
            return(false);
        }
 public void CheckForSerialization(bool force)
 {
     if (force || this.mVariables == null || (this.mVariables.Count > 0 && this.mVariables[0] == null))
     {
         if (this.VariableData != null && !string.IsNullOrEmpty(this.VariableData.JSONSerialization))
         {
             JSONDeserialization.Load(this.VariableData.JSONSerialization, this, this.mVersion);
         }
         else
         {
             BinaryDeserialization.Load(this, this.mVersion);
         }
     }
 }