PowerToys/src/modules/launcher/Wox.Plugin/Constant.cs
Stefan Markovic dfe9169e39
[modules] Unify exe & dll naming (#14903)
* Unify exe/dll naming - AwakeModuleInterface

* Unify exe/dll naming - ColorPicker.dll & ColorPickerUI.exe

* Unify exe/dll naming - FancyZones, FancyZonesEditor & FancyZonesModuleInterface

* Unify exe/dll naming - ImageResizerExt & ImageResizer.exe

* Unify exe/dll naming - KeyboardManager.dll

* Unify exe/dll naming - FindMyMouse & MouseHighlighter

* Unify exe/dll naming - PowerRename.dll, PowerRenameUIHost & PowerRenameUILib

* Unify exe/dll naming - File Explorer add-ons

* Unify exe/dll naming - ShortcutGuide

* Unify exe/dll naming - VCM

* Unify exe/dll naming - PT Run

* Unify exe/dll naming - *.resources.dll

* [Fix] Unify exe/dll naming - VideoConferenceProxyFilter_x86
2021-12-10 10:50:46 +01:00

72 lines
3.0 KiB
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.IO.Abstractions;
using System.Reflection;
namespace Wox.Plugin
{
public static class Constant
{
/// <summary>
/// http://www.yinwang.org/blog-cn/2015/11/21/programming-philosophy
/// </summary>
public static string NonNull(this string obj)
{
if (obj == null)
{
throw new NullReferenceException();
}
else
{
return obj;
}
}
private static readonly IFileSystem FileSystem = new FileSystem();
private static readonly IPath Path = FileSystem.Path;
private static readonly IDirectory Directory = FileSystem.Directory;
public const string ExeFileName = "PowerToys.PowerLauncher";
public const string ModuleLocation = "Microsoft\\PowerToys\\PowerToys Run";
public const string Plugins = "Plugins";
public const string PortableFolderName = "UserData";
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
public static readonly string ProgramDirectory = Directory.GetParent(Assembly.Location.NonNull()).ToString();
public static readonly string ExecutablePath = Path.Combine(ProgramDirectory, ExeFileName + ".exe");
public static bool IsPortableMode { get; set; }
public static string PortableDataPath { get; set; } = Path.Combine(ProgramDirectory, PortableFolderName);
public static string DetermineDataDirectory()
{
if (Directory.Exists(PortableDataPath))
{
IsPortableMode = true;
return PortableDataPath;
}
else
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ModuleLocation);
}
}
public static readonly string DataDirectory = DetermineDataDirectory();
public static readonly string PluginsDirectory = Path.Combine(DataDirectory, Plugins);
public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
public const string Issue = "https://aka.ms/powerToysReportBug";
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion;
public static readonly int ThumbnailSize = 64;
public static readonly string DefaultIcon = Path.Combine(ProgramDirectory, "Images", "app.dark.png");
public static readonly string ErrorIcon = Path.Combine(ProgramDirectory, "Images", "app_error.dark.png");
public static readonly string LightThemedDefaultIcon = Path.Combine(ProgramDirectory, "Images", "app.light.png");
public static readonly string LightThemedErrorIcon = Path.Combine(ProgramDirectory, "Images", "app_error.light.png");
}
}