Home
User Documentation - Code85 Servers Downloads
Contents
1. if Find INVALID HANDLE VALUE cout Error Invalid File Path endl cout lt lt FindFileData cFileName lt lt endl string tempPath while FindNextFile hFind amp FindFileData 0 tempPath for int counter 0 counter MAX PATH counter if char FindFileData cFileName counter O break else cout lt lt char FindFileData cFileName counter tempPath char FindFileData cFileName counter cout lt lt endl string tempPath2 tempPath tempPath path tempPath Verify The File Is Not Telling Itself To Go Up 1 Level if isDirectory tempPath true amp amp tempPath2 numFiles countNumFiles tempPath else if tempPath2 numFiles FindClose hFind return numFiles Created By Matthew B Gately mgately code85 com Page 14 of 14 Directory Mapper Version 0 1 0 User Manual
2. Get The Number Of Files and Folders getNumFilesAndFolders filePath c str numFiles numFolders ui appProgress1 gt setText lt font colorzgreen Number Files and Folders Calculated lt font gt qApp gt processEvents htmlFile h1 Directory Information lt h1 gt htmlFile b Number of Folders lt b gt integerToString numFolders lt br gt htmlFile b Number of Files lt b gt integerToString numFiles lt br gt ui appProgress2 gt setEnabled true qApp gt processEvents Determine If You Should Map Just Folders or Files too if ui directoryOnlyRadioButton gt isChecked true mode 0 else mode 1 Write Directory Map Header To HTML if mode 0 htmlFile h1 Directory Map lt h1 gt else htmlFile h1 Directory and File Map lt h1 gt mapFilesAndFolders filePath c str mode htmlFile ui appProgress2 setText font color green gt Directory Information Mapped font qApp gt processEvents ui appProgress3 setEnabled true qApp gt processEvents htmlFile lt HTML gt writeBinaryFile outputFilePath c str htmlFile ui appProgress3 setText font color green gt HTML Written lt font gt qApp gt processEvents Vf Requested Open Report After Generation if ui openCheckBox isChecked true string openOutputFileCommand explorer outputFilePath system openOutputFileCommand c st
3. File fclose fileHandle return true 7 ERLI ei SUO ne eae ea E EEIE Read Binary File Function i lVX 7 oe y bool readBinaryFile string filePath string amp fileContents double fileSize Created By Matthew B Gately mgately code85 com Page 9 of 14 Directory Mapper Version 0 1 0 User Manual char inputBuffer fileContents FILE fileHandle fileHandle fopen filePath c_str rb if fileHandle NULL Get The File Size fileSize returnFileSize fileHandle inputBuffer new char int fileSize fread inputBuffer 1 fileSize fileHandle Copy Buffer To String for int counter 0 counter lt fileSize counter fileContents inputBuffer counter delete inputBuffer else fclose fileHandle return false fclose fileHandle return true bool writeTextFile string filePath string fileContents This Function Takes A Text String and Writes It To A File ofstream fileHandle filePath c_str if fileHandle is_open true fileHandle lt lt fileContents c_str fileHandle close else return false return true bool readTextFile string filePath string amp fileContents This Function Reads A File Into A String string line fileContents ifstream fileHandle filePath c_str if fileHandle is_open true while fileHandle eof getline fileHandle
4. Please be patient and do not attempt to close the application until it has finished processing Do to the nature of the Windows file system the calculation of the number of files and folders takes the same amount of time if only directories or directories and files are being mapped Created By Matthew B Gately mgately code85 com Page 3 of 14 Directory Mapper Version 0 1 0 User Manual Source Code directorymapper h ifndef DIRECTORYMAPPER_H define DIRECTORYMAPPER_H include lt QtGui QMainWindow gt amp tinclude ui_directorymapper h class DirectoryMapper public QMainWindow public DirectoryMapper QWidget parent 0 DirectoryMapper Q_OBJECT private slots private Ui DirectoryMapperClass ui void browseForFile void mapDirectories void aboutDialog endif DIRECTORYMAPPER_H directorymapper cpp include directorymapper h include functions h include filelO h include lt iostream gt include lt QtGUI gt using namespace std string APP_VERSION 0 1 0 DirectoryMapper DirectoryMapper QWidget parent QMainWindow parent ui setupUi this Update User Interface string title Directory Mapper APP_VERSION this gt setWindowTitle title c_str ui authorLabel setText Created By Matthew B Gately mgately code85 com Connect Signals and Slots connect ui exitButton SIGNAL clicked this SLOT close connect ui mapBu
5. endl dataContents lt ul gt return true bool getNumFilesAndFolders string path int amp numFilesReturned int amp numFoldersReturned Variable Declarations WIN32 FIND DATA FindFileData HANDLE hFind INVALID HANDLE VALUE int numFiles 0 int numFolders 0 char directoryPath MAX PATH for int counter 0 counter path length counter directoryPath counter path c_str counter directoryPath path length 0 Null Terminator After File Path if DEBUG_MODE cout lt lt DEBUG STATEMENT The Current Path Is lt lt directoryPath lt lt endl WCHAR wdPath MAX_PATH strncat directoryPath 3 for int counter 0 counter lt MAX_PATH counter wdPath counter directoryPath counter Created By Matthew B Gately mgately code85 com Page 12 of 14 Directory Mapper Version 0 1 0 User Manual hFind FindFirstFile wdPath amp FindFileData if Find INVALID HANDLE VALUE cout ERROR Invalid File Path In Count Num Files and Folders Function endl string tempPath while FindNextFile hFind amp FindFileData 0 tempPath for int counter 0 counter MAX PATH counter if char FindFileData cFileName counter 0 break else cout lt lt char FindFileData cFileName counter tempPath char FindFileData cFileName counter cout lt lt endl string tempPath2 tempPath tempPath
6. line fileContents line if fileHandle eof fileContents An fileHandle close else fileContents return false return true Created By Matthew B Gately mgately code85 com Page 10 of 14 Directory Mapper Version 0 1 0 User Manual bool isDirectory string path if access path c str 0 0 struct stat status stat path c_str amp status if status st_mode amp S IFDIR if DEBUG_MODE cout lt lt DEBUG STATEMENT The directory exists lt lt endl return true else if DEBUG MODE cout DEBUG STATEMENT The path you entered is a file endl else if DEBUG MODE cout DEBUG STATEMENT Path doesn t exist endl return false Mode is set to 0 for folders only and 1 for files too bool mapFilesAndFolders string path int mode string amp dataContents dataContents lt ul gt Variable Declarations WIN32_FIND_DATA FindFileData HANDLE hFind INVALID HANDLE VALUE int numFiles 0 int numFolders 0 char directoryPath MAX_PATH for int counter 0 counter lt path length counter directoryPath counter path c_str counter directoryPath path length 0 Null Terminator After File Path if DEBUG_MODE cout lt lt DEBUG STATEMENT The Current Path Is lt lt directoryPath lt lt endl WCHAR wdPath MAX_PATH strncat directoryPath 3 for int counter 0 count
7. Directory Mapper Version 0 1 0 Matthew B Gately Table of Contents IMNTFOCDUCKION ecc 3 Pr gr am OP Graton REN 3 System REQUIFEMIENTS sasesana eveceshicdeecke stead eta diese esaet te Deas ae anari anie iiaae 3 RUNNING the Programiroda tei ei deep UM Ugo ae EXE Regna ERE Ip Ki x Ra EEE iiA ie 3 Importarit NOt68s ce ito ec eer ree ona a tu ee eta Fa e e Eee evo ere ee ERE E rere err cree ere tere 3 Source Code cut tese ep retia ex E En eet losa Tied e rite cde 4 directoryridppDer Wiss cioe ee tn teens o to etia c ore e d yobs Re ex Pee pe ERI eSI IU Tug A gU eG UE eR Aa v ROS K REY eH ER 4 directorymappet CDD an etr tee ver ere a e t en o HER E y D e E a ui OR nan i Des eie reta 4 Furictions Header File reete eoe tee eere eee ye PARERE Eee REN XR NER XO EE RE ERR AER Ens 6 FUNCTIONS Source FIle usc tert en EROS ERROR EX an enixe x ERE E Ert cctasd lasntesuisedevatdesersesanes 7 filelQ eter etd eta ee et reve de eee av eae ERE n HDI Rees 8 HIN 8 Introduction Directory Mapper is designed to provide an easy way to generate a report detailing all folders and files in a given directory The only report format available in this version is HTML Program Operation System Requirements Directory Mapper does not need to be installed in order to run It comes with the necessary dll files and only requires Sun Java be installed As a result it can be run from a flash dr
8. ageBox about this tr About Dialog aboutDialogText c_str void DirectoryMapper mapDirectories void string htmlFile string filePath string outputFilePath QString qFilePath int mode numFiles numFolders numFiles 0 numFolders 0 mn htmlFile lt HTML gt Reset Application Progress ui appProgress1 gt setEnabled false ui appProgress2 gt setEnabled false ui appProgress3 setEnabled false ui appProgress1 setText Calculating Files and Folders ui appProgress2 setText Mapping Files and Folders ui appProgress3 setText Writing HTML File qApp processEvents ui appProgress1 setEnabled true qApp processEvents Get File Path qFilePath ui rootDirectoryLineEdit gt text QStringToString qFilePath filePath Get Output File Path qFilePath ui outputFileLineEdit gt text QStringToString qFilePath outputFilePath Verify That Path Exists f Path Does Not Exist Warn User Exit Function if isDirectory filePath c_str false Message Box Warning Created By Matthew B Gately mgately code85 com Page 5 of 14 Directory Mapper Version 0 1 0 User Manual QMessageBox about this tr File Does Not Exist Warning Root Directory Folder Does Not Exist Exit Function return if outputFilePath QMessageBox about this tr Output File Not Specified Warning Output File Path Not Specified
9. er lt MAX_PATH counter wdPath counter directoryPath counter hFind FindFirstFile wdPath amp FindFileData if Find INVALID HANDLE VALUE cout ERROR Invalid File Path In Count Num Files and Folders Function endl string tempPath while FindNextFile hFind amp FindFileData 0 tempPath for int counter 0 counter lt MAX PATH counter if char FindFileData cFileName counter O break else cout lt lt char FindFileData cFileName counter tempPath char FindFileData cFileName counter Created By Matthew B Gately mgately code85 com Page 11 of 14 Directory Mapper Version 0 1 0 User Manual cout lt lt endl string tempPath2 tempPath tempPath path VV tempPath Nerify The File Is Not Telling Itself To Go Up 1 Level if isDirectory tempPath true amp amp tempPath2 numFolders int tempNumA 0 int tempNumB 0 dataContents lt b gt lt li gt tempPath2 lt li gt lt b gt mapFilesAndFolders tempPath mode dataContents numFiles tempNumA numFolders tempNumB else if tempPath2 if mode 1 dataContents lt li gt tempPath2 lt li gt numFiles FindClose hFind if DEBUG_MODE true cout lt lt The Current Number Of Files Is numFiles lt lt endl cout lt lt The Current Number Of Folders Is lt lt numFolders lt lt
10. gt include lt windows h gt include lt fstream gt include lt io h gt For access Created By Matthew B Gately mgately code85 com Page 8 of 14 Directory Mapper Version 0 1 0 User Manual include lt sys types h gt For stat ttinclude lt sys stat h gt For stat include filelO h Global Constants bool DEBUG_MODE false Global Variables double returnFileSize FILE fileHandle double start_location ftell fileHandle if fileHandle NULL return 1 fseek fileHandle 0 SEEK_END double file_size ftell fileHandle fseek fileHandle start_location SEEK_SET return file_size Jh a a i E MN IE SERT zy Write Binary File Function i SM eic A a ei my bool writeBinaryFile string filePath string fileContents double fileSize fileContents length char outputBuffer Open File For Writing and Get File Handle FILE fileHandle fileHandle fopen filePath c str wb f File Opened Properly Write Data To It if fileHandle NULL Create The Output Buffer outputBuffer new char int fileSize Copy File Contents To Output Buffer for int counter 0 counter fileSize counter outputBuffer counter fileContents counter Write Output Buffer To File fwrite outputBuffer 1 fileSize fileHandle Delete The Output Buffer From Memory delete outputBuffer else fclose fileHandle return false Close
11. ive This current version is compiled in debug mode resulting in larger than normal dll and executable files Running the Program To launch the program double click the executable file Once the program loads you are presented with the window displayed in Figure 1 To generate the report follow these steps 1 Enterthe path of the directory to be mapped in the Root Directory textbox Enter the path for the HTML report including the report name html in the Output File textbox see the example below the textbox in Figure 1 3 Choose whether only directories or directories and files should be mapped 4 Check Open Report When Created if you want your browser to display the report after it has been generated 5 Click the Map button to start the report generation Please note that while the Application Progress will show the major stages of the report generation depending on the number of files and folders it may take a few minutes per stage Wil Directory Mapper 0 1 0 DER File Help Directory Mapper Root Directory Map Only Directories Map Files and Directories Output File Application Progress Example c DirectoryMap html C Open Report When Created Mapping Files Wing HTML Fle Created By Matthew B Gately mgately code85 com Calculating Files and Folders Figure 1 Directory Mapper Application Important Notes Folders with large numbers of files and directories may take several minutes to process
12. path tempPath Verify The File Is Not Telling Itself To Go Up 1 Level if isDirectory tempPath true amp amp tempPath2 numFolders int tempNumA 0 int tempNumB 0 getNumFilesAndFolders tempPath tempNumA tempNumB numFiles tempNumA numFolders tempNumB else if tempPath2 numFiles FindClose hFind if DEBUG_MODE true cout lt lt The Current Number Of Files Is lt lt numFiles lt lt endl cout lt lt The Current Number Of Folders Is lt lt numFolders lt lt endl numFilesReturned numFiles numFoldersReturned numFolders return true int countNumFiles string path Variable Declarations WIN32_FIND_DATA FindFileData HANDLE hFind INVALID HANDLE VALUE int numFiles 0 int lastLoc 0 char directoryPath MAX_PATH for int counter 0 counter lt path length counter directoryPath counter path c_str counter lastLoc counter lastLoc directoryPath lastLoc 0 if DEBUG_MODE Created By Matthew B Gately mgately code85 com Page 13 of 14 Directory Mapper Version 0 1 0 User Manual cout lt lt DEBUG STATEMENT The Current Path Is lt lt directoryPath lt lt endl WCHAR wdPath MAX_PATH strncat directoryPath 3 for int counter 0 counter lt MAX_PATH counter wdPath counter directoryPath counter hFind FindFirstFile wdPath amp FindFileData
13. r Functions Header File ttifndef FUNCTIONS H define FUNCTIONS H include lt string gt amp include lt QtGui QApplication gt using namespace std Created By Matthew B Gately mgately code85 com Page 6 of 14 Directory Mapper Version 0 1 0 User Manual Function Prototypes void QStringToString QString original string amp final int StringTolnteger string original int charToInt char character string integerToString int value string toHex unsigned char input endif FUNCTIONS H Functions Source File include functions h amp include sstream Needed For Integer To String Conversion amp tinclude lt string gt include lt QtGui QApplication gt include lt cmath gt using namespace std void QStringToString QString original string amp final final for int counter 0 counter lt original length counter final original counter toAscii int StringTolnteger string original int size original size int value 0 for int counter 0 counter lt size counter value charTolnt original counter int pow double 10 double size counter 1 return value int charToInt char character switch character case 0 return 0 case 1 return 1 case 2 return 2 case 3 return 3 case 4 return 4 case 5 return 5 case 6 return 6 case 7 return 7 case 8 return 8 case 9
14. return 9 default return 1 return 1 Created By Matthew B Gately mgately 2code85 com Page 7 of 14 Directory Mapper Version 0 1 0 User Manual string integerToString int value ostringstream o o value return o str string toHex unsigned char input string output char buffer 2 char pbuffer buffer itoa input pbuffer 16 output buffer itoa function will not put a leading O if the hex code starts with a zero Check to see if a digit is missing if so add a O if output length 1 output 0 output return output string intToHex unsigned int input string output char buffer 16 char pbuffer buffer itoa input pbuffer 16 output buffer return output fileIO h ttifndef FILEIO H define FILEIO H include lt string h gt using namespace std double returnFileSize FILE myFile bool readBinaryFile string filePath string amp fileContents bool writeBinaryFile string filePath string fileContents bool writeTextFile string filePath string fileContents bool readTextFile string filePath string amp fileContents int countNumFiles string path bool getNumFilesAndFolders string path int amp numFilesReturned int amp numFoldersReturned bool mapFilesAndFolders string path int mode string amp dataContents bool isDirectory string path endif FILEIO H fileIO cpp include lt iostream gt include lt string h
15. tton SIGNAL clicked this SLOT mapDirectories connect ui make1FileButton SIGNAL clicked this SLOT make1File Menu Bar Signals and Slots connect ui actionExit SIGNAL triggered this SLOT close File gt Exit connect ui actionAbout SIGNAL triggered this SLOT aboutDialog Help gt About Set Status Tips These Show In The Status Bar When Mouse Is Hovered ui actionExit setStatusTip tr Exit This Application File gt Exit Created By Matthew B Gately mgately code85 com Page 4 of 14 Directory Mapper Version 0 1 0 User Manual ui directoryOnlyRadioButton gt setChecked true Update Application Progress Display ui appProgress1 gt setEnabled false ui appProgress2 setEnabled false ui appProgress3 setEnabled false ui appProgress1 gt setText Calculating Files and Folders ui appProgress2 setText Mapping Files and Folders ui appProgress3 setText Writing HTML File DirectoryMapper DirectoryMapper void DirectoryMapper aboutDialog void Create The About Dialog Text string aboutDialogText lt h1 gt Directory Mapper APP VERSION lt h1 gt aboutDialogText lt p gt This program indexes the selected directory and creates aboutDialogText an HTML file displaying all folders and files lt p gt aboutDialogText p Created By Matthew B Gately mgately code85 com lt p gt Display The About Dialog QMess
Download Pdf Manuals
Related Search
Related Contents
Scan Station 500 e Scan Station 520EX 900NG_6_TrainAvant-D.. Les Ménines de Velázquez : l`unité retrouvée ? - ORBi Service Manual TSG 601 Serial Digital Generator - NSCA TRA-CAL AOR MANUALE UTENTE SR2000 declornet Hyundai VVUON Q400 User's Manual Vitalgan P - vitafixol Hubbell 670-801-UL User's Manual Copyright © All rights reserved.
Failed to retrieve file