Beispiel #1
0
        public PointFile(string path, string hash, Int64 size, PointTree tree)
        {
            this.hash = hash;
            this.tree = tree;
            this.path = path;
            this.size = size;
            var dir = System.IO.Path.GetDirectoryName(path);

            name = System.IO.Path.GetFileName(path);
            if (dir != "")
            {
                parent = tree.getDir(dir);
            }
            else
            {
                parent = tree;
            }
            if (parent is IAddSize)
            {
                ((IAddSize)parent).AddSize(size);
            }
            if (parent is IAddChild)
            {
                ((IAddChild)parent).AddChild(name, this);
            }
        }
Beispiel #2
0
        public PointDir(string path, PointTree tree)
        {
            this.path = path;
            this.tree = tree;
            this.name = System.IO.Path.GetFileName(path);
            var dir = System.IO.Path.GetDirectoryName(path);

            if (dir != "")
            {
                var pdir = tree.getDir(dir);
                pdir.AddChild(this.name, this);
                parent = pdir;
            }
            else
            {
                parent = tree;
                tree.AddChild(this.name, this);
            }
        }