示例#1
0
 public FileController(ITagRest tagRest,
                       IFileRest fileRest,
                       IProcessRest processRest,
                       ISearchRest searchRest,
                       IValidateFilePathControllerRest validateRest) : base()
 {
     _tagRest      = tagRest;
     _fileRest     = fileRest;
     _processRest  = processRest;
     _searchRest   = searchRest;
     _validateRest = validateRest;
 }
示例#2
0
 public FileController(ITagRest tagRest,
                       IFileRest fileRest,
                       IProcessRest processRest,
                       ISearchRest searchRest,
                       IValidateFilePathControllerRest validateRest)
     : base()
 {
     _tagRest = tagRest;
     _fileRest = fileRest;
     _processRest = processRest;
     _searchRest = searchRest;
     _validateRest = validateRest;
 }
示例#3
0
        private static void DirectorySearch(string folderPath, JsTreeNodeModel root, IFileRest fileRest)
        {
            root.Children     = new List <JsTreeNodeModel>();
            root.State.Opened = true;

            foreach (string fileName in Directory.GetFiles(folderPath))
            {
                if (AllowedExtensions != null && AllowedExtensions.Any(ext => fileName.EndsWith(ext)))
                {
                    BaseFile file = fileRest.Get(fileName);

                    FileInfo fileInfo = new FileInfo(fileName);
                    root.Children.Add(new JsTreeNodeModel
                    {
                        Text = fileInfo.Name,
                        Type = file == null ? "file_new" : "file_added",
                        Attr = new JsTreeAttr {
                            DataFilename = fileInfo.FullName
                        },
                        State = new JsTreeNodeState()
                    });
                }
            }

            foreach (string directoryName in Directory.GetDirectories(folderPath))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(directoryName);

                JsTreeNodeModel node = new JsTreeNodeModel
                {
                    Text  = directoryInfo.Name,
                    State = new JsTreeNodeState()
                };

                DirectorySearch(directoryName, node, fileRest);

                root.Children.Add(node);
            }
        }
示例#4
0
        private static void DirectorySearch(string folderPath, JsTreeNodeModel root, IFileRest fileRest)
        {
            root.Children = new List<JsTreeNodeModel>();
            root.State.Opened = true;

            foreach (string fileName in Directory.GetFiles(folderPath))
            {
                if (AllowedExtensions != null && AllowedExtensions.Any(ext => fileName.EndsWith(ext)))
                {
                    BaseFile file = fileRest.Get(fileName);

                    FileInfo fileInfo = new FileInfo(fileName);
                    root.Children.Add(new JsTreeNodeModel
                    {
                        Text = fileInfo.Name,
                        Type = file == null ? "file_new" : "file_added",
                        Attr = new JsTreeAttr { DataFilename = fileInfo.FullName },
                        State = new JsTreeNodeState()
                    });
                }
            }

            foreach (string directoryName in Directory.GetDirectories(folderPath))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(directoryName);

                JsTreeNodeModel node = new JsTreeNodeModel
                {
                    Text = directoryInfo.Name,
                    State = new JsTreeNodeState()
                };

                DirectorySearch(directoryName, node, fileRest);

                root.Children.Add(node);
            }
        }