Exemple #1
0
 public DirectoryNode this[string directory]
 {
     get
     {
         return(Childrens.ToList().First(node => node.Directory == directory));
     }
 }
Exemple #2
0
        public IEnumerable <string> GetAllChildrenPaths()
        {
            yield return(this.ToString());

            foreach (var directoryNode in Childrens.ToList())
            {
                foreach (var allChildrenPath in directoryNode.GetAllChildrenPaths())
                {
                    yield return(allChildrenPath);
                }
            }
        }
Exemple #3
0
        public void AddChildrenComment(Comment children)
        {
            if (Childrens.Contains(children))
            {
                throw new InvalidOperationException("Duplicated comment");
            }

            if (children.Equals(this))
            {
                throw new InvalidOperationException("Looped comment");
            }

            children.Parent = this;
            var newChildrens = Childrens.ToList();

            newChildrens.Add(children);
            Childrens = newChildrens;
        }
Exemple #4
0
 protected void ClearChildrens()
 {
     if (!Childrens.Any())
     {
         return;
     }
     if (!HasDummyChild)
     {
         UiServices.SetBusyState();
         foreach (var c in Childrens.ToList())
         {
             c.Dispose();
         }
         if (Event.SubEventsCount > 0)
         {
             Childrens.Add(DummyChild);
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// Inserts a new string and returns the specific DirectoryNode
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public DirectoryNode Insert(string path)
        {
            string currentDirectory = path.Split('\\').First();

            if (Childrens.ToList().All(node => node.Directory != currentDirectory))
            {
                var newNode = new DirectoryNode(currentDirectory)
                {
                    ParentDirectoryNode = this
                };
                Childrens.Add(newNode);
                if (currentDirectory == path)
                {
                    return(newNode);
                }
            }
            string nextStep = path.Substring(currentDirectory.Length).TrimStart('\\');

            if (nextStep == "")
            {
                return(this[currentDirectory]);
            }
            return(this[currentDirectory].Insert(nextStep));
        }
 public void RecursiveOrder()
 {
     Childrens = Childrens.OrderBy(x => x.Order)
                 .ToList();
     Childrens.ToList().ForEach(c => c.RecursiveOrder());
 }