Exemple #1
0
        public static Node FromPath(Current project, string path)
        {
            if(project.FileInPath(path)) {
                if(Directory.Exists(path)) {
                    return new Folder {
                        Name = Path.GetFileName(path),
                        Project = project,
                    };
                }
                else {
                    return new File {
                        Name = Path.GetFileName(path),
                        RealPath = project.GetFileSubPath(path),
                        Project = project,
                    };
                }
            }
            else {
                if(Directory.Exists(path)) {
                    var folder = new ExternalFolder {
                        Name = Path.GetFileName(path),
                        RealPath = path,
                        Project = project,
                    };

                    folder.Update();

                    return folder;
                }
                else {
                    return new ExternalFile {
                        Name = Path.GetFileName(path),
                        RealPath = path,
                        Project = project,
                    };
                }
            }
        }
Exemple #2
0
        public void Update()
        {
            this.Contents.Clear();

            foreach(string file in Directory.GetFiles(RealPath)) {
                string realPath = Path.Combine(RealPath, Path.GetFileName(file));
                this.Add(new ExternalFile {
                    Name = Path.GetFileName(file),
                    RealPath = realPath,
                });
            }
            foreach(string dir in Directory.GetDirectories(RealPath)) {
                string realPath = Path.Combine(RealPath, Path.GetFileName(dir));
                ExternalFolder child = new ExternalFolder() {
                    Name = Path.GetFileName(dir),
                    RealPath = realPath,
                };
                child.Update();
                this.Add(child);
            }
        }