예제 #1
0
파일: Node.cs 프로젝트: faboo/faux
        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,
                    };
                }
            }
        }
예제 #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);
            }
        }