Example #1
0
        /// <summary>
        /// Auto Create Node From Path In Disk
        /// </summary>
        /// <param name="path"></param>
        /// <param name="size"> <1 is folder</param>
        /// <returns></returns>
        public static IItemNode GetNodeFromDiskPath(string path, long size = -1)
        {
            string[] path_split = path.Split('\\');

            IItemNode parent = new RootNode();

            ((RootNode)parent).RootType.Type = CloudType.LocalDisk;
            parent.Info.Name = path_split[0];
            for (int i = 1; i < path_split.Length; i++)
            {
                IItemNode node = new ItemNode();
                node.Info.Name = path_split[i];
                parent.AddChild(node);
                parent = node;
            }
            if (size >= 0)
            {
                parent.Info.Size = size;
            }
            else
            {
                System.IO.FileInfo info = new System.IO.FileInfo(path);
                if (info.Exists)
                {
                    parent.Info.Size = info.Length;
                }
            }
            return(parent);
        }
Example #2
0
        public IItemNode MakeNodeTo(IItemNode RootFrom, IItemNode RootTo)
        {
            List <IItemNode> FullPathRootFrom = RootFrom.GetFullPath();
            List <IItemNode> NodeFullPath     = this.GetFullPath();
            CloudType        type_rootto      = RootTo.GetRoot.RootType.Type;

            for (int i = NodeFullPath.IndexOf(RootFrom) + 1; i < NodeFullPath.Count; i++)
            {
                ItemNode node = new ItemNode();
                node.Info.Size = NodeFullPath[i].Info.Size;
                node.Info.Name = (type_rootto == CloudType.LocalDisk || type_rootto == CloudType.Dropbox) ? RemoveSpecialChar(NodeFullPath[i].Info.Name) : NodeFullPath[i].Info.Name;
                RootTo.AddChild(node);
                RootTo = node;
            }
            return(RootTo);
        }
Example #3
0
 public DeleteItems(ItemNode item)
 {
     Items.Add(item);
 }