@@ -47,11 +47,11 @@ private static void CreateCsv(IEnumerable<TracerouteHopInfo> collection, string
4747 var stringBuilder = new StringBuilder ( ) ;
4848
4949 stringBuilder . AppendLine (
50- $ "{ nameof ( TracerouteHopInfo . Hop ) } ,{ nameof ( TracerouteHopInfo . Status1 ) } ,{ nameof ( TracerouteHopInfo . Time1 ) } ,{ nameof ( TracerouteHopInfo . Status2 ) } ,{ nameof ( TracerouteHopInfo . Time2 ) } ,{ nameof ( TracerouteHopInfo . Status3 ) } { nameof ( TracerouteHopInfo . Time3 ) } ,{ nameof ( TracerouteHopInfo . IPAddress ) } ,{ nameof ( TracerouteHopInfo . Hostname ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Continent ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Country ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Region ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . City ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . District ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Isp ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Org ) } , { nameof ( TracerouteHopInfo . IPGeolocationResult . Info . As ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Asname ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Hosting ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Proxy ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Mobile ) } ") ;
50+ $ "{ nameof ( TracerouteHopInfo . Hop ) } ,{ nameof ( TracerouteHopInfo . Status1 ) } ,{ nameof ( TracerouteHopInfo . Time1 ) } ,{ nameof ( TracerouteHopInfo . Status2 ) } ,{ nameof ( TracerouteHopInfo . Time2 ) } ,{ nameof ( TracerouteHopInfo . Status3 ) } ,{ nameof ( TracerouteHopInfo . Time3 ) } ,{ nameof ( TracerouteHopInfo . IPAddress ) } ,{ nameof ( TracerouteHopInfo . Hostname ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Continent ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Country ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Region ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . City ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . District ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Isp ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Org ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . As ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Asname ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Hosting ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Proxy ) } ,{ nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Mobile ) } ") ;
5151
5252 foreach ( var info in collection )
5353 stringBuilder . AppendLine (
54- $ "{ info . Hop } ,{ info . Status1 } ,{ Ping . TimeToString ( info . Status1 , info . Time1 , true ) } ,{ info . Status2 } ,{ Ping . TimeToString ( info . Status2 , info . Time2 , true ) } ,{ info . Status3 } ,{ Ping . TimeToString ( info . Status3 , info . Time3 , true ) } ,{ info . IPAddress } ,{ info . Hostname } ,{ info . IPGeolocationResult . Info . Continent } ,{ info . IPGeolocationResult . Info . Country } ,{ info . IPGeolocationResult . Info . Region } ,{ info . IPGeolocationResult . Info . City } ,{ info . IPGeolocationResult . Info . District } ,{ info . IPGeolocationResult . Info . Isp ? . Replace ( "," , "" ) } ,{ info . IPGeolocationResult . Info . Org ? . Replace ( "," , "" ) } ,{ info . IPGeolocationResult . Info . As ? . Replace ( "," , "" ) } ,{ info . IPGeolocationResult . Info . Asname ? . Replace ( "," , "" ) } ,{ info . IPGeolocationResult . Info . Hosting } ,{ info . IPGeolocationResult . Info . Proxy } ,{ info . IPGeolocationResult . Info . Mobile } ") ;
54+ $ "{ info . Hop } ,{ info . Status1 } ,{ Ping . TimeToString ( info . Status1 , info . Time1 , true ) } ,{ info . Status2 } ,{ Ping . TimeToString ( info . Status2 , info . Time2 , true ) } ,{ info . Status3 } ,{ Ping . TimeToString ( info . Status3 , info . Time3 , true ) } ,{ info . IPAddress } ,{ info . Hostname } ,{ info . IPGeolocationResult ? . Info ? . Continent } ,{ info . IPGeolocationResult ? . Info ? . Country } ,{ info . IPGeolocationResult ? . Info ? . Region } ,{ info . IPGeolocationResult ? . Info ? . City } ,{ info . IPGeolocationResult ? . Info ? . District } ,{ info . IPGeolocationResult ? . Info ? . Isp ? . Replace ( "," , "" ) } ,{ info . IPGeolocationResult ? . Info ? . Org ? . Replace ( "," , "" ) } ,{ info . IPGeolocationResult ? . Info ? . As ? . Replace ( "," , "" ) } ,{ info . IPGeolocationResult ? . Info ? . Asname ? . Replace ( "," , "" ) } ,{ info . IPGeolocationResult ? . Info ? . Hosting } ,{ info . IPGeolocationResult ? . Info ? . Proxy } ,{ info . IPGeolocationResult ? . Info ? . Mobile } ") ;
5555
5656 File . WriteAllText ( filePath , stringBuilder . ToString ( ) ) ;
5757 }
@@ -82,29 +82,29 @@ from info in collection
8282 new XElement ( nameof ( TracerouteHopInfo . IPAddress ) , info . IPAddress ) ,
8383 new XElement ( nameof ( TracerouteHopInfo . Hostname ) , info . Hostname ) ,
8484 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Continent ) ,
85- info . IPGeolocationResult . Info . Continent ) ,
85+ info . IPGeolocationResult ? . Info ? . Continent ) ,
8686 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Country ) ,
87- info . IPGeolocationResult . Info . Country ) ,
87+ info . IPGeolocationResult ? . Info ? . Country ) ,
8888 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Region ) ,
89- info . IPGeolocationResult . Info . Region ) ,
89+ info . IPGeolocationResult ? . Info ? . Region ) ,
9090 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . City ) ,
91- info . IPGeolocationResult . Info . City ) ,
91+ info . IPGeolocationResult ? . Info ? . City ) ,
9292 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . District ) ,
93- info . IPGeolocationResult . Info . District ) ,
93+ info . IPGeolocationResult ? . Info ? . District ) ,
9494 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Isp ) ,
95- info . IPGeolocationResult . Info . Isp ) ,
95+ info . IPGeolocationResult ? . Info ? . Isp ) ,
9696 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Org ) ,
97- info . IPGeolocationResult . Info . Org ) ,
97+ info . IPGeolocationResult ? . Info ? . Org ) ,
9898 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . As ) ,
99- info . IPGeolocationResult . Info . As ) ,
99+ info . IPGeolocationResult ? . Info ? . As ) ,
100100 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Asname ) ,
101- info . IPGeolocationResult . Info . Asname ) ,
101+ info . IPGeolocationResult ? . Info ? . Asname ) ,
102102 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Hosting ) ,
103- info . IPGeolocationResult . Info . Hosting ) ,
103+ info . IPGeolocationResult ? . Info ? . Hosting ) ,
104104 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Proxy ) ,
105- info . IPGeolocationResult . Info . Proxy ) ,
105+ info . IPGeolocationResult ? . Info ? . Proxy ) ,
106106 new XElement ( nameof ( TracerouteHopInfo . IPGeolocationResult . Info . Mobile ) ,
107- info . IPGeolocationResult . Info . Mobile ) ) ) ) ) ;
107+ info . IPGeolocationResult ? . Info ? . Mobile ) ) ) ) ) ;
108108
109109 document . Save ( filePath ) ;
110110 }
@@ -130,18 +130,18 @@ private static void CreateJson(IReadOnlyList<TracerouteHopInfo> collection, stri
130130 Time3 = Ping . TimeToString ( collection [ i ] . Status3 , collection [ i ] . Time3 , true ) ,
131131 IPAddress = collection [ i ] . IPAddress ? . ToString ( ) ,
132132 collection [ i ] . Hostname ,
133- collection [ i ] . IPGeolocationResult . Info . Continent ,
134- collection [ i ] . IPGeolocationResult . Info . Country ,
135- collection [ i ] . IPGeolocationResult . Info . Region ,
136- collection [ i ] . IPGeolocationResult . Info . City ,
137- collection [ i ] . IPGeolocationResult . Info . District ,
138- collection [ i ] . IPGeolocationResult . Info . Isp ,
139- collection [ i ] . IPGeolocationResult . Info . Org ,
140- collection [ i ] . IPGeolocationResult . Info . As ,
141- collection [ i ] . IPGeolocationResult . Info . Asname ,
142- collection [ i ] . IPGeolocationResult . Info . Hosting ,
143- collection [ i ] . IPGeolocationResult . Info . Proxy ,
144- collection [ i ] . IPGeolocationResult . Info . Mobile
133+ Continent = collection [ i ] . IPGeolocationResult ? . Info ? . Continent ,
134+ Country = collection [ i ] . IPGeolocationResult ? . Info ? . Country ,
135+ Region = collection [ i ] . IPGeolocationResult ? . Info ? . Region ,
136+ City = collection [ i ] . IPGeolocationResult ? . Info ? . City ,
137+ District = collection [ i ] . IPGeolocationResult ? . Info ? . District ,
138+ Isp = collection [ i ] . IPGeolocationResult ? . Info ? . Isp ,
139+ Org = collection [ i ] . IPGeolocationResult ? . Info ? . Org ,
140+ As = collection [ i ] . IPGeolocationResult ? . Info ? . As ,
141+ Asname = collection [ i ] . IPGeolocationResult ? . Info ? . Asname ,
142+ Hosting = collection [ i ] . IPGeolocationResult ? . Info ? . Hosting ,
143+ Proxy = collection [ i ] . IPGeolocationResult ? . Info ? . Proxy ,
144+ Mobile = collection [ i ] . IPGeolocationResult ? . Info ? . Mobile
145145 } ;
146146
147147 File . WriteAllText ( filePath , JsonConvert . SerializeObject ( jsonData , Formatting . Indented ) ) ;
0 commit comments