Exemple #1
0
        public UpdateResult UpdatePosition(BookmarkFolder folder, int index)
        {
            List <string> errors = new List <string>();

            if (InteractiveFolder.TryGetFolder(Home, folder, out InteractiveFolder thisFolder))
            {
                if (InteractiveFolder.TryGetFolder(Home, folder.Parent ?? Home, out InteractiveFolder iFolder))
                {
                    return(UpdatePosition(thisFolder, index, iFolder, iFolder));
                }
                else
                {
                    errors.Add("Failed to get parent folder.");
                }
            }
            else
            {
                errors.Add("Failed to get folder to update.");
            }

            return(new UpdateResult()
            {
                Errors = errors,
                Success = false
            });
        }
Exemple #2
0
        public UpdateResult UpdatePosition(FanficBookmark fanfic, int index, BookmarkFolder oldParent)
        {
            List <string> errors = new List <string>();

            if (InteractiveFolder.TryGetFolder(Home, oldParent ?? Home, out InteractiveFolder old))
            {
                if (InteractiveFolder.TryGetFolder(Home, fanfic.Parent ?? Home, out InteractiveFolder newParent))
                {
                    return(UpdatePosition(fanfic, index, newParent, old));
                }
                else
                {
                    errors.Add("Failed to get new parent folder.");
                }
            }
            else
            {
                errors.Add("Failed to get old parent folder");
            }

            return(new UpdateResult()
            {
                Success = false,
                Errors = errors
            });
        }
Exemple #3
0
        public UpdateResult TryAddFolder(BookmarkFolder folder, out InteractiveFolder iFolder)
        {
            List <string> errors = new List <string>();

            if (InteractiveFolder.TryGetFolder(Home, folder.Parent ?? Home, out InteractiveFolder res))
            {
                if (res.TryAddFolder(folder, out iFolder))
                {
                    return(new UpdateResult()
                    {
                        Success = true,
                        Message = "Folder added."
                    });
                }
                else
                {
                    errors.Add("Failed to add the new folder.");
                }
            }
            else
            {
                errors.Add("Failed to get the parent folder.");
            }

            iFolder = null;
            return(new UpdateResult()
            {
                Errors = errors,
                Success = false
            });
        }
Exemple #4
0
        public UpdateResult UpdatePosition(FanficBookmark bookmark, int index)
        {
            List <string> errors = new List <string>();

            if (InteractiveFolder.TryGetFolder(Home, bookmark.Parent ?? Home, out InteractiveFolder iParent))
            {
                return(UpdatePosition(bookmark, index, iParent, iParent));
            }
            else
            {
                errors.Add("Failed to get bookmark parent.");
            }

            return(new UpdateResult()
            {
                Success = false,
                Errors = errors
            });
        }
Exemple #5
0
        public UpdateResult AddFanfic(FanficBookmark fanfic)
        {
            List <string> errors = new List <string>();

            if (InteractiveFolder.TryGetFolder(Home, fanfic.Parent ?? Home, out InteractiveFolder f))
            {
                f.Contents.Insert(0, fanfic);
                return(new UpdateResult()
                {
                    Success = true,
                    Message = "New Bookmark Added"
                });
            }
            else
            {
                errors.Add("Failed to get parent folder.");
            }

            return(new UpdateResult()
            {
                Success = false,
                Errors = errors
            });
        }