예제 #1
0
        List <SimulationEvent> LoadForkReplayFile(String filename)
        {
            List <SimulationEvent> events = new List <SimulationEvent>();

            if (filename == null)
            {
                return(events);
            }



            StreamReader    re    = File.OpenText(filename);
            string          input = null;
            SimulationEvent ev    = null;

            input = re.ReadLine(); // thriow away the line with the version number


            while ((input = re.ReadLine()) != null)
            {
                try
                {
                    ev = SimulationEventFactory.XMLDeserialize(input);
                    if (SimulationEventFactory.ValidateEvent(ref m_simModelInfo, ev))
                    {
                        if (m_simModelInfo.eventModel.events[ev.eventType].shouldForkReplay)
                        {
                            events.Add(ev);
                        }
                    }
                    else
                    {
                        throw new Exception("error reading: " + input);
                    }
                }
                catch (Exception e)
                {
                    ErrorLog.Write(String.Format("NONFATAL Deserialize Error in ForkReplayToQueues: {0}", input));
                    ErrorLog.Write(e.ToString());
                }
            }
            re.Close();

            return(events);
        }
예제 #2
0
파일: Form1.cs 프로젝트: vishalbelsare/DDD
 private void loadEventsButton_Click(object sender, EventArgs e)
 {
     if (ofd2.ShowDialog() == DialogResult.OK)
     {
         StreamReader    re    = File.OpenText(ofd2.FileName);
         string          input = null;
         SimulationEvent ev    = null;
         eventsListBox.Items.Clear();
         while ((input = re.ReadLine()) != null)
         {
             ev = SimulationEventFactory.XMLDeserialize(input);
             if (SimulationEventFactory.ValidateEvent(ref simModel, ev))
             {
                 eventsListBox.Items.Add(new EventListBoxItem(ev));
             }
             else
             {
                 MessageBox.Show("event file contains invalid event: \"" + input + "\"");
             }
         }
         re.Close();
     }
 }
예제 #3
0
        private void LoadEvents(string fileName)
        {
            StreamReader    re    = File.OpenText(fileName);
            string          input = null;
            SimulationEvent ev    = null;

            events.Clear();

            input = re.ReadLine(); // thriow away the line with the version number


            while ((input = re.ReadLine()) != null)
            {
                try
                {
                    ev = SimulationEventFactory.XMLDeserialize(input);
                    if (SimulationEventFactory.ValidateEvent(ref simModel, ev))
                    {
                        if (simModel.eventModel.events[ev.eventType].shouldReplay)
                        {
                            events.Add(ev);
                        }
                    }
                    else
                    {
                        throw new Exception("error reading: " + input);
                    }
                }
                catch (Exception e)
                {
                    ErrorLog.Write(String.Format("NONFATAL Deserialize Error in LogPlayer.Player: {0}", input));
                    ErrorLog.Write(e.ToString());
                }
            }
            re.Close();
        }