public static string FaviconUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/favicon.ico");
 }
 public static string PostsListUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Posts/PostList.html");
 }
 public static string RssIndexFeedUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/RssIndexFeed.xml");
 }
 public static string NoteRssUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Notes/NoteRss.xml");
 }
 public static string PhotoRssUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Photos/PhotoRss.xml");
 }
        public static FileInfo LocalSitePostRssFile(this UserSettings settings)
        {
            var directory = settings.LocalSitePostDirectory();

            return(new FileInfo($"{Path.Combine(directory.FullName, "PostRss")}.xml"));
        }
 public static string NoteListUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Notes/NoteList.html");
 }
 public static string LinkListUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Links/LinkList.html");
 }
 public static string LinkRssUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Links/LinkRss.xml");
 }
 public static string IndexPageUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/index.html");
 }
 public static string AllContentListUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/AllContentList.html");
 }
 public static string ImageRssUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Images/ImageRss.xml");
 }
 public static string ImageListUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Images/ImageList.html");
 }
 public static string FileDownloadUrl(this UserSettings settings, FileContent content)
 {
     return($"//{settings.SiteUrl}/Files/{content.Folder}/{content.Slug}/{content.OriginalFileName}");
 }
        public static FileInfo LocalSitePhotoListFile(this UserSettings settings)
        {
            var directory = settings.LocalSitePhotoDirectory();

            return(new FileInfo($"{Path.Combine(directory.FullName, "PhotoList")}.html"));
        }
 public static string AllContentRssUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/AllContentRss.xml");
 }
        public static FileInfo LocalSitePostHtmlFile(this UserSettings settings, PostContent content)
        {
            var directory = settings.LocalSitePostContentDirectory(content, false);

            return(new FileInfo($"{Path.Combine(directory.FullName, content.Slug)}.html"));
        }
        public static FileInfo LocalSiteAllContentRssFile(this UserSettings settings)
        {
            var directory = settings.LocalSiteRootDirectory;

            return(new FileInfo($"{Path.Combine(directory, "AllContentRss")}.xml"));
        }
        public static FileInfo LocalSiteRssIndexFeedListFile(this UserSettings settings)
        {
            var directory = settings.LocalSiteRootDirectory;

            return(new FileInfo($"{Path.Combine(directory, "RssIndexFeed")}.xml"));
        }
        public static FileInfo LocalSiteCameraRollPhotoGalleryFileInfo(this UserSettings settings)
        {
            var directory = settings.LocalSitePhotoGalleryDirectory();

            return(new FileInfo($"{Path.Combine(directory.FullName, "CameraRoll")}.html"));
        }
 public static string NotePageUrl(this UserSettings settings, NoteContent content)
 {
     return($"//{settings.SiteUrl}/Notes/{content.Folder}/{content.Slug}.html");
 }
        public static FileInfo LocalSiteDailyPhotoGalleryFileInfo(this UserSettings settings, DateTime galleryDate)
        {
            var directory = settings.LocalSiteDailyPhotoGalleryDirectory();

            return(new FileInfo($"{Path.Combine(directory.FullName, $"DailyPhotos-{galleryDate:yyyy-MM-dd}")}.html"));
        }
 public static string PhotoListUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Photos/PhotoList.html");
 }
 public static string AllTagsListUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Tags/AllTagsList.html");
 }
 public static string PostPageUrl(this UserSettings settings, PostContent content)
 {
     return($"//{settings.SiteUrl}/Posts/{content.Folder}/{content.Slug}/{content.Slug}.html");
 }
 public static string CameraRollPhotoGalleryUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Photos/Galleries/CameraRoll.html");
 }
 public static string PostsRssUrl(this UserSettings settings)
 {
     return($"//{settings.SiteUrl}/Posts/PostRss.xml");
 }
        public static FileInfo LocalSiteImageContentFile(this UserSettings settings, ImageContent content)
        {
            var directory = settings.LocalSiteImageContentDirectory(content, false);

            return(new FileInfo(Path.Combine(directory.FullName, content.OriginalFileName)));
        }
        /// <summary>
        /// </summary>
        /// <param name="userFilename">File Name for the </param>
        /// <param name="progress"></param>
        /// <returns></returns>
        public static async Task <UserSettings> SetupNewSite(string userFilename, IProgress <string> progress)
        {
            if (!FolderFileUtility.IsValidWindowsFileSystemFilename(userFilename))
            {
                throw new InvalidDataException("New site input must be a valid filename.");
            }

            var newSettings = new UserSettings();

            var rootDirectory = new DirectoryInfo(Path.Combine(StorageDirectory().FullName, userFilename));

            progress?.Report("Creating new settings - looking for home...");

            var fileNumber = 1;

            while (rootDirectory.Exists)
            {
                rootDirectory =
                    new DirectoryInfo(Path.Combine(StorageDirectory().FullName, $"{userFilename}-{fileNumber}"));
                rootDirectory.Refresh();
                progress?.Report($"Trying {rootDirectory.FullName}...");
                fileNumber++;
            }

            rootDirectory.Create();

            var siteRoot = new DirectoryInfo(Path.Combine(rootDirectory.FullName, "GeneratedSite"));

            newSettings.LocalSiteRootDirectory = siteRoot.FullName;

            progress?.Report($"Local Site Root set to {siteRoot.FullName}");

            newSettings.DatabaseFile =
                Path.Combine(rootDirectory.FullName, $"PointlessWaymarksCmsDatabase-{userFilename}.db");

            var mediaDirectory = new DirectoryInfo(Path.Combine(rootDirectory.FullName, "MediaArchive"));

            newSettings.LocalMediaArchive = mediaDirectory.FullName;

            progress?.Report("Adding fake default values...");

            newSettings.DefaultCreatedBy = "Pointless Waymarks CMS";
            newSettings.SiteName         = userFilename;
            newSettings.SiteUrl          = "localhost.com";
            newSettings.SiteKeywords     = "new,site";
            newSettings.SiteSummary      = "A new site.";
            newSettings.SiteAuthors      = "Pointless Waymarks CMS";
            newSettings.SiteEmailTo      = "*****@*****.**";

            SettingsFileName =
                Path.Combine(rootDirectory.FullName, $"PointlessWaymarksCmsSettings-{userFilename}.json");

            progress?.Report("Writing Settings");

            await WriteSettings(newSettings);

            progress?.Report("Setting up directory structure.");

            newSettings.VerifyOrCreateAllTopLevelFolders(progress);

            return(newSettings);
        }
 public static string DailyPhotoGalleryUrl(this UserSettings settings, DateTime galleryDate)
 {
     return($"//{settings.SiteUrl}/Photos/Galleries/Daily/DailyPhotos-{galleryDate:yyyy-MM-dd}.html");
 }