/// <summary> Workaround to avoid static initializer </summary> private static bool Init() { // string exeName = AppDomain.CurrentDomain.FriendlyName; string entryName = Assembly.GetEntryAssembly().GetName().Name; string entryVersion = Assembly.GetEntryAssembly().GetName().Version.ToString(); string pixelEngine = nameof(PixelEngine); TempPath = Path.Combine(Path.GetTempPath(), pixelEngine, $"{entryName}.{entryVersion}"); AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), entryName); UserDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Documents", entryName); if (!Directory.Exists(TempPath)) { Directory.CreateDirectory(TempPath); } if (!Directory.Exists(AppDataPath)) { Directory.CreateDirectory(AppDataPath); } if (!Directory.Exists(UserDataPath)) { Directory.CreateDirectory(UserDataPath); } ResxHelper.LoadDll(); return(true); }
/// <summary> Workaround for avoiding static constructor penalty </summary> private static bool Init() { ResxHelper.LoadFonts(); retro = new Lazy <Font>(CreateRetro); modern = new Lazy <Font>(CreateModern); formal = new Lazy <Font>(CreateFormal); handwritten = new Lazy <Font>(CreateHandwritten); return(true); }
static Windows() { TempPath = Path.Combine(Path.GetTempPath(), $"{nameof(PixelEngine)}.{Assembly.GetExecutingAssembly().GetName().Version}"); if (!Directory.Exists(TempPath)) { Directory.CreateDirectory(TempPath); } ResxHelper.LoadDll(); }
public static void DestroyTempPath() { ResxHelper.DestroyDll(); if (Directory.Exists(TempPath)) { foreach (string file in Directory.EnumerateFiles(TempPath)) { if (!file.EndsWith(".dll")) { File.Delete(file); } } } }