mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 14:41:21 +08:00
Rename
This commit is contained in:
parent
cddfd1b319
commit
937ce34c36
@ -127,9 +127,9 @@ namespace Wox.Plugin.WebSearch
|
||||
|
||||
static Main()
|
||||
{
|
||||
var plugins = Infrastructure.Wox.Plugins;
|
||||
var plugins = Infrastructure.Constant.Plugins;
|
||||
var assemblyName = typeof(Main).Assembly.GetName().Name;
|
||||
var pluginDirectory = Path.Combine(Infrastructure.Wox.SettingsPath, plugins, assemblyName);
|
||||
var pluginDirectory = Path.Combine(Infrastructure.Constant.SettingsPath, plugins, assemblyName);
|
||||
ImagesDirectory = Path.Combine(pluginDirectory, Images);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace Wox.Core.Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
string pluginFolerPath = Infrastructure.Wox.UserDirectory;
|
||||
string pluginFolerPath = Infrastructure.Constant.UserDirectory;
|
||||
|
||||
string newPluginName = plugin.Name
|
||||
.Replace("/", "_")
|
||||
|
@ -33,13 +33,13 @@ namespace Wox.Core.Plugin
|
||||
// todo happlebao, this should not be public, the indicator function should be embeded
|
||||
public static PluginsSettings Settings;
|
||||
private static List<PluginMetadata> _metadatas;
|
||||
private static readonly string[] Directories = { Infrastructure.Wox.PreinstalledDirectory, Infrastructure.Wox.UserDirectory };
|
||||
private static readonly string[] Directories = { Infrastructure.Constant.PreinstalledDirectory, Infrastructure.Constant.UserDirectory };
|
||||
|
||||
private static void ValidateUserDirectory()
|
||||
{
|
||||
if (!Directory.Exists(Infrastructure.Wox.UserDirectory))
|
||||
if (!Directory.Exists(Infrastructure.Constant.UserDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(Infrastructure.Wox.UserDirectory);
|
||||
Directory.CreateDirectory(Infrastructure.Constant.UserDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace Wox.Core.Resource
|
||||
{
|
||||
public string DirectoryName { get; protected set; }
|
||||
|
||||
protected string DirectoryPath => Path.Combine(Infrastructure.Wox.ProgramPath, DirectoryName);
|
||||
protected string DirectoryPath => Path.Combine(Infrastructure.Constant.ProgramDirectory, DirectoryName);
|
||||
|
||||
public abstract ResourceDictionary GetResourceDictionary();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace Wox.Core.Resource
|
||||
|
||||
internal static void UpdatePluginLanguages()
|
||||
{
|
||||
RemoveResource(Infrastructure.Wox.Plugins);
|
||||
RemoveResource(Infrastructure.Constant.Plugins);
|
||||
foreach (var plugin in PluginManager.GetPluginsForInterface<IPluginI18n>())
|
||||
{
|
||||
var location = Assembly.GetAssembly(plugin.Plugin.GetType()).Location;
|
||||
|
@ -27,7 +27,7 @@ namespace Wox.Core
|
||||
// todo 5/9 the return value of UpdateApp() is NULL, fucking useless!
|
||||
using (
|
||||
var updater =
|
||||
await UpdateManager.GitHubUpdateManager(Infrastructure.Wox.Github, urlDownloader: downloader))
|
||||
await UpdateManager.GitHubUpdateManager(Infrastructure.Constant.Github, urlDownloader: downloader))
|
||||
{
|
||||
await updater.UpdateApp();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace Wox.CrashReporter
|
||||
private void SetException(Exception exception)
|
||||
{
|
||||
tbSummary.AppendText(exception.Message);
|
||||
tbVersion.Text = Infrastructure.Wox.Version;
|
||||
tbVersion.Text = Infrastructure.Constant.Version;
|
||||
tbDatetime.Text = DateTime.Now.ToString();
|
||||
tbStackTrace.AppendText(exception.StackTrace);
|
||||
tbSource.Text = exception.Source;
|
||||
|
@ -18,8 +18,8 @@ namespace Wox.Infrastructure.Image
|
||||
public static class ImageLoader
|
||||
{
|
||||
private static readonly ConcurrentDictionary<string, ImageSource> ImageSources = new ConcurrentDictionary<string, ImageSource>();
|
||||
private static readonly string DefaultIcon = Path.Combine(Wox.ProgramPath, "Images", "app.png");
|
||||
private static readonly string ErrorIcon = Path.Combine(Wox.ProgramPath, "Images", "app_error.png");
|
||||
private static readonly string DefaultIcon = Path.Combine(Constant.ProgramDirectory, "Images", "app.png");
|
||||
private static readonly string ErrorIcon = Path.Combine(Constant.ProgramDirectory, "Images", "app_error.png");
|
||||
|
||||
private static readonly string[] ImageExtions =
|
||||
{
|
||||
@ -174,7 +174,7 @@ namespace Wox.Infrastructure.Image
|
||||
}
|
||||
else
|
||||
{
|
||||
var defaultDirectoryPath = Path.Combine(Wox.ProgramPath, "Images", Path.GetFileName(path));
|
||||
var defaultDirectoryPath = Path.Combine(Constant.ProgramDirectory, "Images", Path.GetFileName(path));
|
||||
if (File.Exists(defaultDirectoryPath))
|
||||
{
|
||||
image = new BitmapImage(new Uri(defaultDirectoryPath));
|
||||
|
@ -12,7 +12,7 @@ namespace Wox.Infrastructure.Logger
|
||||
static Log()
|
||||
{
|
||||
var directoryName = "Logs";
|
||||
var path = Path.Combine(Wox.DataPath, directoryName, Wox.Version);
|
||||
var path = Path.Combine(Constant.DataDirectory, directoryName, Constant.Version);
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
@ -21,7 +21,7 @@ namespace Wox.Infrastructure.Logger
|
||||
var configuration = new LoggingConfiguration();
|
||||
var target = new FileTarget();
|
||||
configuration.AddTarget("file", target);
|
||||
target.FileName = "${specialfolder:folder=ApplicationData}/" + Wox.Name + "/" + directoryName + "/" + Wox.Version + "/${shortdate}.log";
|
||||
target.FileName = "${specialfolder:folder=ApplicationData}/" + Constant.Wox + "/" + directoryName + "/" + Constant.Version + "/${shortdate}.log";
|
||||
var rule = new LoggingRule("*", LogLevel.Info, target);
|
||||
configuration.LoggingRules.Add(rule);
|
||||
LogManager.Configuration = configuration;
|
||||
|
@ -15,8 +15,8 @@ namespace Wox.Infrastructure.Storage
|
||||
internal JsonStrorage()
|
||||
{
|
||||
FileSuffix = ".json";
|
||||
DirectoryName = Wox.Settings;
|
||||
DirectoryPath = Wox.SettingsPath;
|
||||
DirectoryName = Constant.Settings;
|
||||
DirectoryPath = Constant.SettingsPath;
|
||||
FilePath = Path.Combine(DirectoryPath, FileName + FileSuffix);
|
||||
|
||||
ValidateDirectory();
|
||||
|
@ -6,7 +6,7 @@ namespace Wox.Infrastructure.Storage
|
||||
{
|
||||
public PluginJsonStorage()
|
||||
{
|
||||
DirectoryName = Wox.Plugins;
|
||||
DirectoryName = Constant.Plugins;
|
||||
|
||||
// C# releated, add python releated below
|
||||
var assemblyName = DataType.Assembly.GetName().Name;
|
||||
|
@ -32,7 +32,7 @@ namespace Wox.Infrastructure.Storage
|
||||
{
|
||||
DataType = typeof (T);
|
||||
FileName = DataType.Name;
|
||||
DirectoryPath = Wox.DataPath;
|
||||
DirectoryPath = Constant.DataDirectory;
|
||||
}
|
||||
|
||||
protected void ValidateDirectory()
|
||||
|
@ -5,18 +5,19 @@ using System.Reflection;
|
||||
|
||||
namespace Wox.Infrastructure
|
||||
{
|
||||
public static class Wox
|
||||
public static class Constant
|
||||
{
|
||||
public const string Name = "Wox";
|
||||
public const string Wox = "Wox";
|
||||
public const string Plugins = "Plugins";
|
||||
public const string Settings = "Settings";
|
||||
|
||||
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
|
||||
public static readonly string ProgramPath = Directory.GetParent(Assembly.Location).ToString();
|
||||
public static readonly string DataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Name);
|
||||
public static readonly string UserDirectory = Path.Combine(DataPath, Plugins);
|
||||
public static readonly string PreinstalledDirectory = Path.Combine(ProgramPath, Plugins);
|
||||
public static readonly string SettingsPath = Path.Combine(DataPath, Settings);
|
||||
public static readonly string ProgramDirectory = Directory.GetParent(Assembly.Location).ToString();
|
||||
public static readonly string ExecutablePath = Path.Combine(ProgramDirectory, Wox + ".exe");
|
||||
public static readonly string DataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Wox);
|
||||
public static readonly string UserDirectory = Path.Combine(DataDirectory, Plugins);
|
||||
public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
|
||||
public static readonly string SettingsPath = Path.Combine(DataDirectory, Settings);
|
||||
public const string Github = "https://github.com/Wox-launcher/Wox";
|
||||
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location).ProductVersion;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ namespace Wox
|
||||
PluginManager.InitializePlugins(API);
|
||||
|
||||
Current.MainWindow = window;
|
||||
Current.MainWindow.Title = Infrastructure.Wox.Name;
|
||||
Current.MainWindow.Title = Infrastructure.Constant.Wox;
|
||||
|
||||
RegisterExitEvents();
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace Wox
|
||||
|
||||
private void InitializeNotifyIcon()
|
||||
{
|
||||
_notifyIcon = new NotifyIcon { Text = Infrastructure.Wox.Name, Icon = Properties.Resources.app, Visible = true };
|
||||
_notifyIcon = new NotifyIcon { Text = Infrastructure.Constant.Wox, Icon = Properties.Resources.app, Visible = true };
|
||||
_notifyIcon.Click += (o, e) => App.API.ShowApp();
|
||||
var open = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTrayOpen"));
|
||||
open.Click += (o, e) => App.API.ShowApp();
|
||||
|
@ -38,7 +38,7 @@ namespace Wox
|
||||
Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath(TopProperty));
|
||||
fadeOutStoryboard.Children.Add(fadeOutAnimation);
|
||||
|
||||
imgClose.Source = ImageLoader.Load(Path.Combine(Infrastructure.Wox.ProgramPath, "Images\\close.png"));
|
||||
imgClose.Source = ImageLoader.Load(Path.Combine(Infrastructure.Constant.ProgramDirectory, "Images\\close.png"));
|
||||
imgClose.MouseUp += imgClose_MouseUp;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ namespace Wox
|
||||
}
|
||||
if (!File.Exists(iconPath))
|
||||
{
|
||||
imgIco.Source = ImageLoader.Load(Path.Combine(Infrastructure.Wox.ProgramPath, "Images\\app.png"));
|
||||
imgIco.Source = ImageLoader.Load(Path.Combine(Infrastructure.Constant.ProgramDirectory, "Images\\app.png"));
|
||||
}
|
||||
else {
|
||||
imgIco.Source = ImageLoader.Load(iconPath);
|
||||
|
@ -158,7 +158,7 @@ namespace Wox
|
||||
string activateTimes = string.Format(
|
||||
InternationalizationManager.Instance.GetTranslation("about_activate_times"), _settings.ActivateTimes);
|
||||
ActivatedTimes.Text = activateTimes;
|
||||
tbVersion.Text = Infrastructure.Wox.Version;
|
||||
tbVersion.Text = Infrastructure.Constant.Version;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -242,8 +242,7 @@ namespace Wox
|
||||
{
|
||||
using (var key = Registry.CurrentUser.OpenSubKey(StartupPath, true))
|
||||
{
|
||||
var executable = Path.Combine(Infrastructure.Wox.ProgramPath, Infrastructure.Wox.Name + ".exe");
|
||||
key?.SetValue(Infrastructure.Wox.Name, executable);
|
||||
key?.SetValue(Infrastructure.Constant.Wox, Infrastructure.Constant.ExecutablePath);
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,7 +250,7 @@ namespace Wox
|
||||
{
|
||||
using (var key = Registry.CurrentUser.OpenSubKey(StartupPath, true))
|
||||
{
|
||||
key?.DeleteValue(Infrastructure.Wox.Name, false);
|
||||
key?.DeleteValue(Infrastructure.Constant.Wox, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,8 +261,7 @@ namespace Wox
|
||||
var path = key?.GetValue("Wox") as string;
|
||||
if (path != null)
|
||||
{
|
||||
var executable = Path.Combine(Infrastructure.Wox.ProgramPath, Infrastructure.Wox.Name + ".exe");
|
||||
return path == executable;
|
||||
return path == Infrastructure.Constant.ExecutablePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -454,48 +452,48 @@ namespace Wox
|
||||
Title = "Wox is an effective launcher for windows",
|
||||
SubTitle = "Wox provide bundles of features let you access infomations quickly.",
|
||||
IcoPath = "Images/app.png",
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Wox.ProgramPath)
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Search applications",
|
||||
SubTitle = "Search applications, files (via everything plugin) and browser bookmarks",
|
||||
IcoPath = "Images/app.png",
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Wox.ProgramPath)
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Search web contents with shortcuts",
|
||||
SubTitle = "e.g. search google with g keyword or youtube keyword)",
|
||||
IcoPath = "Images/app.png",
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Wox.ProgramPath)
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "clipboard history ",
|
||||
IcoPath = "Images/app.png",
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Wox.ProgramPath)
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Themes support",
|
||||
SubTitle = "get more themes from http://www.getwox.com/theme",
|
||||
IcoPath = "Images/app.png",
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Wox.ProgramPath)
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Plugins support",
|
||||
SubTitle = "get more plugins from http://www.getwox.com/plugin",
|
||||
IcoPath = "Images/app.png",
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Wox.ProgramPath)
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = "Wox is an open-source software",
|
||||
SubTitle = "Wox benefits from the open-source community a lot",
|
||||
IcoPath = "Images/app.png",
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Wox.ProgramPath)
|
||||
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
|
||||
}
|
||||
});
|
||||
|
||||
@ -859,7 +857,7 @@ namespace Wox
|
||||
if (!string.IsNullOrEmpty(version))
|
||||
{
|
||||
var newVersion = Updater.NumericVersion(version);
|
||||
var oldVersion = Updater.NumericVersion(Infrastructure.Wox.Version);
|
||||
var oldVersion = Updater.NumericVersion(Infrastructure.Constant.Version);
|
||||
if (newVersion > oldVersion)
|
||||
{
|
||||
NewVersionTips.Text = string.Format(NewVersionTips.Text, version);
|
||||
|
@ -495,7 +495,7 @@ namespace Wox.ViewModel
|
||||
Title = string.Format(executeQueryHistoryTitle, history.Query),
|
||||
SubTitle = string.Format(lastExecuteTime, history.ExecutedDateTime),
|
||||
IcoPath = "Images\\history.png",
|
||||
PluginDirectory = Infrastructure.Wox.ProgramPath,
|
||||
PluginDirectory = Infrastructure.Constant.ProgramDirectory,
|
||||
Action = _ =>
|
||||
{
|
||||
QueryText = history.Query;
|
||||
@ -519,7 +519,7 @@ namespace Wox.ViewModel
|
||||
{
|
||||
Title = InternationalizationManager.Instance.GetTranslation("cancelTopMostInThisQuery"),
|
||||
IcoPath = "Images\\down.png",
|
||||
PluginDirectory = Infrastructure.Wox.ProgramPath,
|
||||
PluginDirectory = Infrastructure.Constant.ProgramDirectory,
|
||||
Action = _ =>
|
||||
{
|
||||
_topMostRecord.Remove(result);
|
||||
@ -534,7 +534,7 @@ namespace Wox.ViewModel
|
||||
{
|
||||
Title = InternationalizationManager.Instance.GetTranslation("setAsTopMostInThisQuery"),
|
||||
IcoPath = "Images\\up.png",
|
||||
PluginDirectory = Infrastructure.Wox.ProgramPath,
|
||||
PluginDirectory = Infrastructure.Constant.ProgramDirectory,
|
||||
Action = _ =>
|
||||
{
|
||||
_topMostRecord.AddOrUpdate(result);
|
||||
|
Loading…
Reference in New Issue
Block a user