/// <summary> Gets a collection of file objects for the files which /// have a certain user defined field </summary> /// <param name="UserDefinedField"> Field to return the collection of matching files for </param> /// <returns> Collection of files </returns> public DirectoryCrawler_FileCollection Get_Files(object UserDefinedField) { // Create the return collection DirectoryCrawler_FileCollection returnVal = new DirectoryCrawler_FileCollection(); // Iterate through all the files and add only those that match foreach (DirectoryCrawler_File thisFile in allFiles) { // If this user defined field matches, add it to this collection if (thisFile.UserDefined.Equals(UserDefinedField.ToString())) { returnVal.Add(thisFile); } } // Return the created collection return(returnVal); }
/// <summary> Constructor for the DirectoryCrawler class which iterates through a directory and /// creates an ouput with all the files. </summary> /// <param name="startingDirectory"> Starting point for directory iteration </param> /// <example> To see examples, look at the examples listed under the main <see cref="DirectoryCrawler"/> class. </example> public DirectoryCrawler(string startingDirectory) { // Save the parameter this.startingDirectory = startingDirectory; startingDirectoryList = ""; userControlledField = ""; // Setup the DataSet file createDataSet(); // Set the initial value for the last directory key to 0 lastDirKey = 0; // Set the File and Object collection to a new one allFiles = new DirectoryCrawler_FileCollection(); allFields = new DirectoryCrawler_UserDefinedCollection(); customObject = new ArrayList(); }
/// <summary> Constructor for the DirectoryCrawler class which iterates through a directory and /// creates an ouput with all the files. </summary> /// <param name="formatIdentifier"> Value which tells the format type. 0-HTML, 1-Text, 2-XML, 3-Access, 4-Display </param> /// <param name="OutputFile"> File and path for the output file. (minus extension) </param> /// <param name="startingDirectory"> Starting point for directory iteration </param> /// <example> To see examples, look at the examples listed under the main <see cref="DirectoryCrawler"/> class. </example> public DirectoryCrawler(int formatIdentifier, string OutputFile, string startingDirectory) { // Save the parameters this.formatIdentifier = formatIdentifier; this.startingDirectory = startingDirectory; startingDirectoryList = ""; // Setup the DataSet file createDataSet(); // Set the initial value for the last directory key to 0 and user controlled field lastDirKey = 0; userControlledField = ""; // Set the File and Object collection to a new one allFiles = new DirectoryCrawler_FileCollection(); allFields = new DirectoryCrawler_UserDefinedCollection(); customObject = new ArrayList(); // Iterate through the source drive this.Iterate(); // Depening on the requested output type, perform output if (formatIdentifier == 0) { CreateHTML(OutputFile); } if (formatIdentifier == 1) { CreateText(OutputFile); } if (formatIdentifier == 2) { CreateXML(OutputFile); } if (formatIdentifier == 3) { CreateAccess(OutputFile); } }
/// <summary> Constructore creates a new DirectoryCrawler_FileEnumerator to iterate through /// the DirectoryCrawler_FileCollection. </summary> /// <param name="includedFileCollection"> <see cref="DirectoryCrawler_FileCollection"/> to iterate through </param> public DirectoryCrawler_FileEnumerator(DirectoryCrawler_FileCollection includedFileCollection) { includedFiles = includedFileCollection; }