Exemplo n.º 1
0
 public PhaseData()
 {
     //_associatedControlPoints = new List<VehicleControlPointData>();
     _vehicleControlPoints = new VehicleControlPointsList();
     _detectors            = new DetectorsList();
     _display = new ControlDisplayIndication[ArraySize];
 }
        public static void SaveDetectorsFile(DetectorsList detectors)  //(string filename)
        {
            string filename = @"C:\Temp\SwashSim\Test Intersection\ActDetectors.xml";

            System.IO.TextWriter myStreamWriter = new System.IO.StreamWriter(filename);
            System.Xml.Serialization.XmlSerializer mySerializer = new System.Xml.Serialization.XmlSerializer(typeof(DetectorsList));
            mySerializer.Serialize(myStreamWriter, detectors);
            myStreamWriter.Close();
        }
        public static DetectorsList OpenDetectorsFile(string filename) //(DetectorsList detectors)
        {
            //detectors = new DetectorsList();  // = new List<DetectorData>();

            //string filename = @"X:\OneDrive\SwashSim\Projects\Signalized Intersections\Signal Timing_Actuated\Sig2-Detectors.xml";
            //string filename = @"C:\Temp\SwashSim\Test Intersection\ActDetectors.xml";
            System.IO.FileStream myFileStream = new System.IO.FileStream(filename, System.IO.FileMode.Open);
            System.Xml.Serialization.XmlSerializer mySerializer = new System.Xml.Serialization.XmlSerializer(typeof(DetectorsList)); //(typeof(List<DetectorData>));
            DetectorsList detectors = (DetectorsList)mySerializer.Deserialize(myFileStream);                                         //(List<DetectorData>)mySerializer.Deserialize(myFileStream);

            myFileStream.Close();

            return(detectors);
        }