Hello so my school has records that i needed to access but i forgot my user id, so i made a program that would download any possible PDF and search them for my name. If it found mine it would alert me however when the program was down and said "We found a file containing Sean File Name is : xxxxxx.pdf" The actual number part would be off by however much the for loop is incremented by even though this was on a separate method! BTW School name will be starred out!
*B y the way! In Search() I used i-10 as a temporary fix, but I was thinking their must be a better way *
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using BitMiracle.Docotic.Pdf; // pdf parser / viewer
using System.IO;
using System.Threading;
namespace XXXXXXX_TEMP
{
class Program
{
static void Main(string[] args)
{
Program p1 = new Program();
p1.Start();
}
private void Start()
{
WebClient wc = new WebClient();
for (int i = 200000; i < 999999999; i = i + 10)
{
try
{
wc.DownloadFile("XXXXXXXXXXXXXXXXXXXXXX/" + i + ".pdf", i + ".pdf");
}
catch (WebException) {
continue;
}
PdfDocument pdf = new PdfDocument(i + ".pdf");
Thread a = new Thread(() => Search(i, pdf));
a.Start();
if (i == 999999) {
Console.ReadLine();
}
}
}
private void Search(int i, PdfDocument pdf)
{
i = i - 10;
String html = pdf.GetText();
if (html.ToLower().Contains("sean"))
{
Console.WriteLine("Found File Containing Sean! File Name Is : " + i + ".pdf\n");
Console.WriteLine("PDF Text = " + html);
}
}
}
}