Ejemplo n.º 1
0
        static HiP_HOPSResults ReadHiPHOPSResults(XmlReader reader)
        {
            HiP_HOPSResults HiP_HOPSResults = new HiP_HOPSResults();

            HiP_HOPSResults.Model        = reader.GetAttribute("model");
            HiP_HOPSResults.Build        = reader.GetAttribute("build");
            HiP_HOPSResults.MajorVersion = reader.GetAttribute("majorVersion");
            HiP_HOPSResults.MinorVersion = reader.GetAttribute("minorVersion");
            HiP_HOPSResults.Version      = reader.GetAttribute("version");
            HiP_HOPSResults.VersionDate  = reader.GetAttribute("versionDate");

            reader.ReadStartElement();

            if (reader.Name == "FaultTrees")
            {
                reader.ReadStartElement();

                if (reader.Name == "FMEA")
                {
                    HiP_HOPSResults.FMEA = ReadFMEA(reader);
                }

                while (reader.Name == "FaultTree")
                {
                    HiP_HOPSResults.FaultTrees.Add(ReadFaultTree(reader));
                }

                reader.Read();
            }
            return(HiP_HOPSResults);
        }
Ejemplo n.º 2
0
        static void WriteHiPHOPSResults(XmlWriter writer, HiP_HOPSResults hiP_HOPSResults)
        {
            writer.WriteStartElement("HiP-HOPS_Results");
            writer.WriteAttributeString("model", CombinedHiP_HOPSResults.Model);
            writer.WriteAttributeString("build", CombinedHiP_HOPSResults.Build);
            writer.WriteAttributeString("maorVersion", CombinedHiP_HOPSResults.MajorVersion);
            writer.WriteAttributeString("minorVersion", CombinedHiP_HOPSResults.MinorVersion);
            writer.WriteAttributeString("version", CombinedHiP_HOPSResults.Version);
            writer.WriteAttributeString("versionDate", CombinedHiP_HOPSResults.VersionDate);

            writer.WriteStartElement("FaultTrees");

            WriteFMEA(writer, hiP_HOPSResults.FMEA);
            WriteFaultTrees(writer, hiP_HOPSResults.FaultTrees);
        }
Ejemplo n.º 3
0
        static void LoadPath(string pPath)
        {
            Console.WriteLine("Loading path: " + pPath);

            XmlReaderSettings settings = new XmlReaderSettings();

            settings.Async            = false;
            settings.IgnoreWhitespace = true;

            using (XmlReader reader = XmlReader.Create(new StreamReader(pPath + "/faulttrees.xml"), settings))
            {
                BasicEventsDictionaryList.Add(new Dictionary <int, BasicEvent>());

                reader.ReadToFollowing("HiP-HOPS_Results");
                HiP_HOPSResults newHiP_HOPSResults = ReadHiPHOPSResults(reader);
                HiP_HOPSResultsList.Add(newHiP_HOPSResults);

                FilePaths.Add(pPath);
            }
        }