bookmark-manager-r4/Classes/SupportedFile/SupportedFileBase.cs

50 lines
1.3 KiB
C#
Raw Normal View History

2021-09-07 11:32:24 +00:00
using RyzStudio.Windows.Forms;
using System.Collections.Generic;
using System.IO;
namespace BookmarkManager
{
public abstract class SupportedFileBase : ISupportedFile
{
protected List<string> supportedExtensions = new List<string>();
public SupportedFileBase()
{
}
public virtual bool IsEncryptionSupported { get; set; } = false;
2021-09-29 15:20:46 +00:00
public List<string> SupportedExtensions { get => supportedExtensions; }
2021-09-07 11:32:24 +00:00
public virtual bool IsSupported(string filename)
{
if (string.IsNullOrWhiteSpace(filename))
{
return false;
}
if (supportedExtensions == null)
{
return false;
}
if (supportedExtensions.Count <= 0)
{
return false;
}
return supportedExtensions.Contains(Path.GetExtension(filename)?.Trim()?.ToLower());
}
public virtual bool IsEncrypted(string filename) => false;
public virtual Result Load(BookmarkTreeView treeview, string filename, string password) => Result.Create(false);
public virtual Result Save(BookmarkTreeView treeview, string filename, string password) => Result.Create(false);
}
}