增加结果输出到文件
This commit is contained in:
		
							parent
							
								
									b39e50b53a
								
							
						
					
					
						commit
						0462c16a0a
					
				@ -1,5 +1,6 @@
 | 
				
			|||||||
using Microsoft.Extensions.Logging;
 | 
					using Microsoft.Extensions.Logging;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.IO;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
using System.Threading;
 | 
					using System.Threading;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
@ -35,9 +36,14 @@ namespace FastGithub
 | 
				
			|||||||
                    .Where(item => item.HttpElapsed != null)
 | 
					                    .Where(item => item.HttpElapsed != null)
 | 
				
			||||||
                    .OrderBy(item => item.HttpElapsed);
 | 
					                    .OrderBy(item => item.HttpElapsed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                using var fileStream = File.OpenWrite("github.txt");
 | 
				
			||||||
 | 
					                using var fileWriter = new StreamWriter(fileStream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                foreach (var context in sortedContexts)
 | 
					                foreach (var context in sortedContexts)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    this.logger.LogInformation($"{context.Address} {context.HttpElapsed}");
 | 
					                    var content = $"{context.Address}\t{context.HttpElapsed}";
 | 
				
			||||||
 | 
					                    this.logger.LogInformation(content);
 | 
				
			||||||
 | 
					                    await fileWriter.WriteLineAsync(content);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@
 | 
				
			|||||||
  "Github": {
 | 
					  "Github": {
 | 
				
			||||||
    "MetaUri": "https://gitee.com/jiulang/fast-github/raw/master/FastGithub/meta.json", // ip资源文件uri
 | 
					    "MetaUri": "https://gitee.com/jiulang/fast-github/raw/master/FastGithub/meta.json", // ip资源文件uri
 | 
				
			||||||
    "Concurrent": 50, // 并发作业数,此项需要重启才生效
 | 
					    "Concurrent": 50, // 并发作业数,此项需要重启才生效
 | 
				
			||||||
    "PortScanTimeout": "00:00:01", // 端口扫描超时时间
 | 
					    "PortScanTimeout": "00:00:00.500", // 端口扫描超时时间
 | 
				
			||||||
    "HttpTestTimeout": "00:00:05" // http测试超时时间
 | 
					    "HttpTestTimeout": "00:00:05" // http测试超时时间
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "Logging": {
 | 
					  "Logging": {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user