public getListUtils(string pathname, string[] aExtension, ProgressBar progressBar, Control control) { _pathname = pathname; _extensions = new List <string>(aExtension); _assignedProgressBar = progressBar; BookList = new TBookCollection(); CurrentFolder = ""; _assignedControl = control; }
public TLibrary() { StorageName = ""; Name = ""; Description = ""; //Groups = new TGroupCollection(); Books = new TBookCollection(); RootFolder = ""; }
public TBookCollection(TBookCollection books) { if (books != null) { foreach (TBook BookItem in books) { this.Add(new TBook(BookItem)); } } }
public TLibrary(TLibrary library) : this() { Name = library.Name; StorageName = library.StorageName; Description = library.Description; //Groups = new TGroupCollection(library.Groups); Books = new TBookCollection(library.Books); RootFolder = library.RootFolder; }
private TBookCollection _getFiles(DirectoryInfo oDirectory) { TBookCollection oRetVal = new TBookCollection(); foreach (string sExtension in _extensions) { foreach (FileInfo oFileInfo in oDirectory.GetFiles("*." + sExtension)) { oRetVal.Add(new TBook(oFileInfo.Name, Path.GetDirectoryName(oDirectory.FullName), TBook.BookTypeEnum.Pdf)); } } return(oRetVal); }
private TBookCollection _getSubDirs(string pathname, BackgroundWorker worker, double percentage, int level) { TBookCollection CurrentBookList = new TBookCollection(); DirectoryInfo oDirInfo = new DirectoryInfo(pathname); foreach (DirectoryInfo oSubDirectoryInfo in oDirInfo.GetDirectories()) { CurrentFolder = oSubDirectoryInfo.FullName; worker.ReportProgress((int)percentage, oSubDirectoryInfo.FullName); try { if (oSubDirectoryInfo.Attributes != FileAttributes.System && oSubDirectoryInfo.GetDirectories().Length > 0) { Trace.WriteLine(oSubDirectoryInfo.FullName, "trace"); CurrentBookList.AddRange(_getSubDirs(oSubDirectoryInfo.FullName, worker, percentage, level + 1)); } if (oSubDirectoryInfo.Attributes != FileAttributes.System && oSubDirectoryInfo.GetFiles().Length > 0) { if ((oSubDirectoryInfo.GetFiles("thumbs.db", SearchOption.TopDirectoryOnly).Length == 1) && (oSubDirectoryInfo.GetFiles().Length == 1)) { // skip folder } else { CurrentBookList.Add(new TBook(oSubDirectoryInfo.Name, Path.GetDirectoryName(oSubDirectoryInfo.FullName))); CurrentBookList.AddRange(_getFiles(oSubDirectoryInfo)); } } if (level == 0) { percentage++; } } catch (Exception ex) { Trace.WriteLine(string.Format("Error : {0}", ex.Message)); } } return(CurrentBookList); }
public TGroup(TGroup group) { Name = group._Name; Pathname = group.Pathname; Books = new TBookCollection(group.Books); }
public TGroup() { Name = ""; Pathname = ""; Books = new TBookCollection(); }
public TGroup(string name, string path, TBookCollection books) : this(name, path) { Books = books; }