mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
misc
This commit is contained in:
@@ -18,7 +18,6 @@ namespace Wox.Core.Resource
|
||||
{
|
||||
public Settings Settings { get; set; }
|
||||
private const string DirectoryName = "Languages";
|
||||
private string DirectoryPath => Path.Combine(Constant.ProgramDirectory, DirectoryName);
|
||||
private readonly List<string> _languageDirectories = new List<string>();
|
||||
private readonly List<ResourceDictionary> _oldResources = new List<ResourceDictionary>();
|
||||
|
||||
|
||||
@@ -15,31 +15,30 @@ namespace Wox.Core.Resource
|
||||
{
|
||||
public class Theme
|
||||
{
|
||||
private static List<string> themeDirectories = new List<string>();
|
||||
private readonly List<string> _themeDirectories = new List<string>();
|
||||
public Settings Settings { get; set; }
|
||||
protected string DirectoryPath => Path.Combine(Constant.ProgramDirectory, DirectoryName);
|
||||
public string DirectoryName { get; protected set; }
|
||||
private string DirectoryPath => Path.Combine(Constant.ProgramDirectory, DirectoryName);
|
||||
private const string DirectoryName = "Themes";
|
||||
|
||||
public Theme()
|
||||
{
|
||||
DirectoryName = "Themes";
|
||||
themeDirectories.Add(DirectoryPath);
|
||||
_themeDirectories.Add(DirectoryPath);
|
||||
MakesureThemeDirectoriesExist();
|
||||
}
|
||||
|
||||
private static void MakesureThemeDirectoriesExist()
|
||||
private void MakesureThemeDirectoriesExist()
|
||||
{
|
||||
foreach (string pluginDirectory in themeDirectories)
|
||||
foreach (string dir in _themeDirectories)
|
||||
{
|
||||
if (!Directory.Exists(pluginDirectory))
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(pluginDirectory);
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Exception($"|Theme.MakesureThemeDirectoriesExist|Exception when create directory <{pluginDirectory}>", e);
|
||||
Log.Exception($"|Theme.MakesureThemeDirectoriesExist|Exception when create directory <{dir}>", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +121,7 @@ namespace Wox.Core.Resource
|
||||
public List<string> LoadAvailableThemes()
|
||||
{
|
||||
List<string> themes = new List<string>();
|
||||
foreach (var themeDirectory in themeDirectories)
|
||||
foreach (var themeDirectory in _themeDirectories)
|
||||
{
|
||||
themes.AddRange(
|
||||
Directory.GetFiles(themeDirectory)
|
||||
@@ -134,7 +133,7 @@ namespace Wox.Core.Resource
|
||||
|
||||
private string GetThemePath(string themeName)
|
||||
{
|
||||
foreach (string themeDirectory in themeDirectories)
|
||||
foreach (string themeDirectory in _themeDirectories)
|
||||
{
|
||||
string path = Path.Combine(themeDirectory, themeName + ".xaml");
|
||||
if (File.Exists(path))
|
||||
|
||||
Reference in New Issue
Block a user