diff --git a/fast cf ip scanner/Services/IPService.cs b/fast cf ip scanner/Services/IPService.cs index b5184df..67405a3 100644 --- a/fast cf ip scanner/Services/IPService.cs +++ b/fast cf ip scanner/Services/IPService.cs @@ -16,10 +16,10 @@ public IPService(FastCFIPScannerDatabase db) _db = db; } #region Test Ips - public async Task> GetIpValid(string[] ips, IpOptionModel ipOptions, string protcol) + public async Task> GetIpValid(string[] ips, IpOptionModel ipOptions, string protocol) { var validIps = new List(); - switch (protcol) + switch (protocol) { case "Http test (recommended)": validIps = await GetValidIPWithHttpTest(ips, ipOptions); @@ -137,7 +137,7 @@ async Task TestConnectionAsync(string ip) { var ports = new List(); var stopwatch = new Stopwatch(); - var totolTimeOut = 0; + var totalTimeOut = 0; var totalPing = 0; for (int i = 0; i < ipOptions.CountOfRepeatTestForEachIp; i++) { @@ -163,13 +163,13 @@ async Task TestConnectionAsync(string ip) } else { - totolTimeOut++; + totalTimeOut++; } } } catch { - totolTimeOut++; + totalTimeOut++; } } } @@ -183,7 +183,7 @@ async Task TestConnectionAsync(string ip) IP = ip, Ping = ping, Ports = string.Join(",", ports), - CountOfTimeout = totolTimeOut + CountOfTimeout = totalTimeOut }); } } @@ -214,7 +214,7 @@ public async Task> GetValidIPWithUDPTest(string[] ips, int maxPing { var validIp = new ConcurrentBag(); var randips = GetRandomIp(ips); - foreach (var ipAddresse in randips) + foreach (var ipAddress in randips) { var t = new Task(() => { @@ -224,7 +224,7 @@ public async Task> GetValidIPWithUDPTest(string[] ips, int maxPing var client = new UdpClient(); stopwatch.Start(); - client.Connect(ipAddresse, 443); + client.Connect(ipAddress, 443); stopwatch.Stop(); var ping = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds); @@ -233,7 +233,7 @@ public async Task> GetValidIPWithUDPTest(string[] ips, int maxPing { validIp.Add(new IPModel { - IP = ipAddresse.ToString(), + IP = ipAddress.ToString(), Ping = ping, }); } @@ -370,11 +370,11 @@ public List GetRandomIp(string[] ips, int ipCount = 20, int ipRangeCount } var randomIps = new List(); var countOfEachRange = ipCount / ipRangeCount; - foreach (var iprange in randomIpRange) + foreach (var ipRange in randomIpRange) { for (int i = 1; i < countOfEachRange; i++) { - randomIps.Add(iprange + random.Next(255)); + randomIps.Add(ipRange + random.Next(255)); } } return randomIps;