bookmark-manager-r4/Classes/SupportedFile/SupportedFileBase.cs
2021-09-29 16:20:46 +01:00

50 lines
1.3 KiB
C#

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;
public List<string> SupportedExtensions { get => supportedExtensions; }
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);
}
}