Esempio n. 1
0
        public static void Main(string[] args)
        {
            var engine = new SimplificationAnalysisEngine();
            var analysis = new Analysis();

            foreach (var layer in GetAllLayersForStaticAnalysis())
            {
                engine.Process(layer, ref analysis);
                if (layer.Reports.Count > 0)
                    analysis.Layers.Add(layer);
            }

            using (var writer = new StreamWriter("test.xml"))
            {
                AnalysisIO.Save(analysis, writer);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Saves the analysis to a stream
        /// </summary>
        public static void Save(Analysis analysis, StreamWriter output)
        {
            using (var memory = new MemoryStream())
            {
                // Write out leading XML.
                output.Write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
                output.Write("<?xml-stylesheet type=\"text/xsl\" href=\"reports.xsl\"?>");
                output.Flush();

                // Write to memory.
                var x = new DataContractSerializer(
                    typeof(Analysis),
                    m_SerializableTypes,
                    int.MaxValue,
                    false,
                    false,
                    null);
                x.WriteObject(memory, analysis);

                // Reset memory position and write out the contents to the actual stream.
                memory.Seek(0, SeekOrigin.Begin);
                memory.CopyTo(output.BaseStream);
            }
        }