Ejemplo n.º 1
0
        public NtStatus GetFileInformation(Path path, out FileInformation fileInfo, IDokanFileInfo info)
        {
            fileInfo = default;
            return(path switch
            {
                // Dirs
                RootPath p => GetFileInformation(p, out fileInfo),
                DatabasePath p => GetFileInformation(p, out fileInfo),
                CollectionPath p => GetFileInformation(p, out fileInfo),
                DataDirectoryPath p => GetFileInformation(p, out fileInfo),
                QueryDirectoryPath p => GetFileInformation(p, out fileInfo),
                QueryEmptyDirectoryPath p => GetFileInformation(p, out fileInfo),

                // Files
                StatsPath p => GetFileInformation(p, out fileInfo),
                IndexesPath p => GetFileInformation(p, out fileInfo),
                CurrentOpPath p => GetFileInformation(p, out fileInfo),
                ServerStatusPath p => GetFileInformation(p, out fileInfo),
                BuildInfoPath p => GetFileInformation(p, out fileInfo),
                HostInfoPath p => GetFileInformation(p, out fileInfo),
                ListCommandsPath p => GetFileInformation(p, out fileInfo),
                DataDocumentPath p => GetFileInformation(p, out fileInfo),
                QueryDocumentPath p => GetFileInformation(p, out fileInfo),
                QueryAllDocumentsPath p => GetFileInformation(p, out fileInfo),

                var p => LogFailure(p)
            });
Ejemplo n.º 2
0
        public NtStatus FindFilesWithPattern(Path path, string?searchPattern, out IList <FileInformation> files,
                                             IDokanFileInfo info)
        {
            files = Array.Empty <FileInformation>();
            return(path switch
            {
                RootPath p => FindFilesWithPattern(p, searchPattern, out files),
                DatabasePath p => FindFilesWithPattern(p, searchPattern, out files),
                CollectionPath p => FindFilesWithPattern(p, searchPattern, out files),
                DataDirectoryPath p => FindFilesWithPattern(p, searchPattern, out files),
                QueryDirectoryPath p => FindFilesWithPattern(p, searchPattern, out files),
                QueryEmptyDirectoryPath p => FindFilesWithPattern(p, searchPattern, out files),

                var p => LogFailure(path)
            });
Ejemplo n.º 3
0
        public string Save(string path, string title, string pathType, int pagesize, string nav)
        {
            //make sure the user has access
            RatnaUser user = base.ValidatedUser();
            if (!(IsAccessAllowed(user)))
            {
                return SendAccessDenied();
            }

            ServiceOutput output = new ServiceOutput();
            output.Success = false;

            CollectionPath collectionPath = CollectionPathPlugin.Instance.Read(path);

            if (collectionPath == null)
            {
                collectionPath = new CollectionPath();
                collectionPath.Path = path;
            }

            collectionPath.Title = title;
            collectionPath.Navigation = nav ?? string.Empty;
            collectionPath.PageSize = pagesize > 0 ? pagesize : 4;

            CollectionType collectionType;
            if (!Enum.TryParse<CollectionType>(pathType, true, out collectionType))
            {
                collectionType = CollectionType.BlogArticle;
            }

            // set the collection type
            collectionPath.CollectionType = collectionType;

            try
            {
                //save
                CollectionPathPlugin.Instance.Update(collectionPath);

                output.Success = true;
            }
            catch (MessageException me)
            {
                output.AddOutput(Constants.Json.Error, me.Message);
            }

            return output.GetJson();
        }
Ejemplo n.º 4
0
        public void Update(CollectionPath collectionPath)
        {
            if (collectionPath == null)
            {
                throw new ArgumentNullException("collectionPath");
            }

            logger.Log(LogLevel.Debug, "Saving collectionPath");

            PluginStore.Instance.Save(Instance, collectionPath);
        }
Ejemplo n.º 5
0
        private void RenderPathTypes(CollectionPath collectionPath)
        {
            // add the types
            pathTypesSelect.Items.Add(new ListItem(ResourceManager.GetLiteral("Admin.Articles.Post"), CollectionType.BlogArticle.ToString()));
            pathTypesSelect.Items.Add(new ListItem(ResourceManager.GetLiteral("Admin.Media.Photo"), CollectionType.Photo.ToString()));

            if (collectionPath != null)
            {
                switch (collectionPath.CollectionType)
                {
                    case CollectionType.BlogArticle :
                        pathTypesSelect.SelectedIndex = 0;
                        break;
                    case CollectionType.Photo :
                        pathTypesSelect.SelectedIndex = 1;
                        break;
                }
            }
        }