Skip to content

Commit

Permalink
no auto skip in prev result scan mode
Browse files Browse the repository at this point in the history
  • Loading branch information
goingfine committed Apr 25, 2023
1 parent b4da940 commit 0e0464f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
6 changes: 6 additions & 0 deletions windows/Classes/ScanEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ internal class ScanEngine
private int skipMinPercent;
public bool isDiagnosing = false;
public bool isRandomScan = false;
private ScanType scanType;

public ScanEngine()
{
Expand All @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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)
Expand Down
15 changes: 8 additions & 7 deletions windows/frmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions windows/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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())
{
Expand Down Expand Up @@ -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()}";
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 0e0464f

Please sign in to comment.