Example #1
0
        protected void BuildParents()
        {
            var x = 0;

            string relPath;

            while (LocalEntries.TryGetValue("parent." + x, out relPath))
            {
                if (_root != null && !String.IsNullOrEmpty(_root.FullName) && !String.IsNullOrEmpty(relPath))
                {
                    var rootDir = Path.GetDirectoryName(_root.FullName);
                    if (!String.IsNullOrEmpty(rootDir))
                    {
                        var absPath = Path.GetFullPath(Path.Combine(rootDir, relPath));
                        var fi      = new FileInfo(absPath);
                        if (fi.Exists)
                        {
                            var parent = new FileDictionaryTree(fi);
                            Parents.Add(parent);
                        }
                    }
                }
                x++; // increment for the next parent
            }
        }
Example #2
0
 /// <summary>
 /// This copy constructory creates a new instance that is identical to another instance,
 /// but with its own identity. That is, this is a deep-clone of the original (including
 /// recursive cloning of parents).
 /// Note that the new instance has the same "Name" and "FullName", even though its object identity is unique.
 /// </summary>
 /// <param name="other">The instance to copy.</param>
 public FileDictionaryTree(FileDictionaryTree other)
     : this(other.Name, other.FullName, other.LocalEntries, other.LocalDefaults)
 {
     foreach (var parent in other.Parents)
     {
         Parents.Add(new FileDictionaryTree(parent));
     }
 }