bookmark-manager-r4/Models/R4SaveFileModel.cs
2024-07-17 01:56:17 +01:00

49 lines
1.2 KiB
C#

using System.Text;
namespace BookmarkManager.Models
{
public class R4SaveFileModel
{
public string SiteName { get; set; }
public string SiteAddress { get; set; }
public string SiteDescription { get; set; }
public string TreeviewPath { get; set; }
public string Notes { get; set; }
public string Path
{
get
{
if (string.IsNullOrWhiteSpace(TreeviewPath))
{
return string.Empty;
}
var path = this.TreeviewPath?.Trim('\\')?.Trim() ?? string.Empty;
if (!path.Contains("\\"))
{
return path?.Trim() ?? string.Empty;
}
var sb = new StringBuilder();
var parts = path.Split("\\");
for (var i = 1; i < parts.Length; i++)
{
var item = System.Web.HttpUtility.UrlDecode(parts[i]);
sb.Append(item);
sb.Append("\n");
}
return sb.ToString()?.Trim() ?? string.Empty;
}
}
}
}