ScrewTurn.Wiki.PagesStorageProvider.DeleteDraft C# (CSharp) Method

DeleteDraft() public method

Deletes a draft of a Page.
If is null.
public DeleteDraft ( System.PageInfo page ) : bool
page System.PageInfo The page.
return bool
        public bool DeleteDraft(PageInfo page)
        {
            if(page == null) throw new ArgumentNullException("page");

            lock(this) {
                LocalPageInfo local = LoadLocalPageInfo(page);
                if(local == null) return false;

                string targetFileFullPath = GetDraftFullPath(local);

                if(!File.Exists(targetFileFullPath)) return false;
                else {
                    File.Delete(targetFileFullPath);
                    // Delete directory if empty
                    if(Directory.GetFiles(Path.GetDirectoryName(targetFileFullPath)).Length == 0) {
                        Directory.Delete(Path.GetDirectoryName(targetFileFullPath));
                    }
                    return true;
                }
            }
        }
PagesStorageProvider