using System.IO;
namespace DownKyi.Core.Storage
{
public static class StorageManager
{
///
/// 获取历史记录的文件路径
///
///
public static string GetHistory()
{
CreateDirectory(Constant.Database);
return Constant.History;
}
///
/// 获取设置的文件路径
///
///
public static string GetSettings()
{
CreateDirectory(Constant.Config);
return Constant.Settings;
}
///
/// 获取登录cookies的文件路径
///
///
public static string GetLogin()
{
CreateDirectory(Constant.Config);
return Constant.Login;
}
///
/// 获取弹幕的文件夹路径
///
///
public static string GetDanmaku()
{
return CreateDirectory(Constant.Danmaku);
}
///
/// 获取字幕的文件夹路径
///
///
public static string GetSubtitle()
{
return CreateDirectory(Constant.Subtitle);
}
///
/// 获取头图的文件夹路径
///
///
public static string GetToutu()
{
return CreateDirectory(Constant.Toutu);
}
///
/// 获取封面的文件夹路径
///
///
public static string GetCover()
{
return CreateDirectory(Constant.Cover);
}
///
/// 获取封面索引的文件路径
///
///
public static string GetCoverIndex()
{
CreateDirectory(Constant.Cover);
return Constant.CoverIndex;
}
///
/// 获取视频快照的文件夹路径
///
///
public static string GetSnapshot()
{
return CreateDirectory(Constant.Snapshot);
}
///
/// 获取视频快照索引的文件路径
///
///
public static string GetSnapshotIndex()
{
CreateDirectory(Constant.Snapshot);
return Constant.SnapshotIndex;
}
///
/// 获取用户头像的文件夹路径
///
///
public static string GetHeader()
{
return CreateDirectory(Constant.Header);
}
///
/// 获取用户头像索引的文件路径
///
///
public static string GetHeaderIndex()
{
CreateDirectory(Constant.Header);
return Constant.HeaderIndex;
}
///
/// 若文件夹不存在,则创建文件夹
///
///
///
private static string CreateDirectory(string directory)
{
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
return directory;
}
}
}