Esempio n. 1
0
        /// <summary>
        /// Reconstitutes this object from the specified XmlSerializationContext.
        /// </summary>
        /// <param name="xmlsc">The specified XmlSerializationContext.</param>
        public override void DeserializeFrom(XmlSerializationContext xmlsc)
        {
            m_model = (Model)xmlsc.ContextEntities["Model"];
            m_guid  = (Guid)xmlsc.LoadObject("Guid");

            base.DeserializeFrom(xmlsc);

            m_keepingTimingData = (bool)xmlsc.LoadObject("KeepingTimingData");

            #region >>> Do what else is in the constructor. <<<
            ExecutionDelegate = new EdgeExecutionDelegate(OnEdgeExecution);

            EdgeStartingEvent           += new EdgeEvent(OnEdgeStartingEvent);
            EdgeExecutionStartingEvent  += new EdgeEvent(OnEdgeExecutionStartingEvent);
            EdgeExecutionFinishingEvent += new EdgeEvent(OnEdgeExecutionFinishingEvent);
            EdgeFinishingEvent          += new EdgeEvent(OnEdgeFinishingEvent);

            StructureChangeHandler += new StructureChangeHandler(MyStructureChangedHandler);

            ValidityChangeEvent += new Graphs.Validity.ValidityChangeHandler(Task_ValidityChangeEvent);

            ResetDurationData();

            #endregion
        }
Esempio n. 2
0
 /// <summary>
 /// Reconstitutes this object from the specified XmlSerializationContext.
 /// </summary>
 /// <param name="xmlsc">The specified XmlSerializationContext.</param>
 public void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     m_mass = (double)xmlsc.LoadObject("Mass");
     Temp   = (double)xmlsc.LoadObject("Temp");
     m_type = (MaterialType)xmlsc.LoadObject("Type");
     m_ssh.ReportChange();
 }
Esempio n. 3
0
 /// <summary>
 /// Reconstitutes this object from the specified XmlSerializationContext.
 /// </summary>
 /// <param name="xmlsc">The specified XmlSerializationContext.</param>
 public override void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     base.DeserializeFrom(xmlsc);
     m_name                     = (string)xmlsc.LoadObject("Name");
     m_guid                     = (Guid)xmlsc.LoadObject("Guid");
     m_specificGravity          = (double)xmlsc.LoadObject("SpecificGravity");
     m_specificHeat             = (double)xmlsc.LoadObject("SpecificHeat");
     m_latentHeatOfVaporization = (double)xmlsc.LoadObject("LHOV");
 }
Esempio n. 4
0
 /// <summary>
 /// Deserializes this object from the specified XmlSerializatonContext.
 /// </summary>
 /// <param name="xmlsc">The XmlSerializatonContext from which this object is to be reconstituted.</param>
 public void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     m_model     = (Model)xmlsc.ContextEntities["Model"];
     m_name      = (string)xmlsc.LoadObject("Name");
     m_guid      = (Guid)xmlsc.LoadObject("Guid");
     m_resources = (ArrayList)xmlsc.LoadObject("Resources");
     foreach (IResource resource in m_resources)
     {
         resource.Manager = this;
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Deserializes this object from the specified XmlSerializatonContext.
 /// </summary>
 /// <param name="xmlsc">The XmlSerializatonContext from which this object is to be reconstituted.</param>
 public void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     m_nEntries = (int)xmlsc.LoadObject("NumberOfEntries");
     m_xVals    = new double[m_nEntries];
     m_yVals    = new double[m_nEntries];
     for (int i = 0; i < m_nEntries; i++)
     {
         m_xVals[i] = (double)xmlsc.LoadObject("XVals_" + i);
         m_yVals[i] = (double)xmlsc.LoadObject("YVals_" + i);
     }
 }
Esempio n. 6
0
        public virtual void DeserializeFrom(XmlSerializationContext xmlsc)
        {
            m_masterTask = (Task)xmlsc.LoadObject("MasterTask");

            ArrayList tmpList = (ArrayList)xmlsc.LoadObject("ChildTasks");

            foreach (Task task in tmpList)
            {
                AppendTask(task);
            }
        }
