-
Notifications
You must be signed in to change notification settings - Fork 5
/
Scan.aspx.cs
37 lines (32 loc) · 1.44 KB
/
Scan.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Configuration;
namespace Bitchecker
{
public partial class Scan : System.Web.UI.Page
{
public Scan() { }
protected void btnScan_Click(object sender, EventArgs e)
{
frmMain.Visible = false;
bool rogue = false;
var bits = new BitArray(ctlFile.FileBytes);
foreach (bool bit in bits)
if (bit != true && bit != false) rogue = true;
litScanResults.Text += "<p>Your file has been successfully scanned.</p>";
litScanResults.Text += "<p><b>Content Type: " + ctlFile.PostedFile.ContentType + "</b></p>";
litScanResults.Text += "<p><b>File Size: " + ctlFile.PostedFile.ContentLength.ToString() + "</b></p>";
if (bool.Parse(ConfigurationManager.AppSettings["ShowExperimentalFeatures"]))
litScanResults.Text += "<p><b>Bits in File: " + bits.Count + "</b></p>";
litScanResults.Text += "<p> </p>";
if (rogue)
litScanResults.Text += "<p>At least one rogue bit was detected! Use the Professional Edition (coming soon) to detect and correct this error.</p>";
else
litScanResults.Text += "<p>Congratulations! No rogue bits were found.";
}
}
}