public virtual void Clear() { _SubItems.Clear(); _dateTime = new DateTime(); _Parent = null; obj = null; _name = string.Empty; _path = string.Empty; _location = 0; _size = 0; _isDirectory = false; }
public ImageRecord GetItemPath(string relativePath) { string[] segments = relativePath.Split(new char[] { '/', '\\' }, 2, StringSplitOptions.RemoveEmptyEntries); ImageRecord child = GetItem(segments[0]); if (segments.Length == 1) { return(child); } else { return(child.GetItemPath(segments[1])); } }
private string GetPath() { List <string> lst = new List <string>(); ImageRecord cur = this; while (cur.Parent != null) { lst.Add(cur.Parent.Name); cur = cur.Parent; } StringBuilder sb = new StringBuilder(); for (int i = lst.Count - 1; i > -1; i--) { sb.Append(lst[i]); sb.Append(System.IO.Path.DirectorySeparatorChar); } return(sb.ToString()); }
public ImageRecord GetItemRecursive(string name) { foreach (ImageRecord item in _rootDirectory.SubItems) { if (item.Name == name) { return(item); } else { ImageRecord recurse = item.GetItemRecursive(name); if (recurse != null) { return(recurse); } } } return(null); }
internal static long GetSize(ImageRecord record, long retval) { foreach (ImageRecord r in record.SubItems) { retval += r.Size; } return retval; }