HJ PDF in C#

Article Description

This program allows you to download all Italian Hacker Journal issues into PDF files for free. I've written many  comments within the code, but all in Italian. However I'll try to explain now how it works. First of all my program use three class: SfogliaCartelle.cs, ScaricaFile.cs and frmMain.cs.

SfogliaCartelle.cs

This class display the BrowseForFolder form using the new architecture of .NET. It's very simple to use it, you have only to initialise this class using

clsSfogliaCartelle miaFinestra = new clsSfogliaCartelle();

then you have to call the "Inizializza" routine to create a new FolderNameEditor.FolderBrowser object 

miaFinestra.Inizializza();

and finally you can retrieve the path that the user have selected.

myPath = miaFinestra.SfogliaCartelle("select a path!");

very simple, isn't ?

ScaricaFile.cs

This class is about to download all the pages (pdf files) of an issue of the Hacker Journal magazine from Internet using the System.Net namespace with the WebClient object. This class have two properties: NumeroHJ (issue of HJ to download) and PercorsoFile (path where files will be saved). Then there is the "miaLabel" label, I set this object so within the class I can send message to the user using the label in the form. Try to read the code, it's simple, so you'll learn all its secrets!

frmMain.cs

This is the main class with the frmMain form. It creates a new thread when you'll start a new download. With the "cmdAnnulla" button you can abort the downloading thread using 

mioThread.Abort(); and mioThread.Join();

but first you have to verify that your thread is running: 

if (mioThread.ThreadState == ThreadState.Running)
{...}

Images 

There is an image of a screen shot. "image.jpg"

HjPdfImg.jpg

Up Next
    Ebook Download
    View all
    Learn
    View all