Skip to content

Commit 0d45d95

Browse files
Iniciando geração de XML
1 parent 6fe04a8 commit 0d45d95

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

MetricsExtractor/ClassRank.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
namespace MetricsExtractor
1+
using System;
2+
3+
namespace MetricsExtractor
24
{
5+
[Serializable]
36
public enum ClassRank
47
{
58
A = 100,

MetricsExtractor/Custom/TypeMetricWithNamespace.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Xml.Serialization;
24
using ArchiMetrics.Common.Metrics;
35

46
namespace MetricsExtractor.Custom
57
{
8+
[Serializable]
69
public class TypeMetricWithNamespace : ITypeMetric
710
{
811
public TypeMetricWithNamespace(ITypeMetric typeMetric)
@@ -16,6 +19,7 @@ public TypeMetricWithNamespace(ITypeMetric typeMetric)
1619
}
1720
}
1821

22+
[XmlIgnore]
1923
public IEnumerable<ITypeCoupling> ClassCouplings { get; private set; }
2024

2125
public int LinesOfCode { get; private set; }
@@ -28,10 +32,13 @@ public TypeMetricWithNamespace(ITypeMetric typeMetric)
2832

2933
public string Name { get; private set; }
3034

35+
[XmlIgnore]
3136
public AccessModifierKind AccessModifier { get; private set; }
3237

38+
[XmlIgnore]
3339
public TypeMetricKind Kind { get; private set; }
3440

41+
[XmlIgnore]
3542
public IEnumerable<IMemberMetric> MemberMetrics { get; private set; }
3643

3744
public int DepthOfInheritance { get; private set; }

MetricsExtractor/EstadoDoProjeto.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.Linq;
34
using MetricsExtractor.Custom;
45

56
namespace MetricsExtractor
67
{
8+
[Serializable]
79
public class EstadoDoProjeto
810
{
911
private Dictionary<ClassRank, int> totalDeClassesPorRank;

MetricsExtractor/MetodoRuim.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-

1+
using System;
2+
23
namespace MetricsExtractor
34
{
5+
[Serializable]
46
public class MetodoRuim
57
{
68
public string ClassName { get; set; }

MetricsExtractor/Program.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
using System;
22
using System.Collections.Generic;
3+
#if DEBUG
34
using System.Diagnostics;
5+
#endif
46
using System.IO;
57
using System.IO.Compression;
68
using System.Linq;
79
using System.Text;
810
using System.Threading.Tasks;
11+
using System.Xml.Serialization;
912
using ArchiMetrics.Analysis;
1013
using ArchiMetrics.Common;
1114
using ArchiMetrics.Common.Metrics;
1215
using MetricsExtractor.Custom;
1316
using MetricsExtractor.ReportTemplate;
14-
using Microsoft.CodeAnalysis.Options;
1517

1618
namespace MetricsExtractor
1719
{
@@ -58,6 +60,7 @@ private static string GenerateReport(EstadoDoProjeto resultadoGeral, string solu
5860
{
5961
var reportDirectory = Path.Combine(solutionDirectory, "CodeMetricsReport");
6062
var reportPath = Path.Combine(reportDirectory, "CodeMetricsReport.zip");
63+
var rawReportPath = Path.Combine(reportDirectory, "RawCodeMetricsReport.xml");
6164

6265
var reportTemplateFactory = new ReportTemplateFactory();
6366
var report = reportTemplateFactory.GetReport(resultadoGeral);
@@ -85,6 +88,13 @@ private static string GenerateReport(EstadoDoProjeto resultadoGeral, string solu
8588
#endif
8689
zipArchive.Dispose();
8790
}
91+
92+
using (var fileStream = File.Open(rawReportPath, FileMode.Create))
93+
{
94+
var xmlSerializer = new XmlSerializer(typeof(EstadoDoProjeto));
95+
xmlSerializer.Serialize(fileStream, resultadoGeral);
96+
}
97+
8898
return reportPath;
8999
}
90100

0 commit comments

Comments
 (0)