Esempio n. 7
0
        public virtual void DeserializeFrom(XmlSerializationContext xmlsc)
        {
            // TODO:  Add Vertex.DeserializeFrom implementation
            m_exec      = ((Model)xmlsc.ContextEntities["Model"]).Executive;
            m_eventType = (ExecEventType)xmlsc.LoadObject("EventType");
            int vertexCount = (int)xmlsc.LoadObject("VertexCount");

            m_vertices = new Vertex[vertexCount];
            //for ( int i = 0 ; i < vertexCount ; i++ ) {
            throw new NotImplementedException("Vertex deserialization not yet implemented in VertexSynchronizers.");
            //}
        }
Esempio n. 8
0
        public virtual void DeserializeFrom(XmlSerializationContext xmlsc)
        {
            m_name = (string)xmlsc.LoadObject("Name");
            ArrayList tmpPostEdges = (ArrayList)xmlsc.LoadObject("PostEdges");

            foreach (Edge edge in tmpPostEdges)
            {
                if (!PostEdges.Contains(edge))
                {
                    PostEdges.Add(edge);
                }
                NumPostEdges++;
            }
            ArrayList tmpPreEdges = (ArrayList)xmlsc.LoadObject("PreEdges");

            foreach (Edge edge in tmpPreEdges)
            {
                if (!PreEdges.Contains(edge))
                {
                    PreEdges.Add(edge);
                }
                NumPreEdges++;
            }

            m_principalEdge   = (Edge)xmlsc.LoadObject("PrincipalEdge");
            m_role            = (WhichVertex)xmlsc.LoadObject("Role");
            m_roleIsKnown     = (bool)xmlsc.LoadObject("RoleIsKnown");
            m_synchronizer    = (VertexSynchronizer)xmlsc.LoadObject("Synchronizer");
            m_triggerDelegate = (TriggerDelegate)xmlsc.LoadObject("TriggerDelegate");
//			_Debug.WriteLine("Deserializing " + m_name + " : it has " + m_postEdges.Count + " post edges in object w/ hashcode "
//				+ m_postEdges.GetHashCode() + ". (BTW, this has hashcode " + this.GetHashCode() + ").");
        }
            /// <summary>
            /// Deserializes this object from the specified XmlSerializatonContext.
            /// </summary>
            /// <param name="xmlsc">The XmlSerializatonContext from which this object is to be reconstituted.</param>
            public void DeserializeFrom(XmlSerializationContext xmlsc)
            {
                model = (Model)xmlsc.ContextEntities["Model"];
                Task rootTask = (Task)xmlsc.LoadObject("Parent");

                tp = new TaskProcessor(model, "TP_Reloaded", Guid.NewGuid(), rootTask);
                tp.KeepGraphContexts = true;

                foreach (TestTask task in tp.MasterTask.GetChildTasks(false))
                {
                    if (task.Name.Equals("TaskA"))
                    {
                        ta = task;
                    }
                    if (task.Name.Equals("TaskB"))
                    {
                        tb = task;
                    }
                    if (task.Name.Equals("TaskC"))
                    {
                        tc = task;
                    }
                    if (task.Name.Equals("TaskD"))
                    {
                        td = task;
                    }
                }
            }
Esempio n. 10
0
        private void loadXML(ref TestGraph1 tg1)
        {
            XmlSerializationContext xmlsc = new XmlSerializationContext();

            xmlsc.Load(System.Environment.GetEnvironmentVariable("TEMP") + "\\TestGraphPersistence.xml");
            xmlsc.ContextEntities.Add("Model", new Model("Reconstituted Model"));
            tg1 = (TestGraph1)xmlsc.LoadObject("TG");
        }
Esempio n. 11
0
 /// <summary>
 /// Reconstitutes this object from the specified XmlSerializationContext.
 /// </summary>
 /// <param name="xmlsc">The specified XmlSerializationContext.</param>
 public void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     m_model  = (Model)xmlsc.ContextEntities["Model"];
     m_name   = (string)xmlsc.LoadObject("Name");
     m_guid   = (Guid)xmlsc.LoadObject("Guid");
     Capacity = (double)xmlsc.LoadObject("Capacity");
     m_permissibleOverbook = (double)xmlsc.LoadObject("Overbookability");
     // We skip serialization of 'Available' - it'll be 100% on load.
     IsAtomic        = (bool)xmlsc.LoadObject("IsAtomic");
     IsDiscrete      = (bool)xmlsc.LoadObject("IsDiscrete");
     IsPersistent    = (bool)xmlsc.LoadObject("IsPersistent");
     m_wrappedByWhom = (IResource)xmlsc.LoadObject("WrappedByWhom");
     // We skip serialization of the manager - the manager will need to add it in on reconstitution.
 }
