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