示例#1
0
 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;
 }
示例#2
0
        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]));
            }
        }
示例#3
0
        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());
        }
示例#4
0
        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);
        }
示例#5
0
 internal static long GetSize(ImageRecord record, long retval)
 {
     foreach (ImageRecord r in record.SubItems)
     {
         retval += r.Size;
     }
     return retval;
 }
示例#6
0
 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;
 }