Example #1
0
        public LogicNode(string inName, EnGateType inGType, LogicNode inRootParent, int inVal1 = 0)
        {
            this._id = SingleNextIDs.Instance.NextID(EnIDTypes.itTreeNode);

            this.name     = inName;
            this.gateType = inGType;
            this.val1     = inVal1;
            if (inRootParent == null)
            {
                this._rootParent = this;
            }
            else
            {
                this._rootParent = inRootParent;
            }
        }
Example #2
0
        public override bool DeserializeDerived(object obj, bool wrapped, EmraldModel lists, bool useGivenIDs)
        {
            dynamic dynObj = (dynamic)obj;

            if (wrapped)
            {
                if (dynObj.LogicNode == null)
                {
                    return(false);
                }

                dynObj = ((dynamic)obj).LogicNode;
            }

            if (!base.DeserializeDerived((object)dynObj, false, lists, useGivenIDs))
            {
                return(false);
            }

            lists.allLogicNodes.Add(this);

            gateType = (EnGateType)Enum.Parse(typeof(EnGateType), (string)dynObj.gateType, true);

            //Now done in LoadObjLinks()
            ////load the root obj info
            //if (dynObj.rootName != null)
            //{
            //  _rootParent = lists.allLogicNodes.FindByName((string)dynObj.rootName);
            //  if (_rootParent == null)
            //  {
            //    throw new Exception("Root node " + (string)dynObj.rootName + " not found.");
            //  }
            //}

            ////load the gate children
            //if (dynObj.gateChildren != null)
            //{
            //  _subGates.Clear();
            //  foreach (dynamic gateName in dynObj.gateChildren)
            //  {
            //    LogicNode curChildGate = lists.allLogicNodes.FindByName(gateName);
            //    if (curChildGate == null)
            //    {
            //      throw new Exception("Deserialize Logic failed to find child gate - " + gateName);

            //    }

            //    if (!_subGates.Contains(curChildGate))
            //      _subGates.Add(curChildGate);
            //  }
            //}

            ////load the component children
            //if (dynObj.compChildren != null)
            //{
            //  _compChildren.Clear();
            //  foreach (dynamic stateName in dynObj.compChildren)
            //  {
            //    EvalDiagram curChildComp = lists.allDiagrams.FindByName(stateName);
            //    if (curChildComp == null)
            //    {
            //      throw new Exception("Deserialize Logic gate Failed to find child state - " + stateName);
            //    }

            //    _compChildren.Add(curChildComp);
            //  }

            //}

            processed = true;
            return(true);
        }