public void FileInfoCollection_Add_md5sum() { FileInfoCollection files = new FileInfoCollection(); files.Add(new FileInfo(@"Test File\md5sum Test document.txt")); files.Add(new FileInfo(@"Test File\md5sum Test document2.txt")); files.WaitMd5(); Assert.AreEqual("2AAAD2B38E77F4F0E2045CD118116F80", files[0].md5sum()); Assert.AreEqual("2AAAD2B38E77F4F0E2045CD118116F80", files[1].md5sum()); }
async public static Task <FileInfoCollection> GetFileList() { FileInfoCollection fileInfos = new FileInfoCollection(); try { DataTable table = await MySqlDB.GetDataTableAsync(conStr : _conStr, query : SELECT_FILE_LIST).ConfigureAwait(false); if (table.Rows.Count > 0) { foreach (DataRow row in table.Rows) { uint id = ConvertUtil.StringToUint(row[ColumnNames.ID].ToString()); string fileName = row[ColumnNames.NAME].ToString(); string fileType = row[ColumnNames.TYPE].ToString(); fileInfos.Add(new FileInfo(id: id, fileName: fileName, fileType: fileType)); } } } catch (Exception) { throw; } return(fileInfos); }
private void GetFileTreeNode(TreeNode nodeparent, FileInfoCollection fc) { for (int i = 0; i < nodeparent.Nodes.Count; i++) { TreeNode node = nodeparent.Nodes[i]; if (node.Nodes.Count > 0) { GetFileTreeNode(node, fc); } else if (node.ImageIndex == 1 && node.Checked)//CheckedFile { System.IO.FileInfo fi = new System.IO.FileInfo(node.Name); FileInfo finew = new FileInfo(fi); if (node.Tag != null) { finew.OverWritable = (bool)node.Tag; } fc.Add(finew.ID, finew); } } }