2016-04-27 09:15:53 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace Wox.Infrastructure.Storage
|
|
|
|
|
{
|
|
|
|
|
public class Storage<T>
|
|
|
|
|
{
|
|
|
|
|
protected T Data;
|
|
|
|
|
protected Type DataType { get; }
|
2017-01-13 23:40:32 +08:00
|
|
|
|
public string FileName { get; set; }
|
2016-04-27 09:15:53 +08:00
|
|
|
|
public string FilePath { get; set; }
|
|
|
|
|
public string FileSuffix { get; set; }
|
|
|
|
|
public string DirectoryPath { get; set; }
|
|
|
|
|
public string DirectoryName { get; set; }
|
|
|
|
|
|
|
|
|
|
public virtual T Load()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Save()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void LoadDefault()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected Storage()
|
|
|
|
|
{
|
|
|
|
|
DataType = typeof (T);
|
|
|
|
|
FileName = DataType.Name;
|
2016-05-19 02:38:43 +08:00
|
|
|
|
DirectoryPath = Constant.DataDirectory;
|
2016-04-27 09:15:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void ValidateDirectory()
|
|
|
|
|
{
|
|
|
|
|
if (!Directory.Exists(DirectoryPath))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(DirectoryPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|