Esempio n. 12
0
 public virtual void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     m_model                    = (Model)xmlsc.ContextEntities["Model"];
     m_eet                      = (ExecEventType)xmlsc.LoadObject("ExecEventType");
     m_guid                     = (Guid)xmlsc.LoadObject("Guid");
     m_keepGraphContexts        = (bool)xmlsc.LoadObject("KeepGCs");
     m_masterTask               = (Task)xmlsc.LoadObject("MasterTask");
     m_name                     = (string)xmlsc.LoadObject("Name");
     m_startConditionsSpecified = (bool)xmlsc.LoadObject("StartCondSpec");
     m_when                     = (DateTime)xmlsc.LoadObject("When");
 }
Esempio n. 13
0
        public virtual void DeserializeFrom(XmlSerializationContext xmlsc)
        {
            Key        = (string)xmlsc.LoadObject("key");
            m_initType = (InitType)xmlsc.LoadObject("InitType");
            switch (m_initType)
            {
            case InitType.Bool: {
                BoolValue = (bool)xmlsc.LoadObject("Value");            break;
            }

            case InitType.Double: {
                DoubleValue = (double)xmlsc.LoadObject("Value");        break;
            }

            case InitType.String: {
                StringValue = (string)xmlsc.LoadObject("Value");        break;
            }

            default: {
                throw new ApplicationException("deserialization attempted on unknown type of InitType");
            }
            }
        }
Esempio n. 14
0
 /// <summary>
 /// Reconstitutes this object from the specified XmlSerializationContext.
 /// </summary>
 /// <param name="xmlsc">The specified XmlSerializationContext.</param>
 public void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     m_name      = (string)xmlsc.LoadObject("Name");
     m_guid      = (Guid)xmlsc.LoadObject("Guid");
     m_energy    = (double)xmlsc.LoadObject("Energy");
     m_products  = (ArrayList)xmlsc.LoadObject("Products");
     m_reactants = (ArrayList)xmlsc.LoadObject("Reactants");
     m_rxPct     = (double)xmlsc.LoadObject("ReactionPercentage");
 }
Esempio n. 15
0
 public override void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     base.DeserializeFrom(xmlsc);
     m_delay = (TimeSpan)xmlsc.LoadObject("Delay");
     m_svs   = (bool)xmlsc.LoadObject("SVS");
 }
Esempio n. 16
0
 /// <summary>
 /// Reconstitutes this object from the specified XmlSerializationContext.
 /// </summary>
 /// <param name="xmlsc">The specified XmlSerializationContext.</param>
 public void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     m_type = (MaterialType)xmlsc.LoadObject("MaterialType");
     m_mass = (double)xmlsc.LoadObject("Mass");
 }
Esempio n. 17
0
 /// <summary>
 /// Reconstitutes this object from the specified XmlSerializationContext.
 /// </summary>
 /// <param name="xmlsc">The specified XmlSerializationContext.</param>
 public void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     m_materialTypesByName = (Hashtable)xmlsc.LoadObject("MaterialTypesByName");
     m_materialTypesByGuid = (Hashtable)xmlsc.LoadObject("MaterialTypesByGuid");
 }
Esempio n. 18
0
 /// <summary>
 /// Deserializes this object from the specified XmlSerializatonContext.
 /// </summary>
 /// <param name="xmlsc">The XmlSerializatonContext from which this object is to be reconstituted.</param>
 public void DeserializeFrom(XmlSerializationContext xmlsc)
 {
     m_materialCatalog   = (MaterialCatalog)xmlsc.LoadObject("MaterialCatalog");
     m_reactionProcessor = (ReactionProcessor)xmlsc.LoadObject("ReactionProcessor");
 }