/// <summary> /// Get the file list under a node /// </summary> /// <param name="record">File/Directory Record</param> /// <param name="list">File list (use <see cref="BundleSortComparer"/> when reading)</param> /// <param name="regex">Regular Expression for filtering files by their path</param> public static void RecursiveFileList(RecordTreeNode record, ICollection <IFileRecord> list, string regex = null) { if (record is IFileRecord fr) { if (regex == null || Regex.IsMatch(record.GetPath(), regex)) { list.Add(fr); } } else { foreach (var f in record.Children) { RecursiveFileList(f, list, regex); } } }
/// <summary> /// Get the file list under a node to export/replace /// </summary> /// <param name="record">File/Directory Record to export</param> /// <param name="path">Path to save</param> /// <param name="list">File list (use <see cref="BundleSortComparer"/> when reading)</param> /// <param name="export">True for export False for replace</param> /// <param name="regex">Regular Expression for filtering files by their path</param> public static void RecursiveFileList(RecordTreeNode record, string path, ICollection <KeyValuePair <IFileRecord, string> > list, bool export, string regex = null) { if (record is IFileRecord fr) { if ((export || File.Exists(path)) && (regex == null || Regex.IsMatch(record.GetPath(), regex))) { list.Add(new(fr, path)); } } else { foreach (var f in record.Children) { RecursiveFileList(f, path + "\\" + f.Name, list, export, regex); } } }