From 0e0464f7e83240711259cb4acf9d1e1d9d0e7f64 Mon Sep 17 00:00:00 2001 From: goingfine Date: Tue, 25 Apr 2023 17:36:35 +0330 Subject: [PATCH] no auto skip in prev result scan mode --- windows/Classes/ScanEngine.cs | 6 ++++++ windows/frmMain.Designer.cs | 15 ++++++++------- windows/frmMain.cs | 11 +++++++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/windows/Classes/ScanEngine.cs b/windows/Classes/ScanEngine.cs index b08d929a..29da03d8 100644 --- a/windows/Classes/ScanEngine.cs +++ b/windows/Classes/ScanEngine.cs @@ -41,6 +41,7 @@ internal class ScanEngine private int skipMinPercent; public bool isDiagnosing = false; public bool isRandomScan = false; + private ScanType scanType; public ScanEngine() { @@ -51,6 +52,7 @@ public ScanEngine() public bool resume(ScanType scanType = ScanType.SCAN_CLOUDFLARE_IPS) { + this.scanType = scanType; if (progressInfo.scanStatus != ScanStatus.PAUSED) return false; @@ -61,6 +63,7 @@ public bool resume(ScanType scanType = ScanType.SCAN_CLOUDFLARE_IPS) public bool start(ScanType scanType = ScanType.SCAN_CLOUDFLARE_IPS, int lastIndex = 0) { + this.scanType = scanType; progressInfo.stopRequested = false; progressInfo.pauseRequested = false; @@ -330,6 +333,9 @@ private void monitorExceptions(CheckIPWorking checker) private void checkForAutoSkips() { + // no skip in prev result scan mode + if (scanType == ScanType.SCAN_IN_PERV_RESULTS) + return; // skip after 3 minute if (skipAfterAWhileEnabled) diff --git a/windows/frmMain.Designer.cs b/windows/frmMain.Designer.cs index d77e259a..5e7f4bb2 100644 --- a/windows/frmMain.Designer.cs +++ b/windows/frmMain.Designer.cs @@ -402,7 +402,7 @@ private void InitializeComponent() comboCheckType.Margin = new Padding(7, 0, 1, 0); comboCheckType.Name = "comboCheckType"; comboCheckType.RightToLeft = RightToLeft.No; - comboCheckType.Size = new Size(130, 23); + comboCheckType.Size = new Size(138, 23); comboCheckType.ToolTipText = "Scan Type"; // // comboUpTargetSpeed @@ -465,7 +465,7 @@ private void InitializeComponent() lblDebugMode.BackColor = SystemColors.Control; lblDebugMode.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); lblDebugMode.ForeColor = Color.Red; - lblDebugMode.Location = new Point(374, 92); + lblDebugMode.Location = new Point(289, 92); lblDebugMode.Name = "lblDebugMode"; lblDebugMode.Size = new Size(143, 15); lblDebugMode.TabIndex = 13; @@ -478,9 +478,9 @@ private void InitializeComponent() btnCopyFastestIP.AccessibleDescription = "A button for copy fastest found IP address into the clipboard"; btnCopyFastestIP.AccessibleName = "Copy fastest IP address"; btnCopyFastestIP.Anchor = AnchorStyles.Top | AnchorStyles.Right; - btnCopyFastestIP.Location = new Point(729, 87); + btnCopyFastestIP.Location = new Point(683, 87); btnCopyFastestIP.Name = "btnCopyFastestIP"; - btnCopyFastestIP.Size = new Size(103, 25); + btnCopyFastestIP.Size = new Size(149, 25); btnCopyFastestIP.TabIndex = 2; btnCopyFastestIP.Text = "Copy fastest IP"; btnCopyFastestIP.UseVisualStyleBackColor = true; @@ -495,11 +495,11 @@ private void InitializeComponent() txtFastestIP.BackColor = Color.White; txtFastestIP.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); txtFastestIP.ForeColor = Color.Green; - txtFastestIP.Location = new Point(539, 89); + txtFastestIP.Location = new Point(438, 89); txtFastestIP.Name = "txtFastestIP"; txtFastestIP.PlaceholderText = "Fastest IP"; txtFastestIP.ReadOnly = true; - txtFastestIP.Size = new Size(183, 23); + txtFastestIP.Size = new Size(239, 23); txtFastestIP.TabIndex = 3; // // lblTotalWorkingIPs @@ -533,7 +533,7 @@ private void InitializeComponent() comboResults.FormattingEnabled = true; comboResults.Location = new Point(140, 10); comboResults.Name = "comboResults"; - comboResults.Size = new Size(220, 23); + comboResults.Size = new Size(225, 23); comboResults.TabIndex = 5; toolTip1.SetToolTip(comboResults, "List of last scan results"); comboResults.SelectedIndexChanged += comboResults_SelectedIndexChanged; @@ -1072,6 +1072,7 @@ private void InitializeComponent() btnFrontingErrors.ForeColor = SystemColors.ControlText; btnFrontingErrors.Image = (Image)resources.GetObject("btnFrontingErrors.Image"); btnFrontingErrors.ImageTransparentColor = Color.Magenta; + btnFrontingErrors.Margin = new Padding(10, 1, 0, 2); btnFrontingErrors.Name = "btnFrontingErrors"; btnFrontingErrors.Size = new Size(123, 30); btnFrontingErrors.Text = "Fronting errors: 0%"; diff --git a/windows/frmMain.cs b/windows/frmMain.cs index f90998ce..d345fa95 100644 --- a/windows/frmMain.cs +++ b/windows/frmMain.cs @@ -380,6 +380,7 @@ private void updateUIControls(bool isStarting, ScanType scanType = ScanType.SCAN comboUpTargetSpeed.Enabled = false; comboDLTargetSpeed.Enabled = false; comboConfigs.Enabled = false; + comboCheckType.Enabled = false; timerProgress.Enabled = true; //btnSkipCurRange.Enabled = true; comboResults.Enabled = false; @@ -403,6 +404,7 @@ private void updateUIControls(bool isStarting, ScanType scanType = ScanType.SCAN comboDLTargetSpeed.Enabled = true; comboUpTargetSpeed.Enabled = true; comboConfigs.Enabled = true; + comboCheckType.Enabled = true; if (!isScanPaused()) { @@ -474,7 +476,7 @@ private void updateConrtolsProgress(bool forceUpdate = false) pInf.frontingExceptions.setControlColorStyles(btnFrontingErrors); pInf.downloadUploadExceptions.setControlColorStyles(btnDownloadErrors); btnFrontingErrors.Text = $"Fronting Errors : {pInf.frontingExceptions.getErrorRate():f1}%"; - btnDownloadErrors.Text = $"Download Errors : {pInf.downloadUploadExceptions.getErrorRate():f1}%"; + btnDownloadErrors.Text = $"DL && UP Errors : {pInf.downloadUploadExceptions.getErrorRate():f1}%"; btnFrontingErrors.ToolTipText = $"Total errors: {pInf.downloadUploadExceptions.getTotalErros()}"; btnDownloadErrors.ToolTipText = $"Total errors: {pInf.frontingExceptions.getTotalErros()}"; } @@ -1454,7 +1456,7 @@ private void updateClientConfigCloudflareSubnetsToolStripMenuItem_Click(object s private void testAvgSingleIP(string IPAddress, int rounds, ScanSpeed dlSpeed, ScanSpeed upSpeed, CustomConfigInfo v2rayConfig, int downloadTimeout, CheckType checkType = CheckType.DOWNLOAD) { - addTextLog($"Testing {IPAddress} for {rounds} rounds, Scan Type: {checkType}..."); + addTextLog($"{Environment.NewLine}Testing {IPAddress} for {rounds} round(s), Scan type: {checkType}..."); int totalSuccessCount = 0, totalFailedCount = 0; long bestDLDuration = 99999, bestUPDuration = 9999, bestFrontingDuration = 99999, totalDLDuration = 0, totalUPDuration = 0, totalFrontingDuration = 0; @@ -1495,9 +1497,10 @@ private void testAvgSingleIP(string IPAddress, int rounds, ScanSpeed dlSpeed, Sc averageUPDuration = totalUPDuration / totalSuccessCount; averageFrontingDuration = totalFrontingDuration / totalSuccessCount; - string results = $"{IPAddress} => {totalSuccessCount}/{rounds} was successful." + Environment.NewLine + + // print results + string results = $"{IPAddress} => {totalSuccessCount}/{rounds} test(s) was successful." + Environment.NewLine + (bestDLDuration > 0 ? $"\tDownload: Best {bestDLDuration:n0} ms, Average: {averageDLDuration:n0} ms" + Environment.NewLine : "") + - (bestUPDuration> 0 ? $"\tUpload : Best {bestUPDuration:n0} ms, Average: {averageUPDuration:n0} ms" + Environment.NewLine : "") + + (bestUPDuration > 0 ? $"\tUpload : Best {bestUPDuration:n0} ms, Average: {averageUPDuration:n0} ms" + Environment.NewLine : "") + $"\tFronting: Best {bestFrontingDuration:n0} ms, Average: {averageFrontingDuration:n0} ms" + Environment.NewLine; addTextLog(results);