voile/Voile/VoileContext.cs

55 lines
1.2 KiB
C#

using Org.BouncyCastle.X509;
using skyscraper5.Skyscraper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Voile
{
internal class VoileContext
{
private static VoileContext _instance;
public static VoileContext GetContext()
{
if (_instance == null)
{
_instance = new VoileContext();
}
return _instance;
}
private DirectoryInfo voileDirectory;
public DirectoryInfo GetVoileDirectory()
{
if (voileDirectory == null)
{
Type type = typeof(VoileContext);
Assembly assembly = type.Assembly;
FileInfo fi = new FileInfo(assembly.Location);
voileDirectory = fi.Directory;
}
return voileDirectory;
}
private FileInfo voileIniFile;
public FileInfo GetVoileIniFile()
{
if (voileIniFile == null)
{
DirectoryInfo directoryInfo = GetVoileDirectory();
string path = Path.Combine(directoryInfo.FullName, "voile.ini");
voileIniFile = new FileInfo(path);
}
return voileIniFile;
}
public Ini Ini { get; set; }
public X509Certificate SophiaNetRootCertificate { get; internal set; }
public bool PluginManagerInitalized { get; set; }
}
}