mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Merge branch 'master' into spelling
This commit is contained in:
@@ -68,6 +68,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests
|
||||
var engine = new CalculateEngine();
|
||||
|
||||
// Act
|
||||
// Using InvariantCulture since this is internal
|
||||
var result = engine.Interpret(input, CultureInfo.InvariantCulture);
|
||||
|
||||
// Assert
|
||||
@@ -84,6 +85,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests
|
||||
var engine = new CalculateEngine();
|
||||
|
||||
// Act
|
||||
// Using InvariantCulture since this is internal
|
||||
var result = engine.Interpret(input, CultureInfo.InvariantCulture);
|
||||
|
||||
// Assert
|
||||
@@ -140,6 +142,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests
|
||||
var engine = new CalculateEngine();
|
||||
|
||||
// Act
|
||||
// Using InvariantCulture since this is internal
|
||||
var result = engine.Interpret(input, CultureInfo.InvariantCulture);
|
||||
|
||||
// Assert
|
||||
@@ -158,6 +161,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests
|
||||
var engine = new CalculateEngine();
|
||||
|
||||
// Act
|
||||
// Using InvariantCulture since this is internal
|
||||
var result = engine.Interpret(input, CultureInfo.InvariantCulture);
|
||||
|
||||
// Assert
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Microsoft.Plugin.Calculator
|
||||
|
||||
public CalculateResult Interpret(string input)
|
||||
{
|
||||
// Using CurrentCulture this is user facing
|
||||
return Interpret(input, CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Microsoft.Plugin.Calculator
|
||||
|
||||
try
|
||||
{
|
||||
// Using CurrentUICulture since this is user facing
|
||||
var result = CalculateEngine.Interpret(query.Search, CultureInfo.CurrentUICulture);
|
||||
|
||||
// This could happen for some incorrect queries, like pi(2)
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Microsoft.Plugin.Calculator
|
||||
|
||||
return new Result
|
||||
{
|
||||
// Using CurrentCulture since this is user facing
|
||||
Title = roundedResult?.ToString(CultureInfo.CurrentCulture),
|
||||
IcoPath = iconPath,
|
||||
Score = 300,
|
||||
@@ -45,6 +46,7 @@ namespace Microsoft.Plugin.Calculator
|
||||
{
|
||||
try
|
||||
{
|
||||
// Using CurrentUICulture since this is user facing
|
||||
Clipboard.SetText(roundedResult?.ToString(CultureInfo.CurrentUICulture.NumberFormat));
|
||||
ret = true;
|
||||
}
|
||||
|
||||
@@ -69,8 +69,10 @@ namespace Microsoft.Plugin.Folder.UnitTests
|
||||
{
|
||||
// Setup
|
||||
var folderHelperMock = new Mock<IFolderHelper>();
|
||||
|
||||
// Using Ordinal since this is used with paths
|
||||
folderHelperMock.Setup(r => r.IsDriveOrSharedFolder(It.IsAny<string>()))
|
||||
.Returns<string>(s => s.StartsWith("C:", StringComparison.CurrentCultureIgnoreCase));
|
||||
.Returns<string>(s => s.StartsWith("C:", StringComparison.Ordinal));
|
||||
|
||||
var itemResultMock = new Mock<IItemResult>();
|
||||
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions.TestingHelpers;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Plugin.Folder.Sources;
|
||||
using Microsoft.Plugin.Folder.Sources.Result;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.UnitTests
|
||||
@@ -17,115 +16,45 @@ namespace Microsoft.Plugin.Folder.UnitTests
|
||||
[TestFixture]
|
||||
public class InternalQueryFolderTests
|
||||
{
|
||||
private static readonly HashSet<string> DirectoryExist = new HashSet<string>()
|
||||
{
|
||||
@"c:",
|
||||
@"c:\",
|
||||
@"c:\Test\",
|
||||
@"c:\Test\A\",
|
||||
@"c:\Test\b\",
|
||||
};
|
||||
|
||||
private static readonly HashSet<string> FilesExist = new HashSet<string>()
|
||||
{
|
||||
@"c:\bla.txt",
|
||||
@"c:\Test\test.txt",
|
||||
@"c:\Test\more-test.png",
|
||||
};
|
||||
|
||||
private static Mock<IQueryFileSystemInfo> _queryFileSystemInfoMock;
|
||||
private static IQueryFileSystemInfo _queryFileSystemInfoMock;
|
||||
private static MockFileSystem _fileSystem;
|
||||
|
||||
[SetUp]
|
||||
public void SetupMock()
|
||||
{
|
||||
var queryFileSystemInfoMock = new Mock<IQueryFileSystemInfo>();
|
||||
queryFileSystemInfoMock.Setup(r => r.Exists(It.IsAny<string>()))
|
||||
.Returns<string>(path => ContainsDirectory(path));
|
||||
|
||||
queryFileSystemInfoMock.Setup(r => r.MatchFileSystemInfo(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>()))
|
||||
.Returns<string, string, bool>(MatchFileSystemInfo);
|
||||
|
||||
_queryFileSystemInfoMock = queryFileSystemInfoMock;
|
||||
}
|
||||
|
||||
// Windows supports C:\\\\\ => C:\
|
||||
private static bool ContainsDirectory(string path)
|
||||
{
|
||||
return DirectoryExist.Contains(TrimDirectoryEnd(path));
|
||||
}
|
||||
|
||||
private static string TrimDirectoryEnd(string path)
|
||||
{
|
||||
var trimEnd = path.TrimEnd('\\');
|
||||
|
||||
if (path.EndsWith('\\'))
|
||||
// Note: This mock filesystem adds a 'c:\temp' directory.
|
||||
_fileSystem = new MockFileSystem(new Dictionary<string, MockFileData>()
|
||||
{
|
||||
trimEnd += '\\';
|
||||
}
|
||||
{ @"c:\bla.txt", new MockFileData(string.Empty) },
|
||||
{ @"c:\Test\test.txt", new MockFileData(string.Empty) },
|
||||
{ @"c:\Test\more-test.png", new MockFileData(string.Empty) },
|
||||
{ @"c:\Test\A\deep-nested.png", new MockFileData(string.Empty) },
|
||||
{ @"c:\Test\b\", new MockDirectoryData() },
|
||||
});
|
||||
|
||||
return trimEnd;
|
||||
}
|
||||
|
||||
private static IEnumerable<DisplayFileInfo> MatchFileSystemInfo(string search, string incompleteName, bool isRecursive)
|
||||
{
|
||||
Func<string, bool> folderSearchFunc;
|
||||
Func<string, bool> fileSearchFunc;
|
||||
switch (isRecursive)
|
||||
{
|
||||
case false:
|
||||
folderSearchFunc = s => s.Equals(search, StringComparison.CurrentCultureIgnoreCase);
|
||||
|
||||
var regexSearch = TrimDirectoryEnd(search);
|
||||
|
||||
fileSearchFunc = s => Regex.IsMatch(s, $"^{Regex.Escape(regexSearch)}[^\\\\]*$");
|
||||
break;
|
||||
case true:
|
||||
folderSearchFunc = s => s.StartsWith(search, StringComparison.CurrentCultureIgnoreCase);
|
||||
fileSearchFunc = s => s.StartsWith(search, StringComparison.CurrentCultureIgnoreCase);
|
||||
break;
|
||||
}
|
||||
|
||||
var directories = DirectoryExist.Where(s => folderSearchFunc(s))
|
||||
.Select(dir => new DisplayFileInfo()
|
||||
{
|
||||
Type = DisplayType.Directory,
|
||||
FullName = dir,
|
||||
});
|
||||
|
||||
var files = FilesExist.Where(s => fileSearchFunc(s))
|
||||
.Select(file => new DisplayFileInfo()
|
||||
{
|
||||
Type = DisplayType.File,
|
||||
FullName = file,
|
||||
});
|
||||
|
||||
return directories.Concat(files);
|
||||
_queryFileSystemInfoMock = new QueryFileSystemInfo(_fileSystem.DirectoryInfo);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Query_ThrowsException_WhenCalledNull()
|
||||
{
|
||||
// Setup
|
||||
var queryInternalDirectory = new QueryInternalDirectory(new FolderSettings(), _queryFileSystemInfoMock.Object);
|
||||
var queryInternalDirectory = new QueryInternalDirectory(new FolderSettings(), _queryFileSystemInfoMock, _fileSystem.Directory);
|
||||
|
||||
// Act & Assert
|
||||
Assert.Throws<ArgumentNullException>(() => queryInternalDirectory.Query(null).ToArray());
|
||||
}
|
||||
|
||||
[TestCase(@"c", 0, 0, false, Reason = "String empty is nothing")]
|
||||
[TestCase(@"c:", 1, 1, false, Reason = "Root without \\")]
|
||||
[TestCase(@"c:\", 1, 1, false, Reason = "Normal root")]
|
||||
[TestCase(@"c:\Test", 1, 2, false, Reason = "Select yourself")]
|
||||
[TestCase(@"c:\>", 2, 2, true, Reason = "Max Folder test recursive")]
|
||||
[TestCase(@"c:\Test>", 2, 2, true, Reason = "2 Folders recursive")]
|
||||
[TestCase(@"c:\not-exist", 1, 1, false, Reason = "Folder not exist, return root")]
|
||||
[TestCase(@"c:\not-exist>", 2, 2, true, Reason = "Folder not exist, return root recursive")]
|
||||
[TestCase(@"c:", 2, 1, false, Reason = "Root without \\")]
|
||||
[TestCase(@"c:\", 2, 1, false, Reason = "Normal root")]
|
||||
[TestCase(@"c:\Test", 2, 2, false, Reason = "Select yourself")]
|
||||
[TestCase(@"c:\not-exist", 2, 1, false, Reason = "Folder not exist, return root")]
|
||||
[TestCase(@"c:\not-exist\not-exist2", 0, 0, false, Reason = "Folder not exist, return root")]
|
||||
[TestCase(@"c:\not-exist\not-exist2>", 0, 0, false, Reason = "Folder not exist, return root recursive")]
|
||||
[TestCase(@"c:\bla.t", 1, 1, false, Reason = "Partial match file")]
|
||||
[TestCase(@"c:\bla.t", 2, 1, false, Reason = "Partial match file")]
|
||||
public void Query_WhenCalled(string search, int folders, int files, bool truncated)
|
||||
{
|
||||
const int maxFolderSetting = 2;
|
||||
const int maxFolderSetting = 3;
|
||||
|
||||
// Setup
|
||||
var folderSettings = new FolderSettings()
|
||||
@@ -134,7 +63,42 @@ namespace Microsoft.Plugin.Folder.UnitTests
|
||||
MaxFolderResults = maxFolderSetting,
|
||||
};
|
||||
|
||||
var queryInternalDirectory = new QueryInternalDirectory(folderSettings, _queryFileSystemInfoMock.Object);
|
||||
var queryInternalDirectory = new QueryInternalDirectory(folderSettings, _queryFileSystemInfoMock, _fileSystem.Directory);
|
||||
|
||||
// Act
|
||||
var isDriveOrSharedFolder = queryInternalDirectory.Query(search)
|
||||
.ToLookup(r => r.GetType());
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(files, isDriveOrSharedFolder[typeof(FileItemResult)].Count(), "File count doesn't match");
|
||||
Assert.AreEqual(folders, isDriveOrSharedFolder[typeof(FolderItemResult)].Count(), "folder count doesn't match");
|
||||
|
||||
// Always check if there is less than max folders
|
||||
Assert.LessOrEqual(isDriveOrSharedFolder[typeof(FileItemResult)].Count(), maxFolderSetting, "Files are not limited");
|
||||
Assert.LessOrEqual(isDriveOrSharedFolder[typeof(FolderItemResult)].Count(), maxFolderSetting, "Folders are not limited");
|
||||
|
||||
// Checks if CreateOpenCurrentFolder is displayed
|
||||
Assert.AreEqual(Math.Min(folders + files, 1), isDriveOrSharedFolder[typeof(CreateOpenCurrentFolderResult)].Count(), "CreateOpenCurrentFolder displaying is incorrect");
|
||||
|
||||
Assert.AreEqual(truncated, isDriveOrSharedFolder[typeof(TruncatedItemResult)].Count() == 1, "CreateOpenCurrentFolder displaying is incorrect");
|
||||
}
|
||||
|
||||
[TestCase(@"c:\>", 3, 3, true, Reason = "Max Folder test recursive")]
|
||||
[TestCase(@"c:\Test>", 3, 3, true, Reason = "2 Folders recursive")]
|
||||
[TestCase(@"c:\not-exist>", 3, 3, true, Reason = "Folder not exist, return root recursive")]
|
||||
[TestCase(@"c:\not-exist\not-exist2>", 0, 0, false, Reason = "Folder not exist, return root recursive")]
|
||||
public void Query_Recursive_WhenCalled(string search, int folders, int files, bool truncated)
|
||||
{
|
||||
const int maxFolderSetting = 3;
|
||||
|
||||
// Setup
|
||||
var folderSettings = new FolderSettings()
|
||||
{
|
||||
MaxFileResults = maxFolderSetting,
|
||||
MaxFolderResults = maxFolderSetting,
|
||||
};
|
||||
|
||||
var queryInternalDirectory = new QueryInternalDirectory(folderSettings, _queryFileSystemInfoMock, _fileSystem.Directory);
|
||||
|
||||
// Act
|
||||
var isDriveOrSharedFolder = queryInternalDirectory.Query(search)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<PackageReference Include="nunit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="12.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
@@ -17,6 +17,7 @@ namespace Microsoft.Plugin.Folder
|
||||
{
|
||||
internal class ContextMenuLoader : IContextMenu
|
||||
{
|
||||
private readonly IFileSystem _fileSystem = new FileSystem();
|
||||
private readonly PluginInitContext _context;
|
||||
|
||||
public ContextMenuLoader(PluginInitContext context)
|
||||
@@ -76,7 +77,7 @@ namespace Microsoft.Plugin.Folder
|
||||
{
|
||||
if (record.Type == ResultType.File)
|
||||
{
|
||||
Helper.OpenInConsole(Path.GetDirectoryName(record.FullPath));
|
||||
Helper.OpenInConsole(_fileSystem.Path.GetDirectoryName(record.FullPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Windows.Controls;
|
||||
using ManagedCommon;
|
||||
@@ -21,9 +22,10 @@ namespace Microsoft.Plugin.Folder
|
||||
public const string DeleteFileFolderImagePath = "Images\\delete.dark.png";
|
||||
public const string CopyImagePath = "Images\\copy.dark.png";
|
||||
|
||||
private static readonly IFileSystem _fileSystem = new FileSystem();
|
||||
private static readonly PluginJsonStorage<FolderSettings> _storage = new PluginJsonStorage<FolderSettings>();
|
||||
private static readonly FolderSettings _settings = _storage.Load();
|
||||
private static readonly IQueryInternalDirectory _internalDirectory = new QueryInternalDirectory(_settings, new QueryFileSystemInfo());
|
||||
private static readonly IQueryInternalDirectory _internalDirectory = new QueryInternalDirectory(_settings, new QueryFileSystemInfo(_fileSystem.DirectoryInfo), _fileSystem.Directory);
|
||||
private static readonly FolderHelper _folderHelper = new FolderHelper(new DriveInformation(), new FolderLinksSettings(_settings));
|
||||
|
||||
private static readonly ICollection<IFolderProcessor> _processors = new IFolderProcessor[]
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="System.IO.Abstractions" Version="12.2.5" />
|
||||
<PackageReference Include="System.Runtime" Version="4.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -2,17 +2,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace Microsoft.Plugin.Folder
|
||||
{
|
||||
public class SearchResult
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Wox.Infrastructure.FileSystemHelper;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources
|
||||
{
|
||||
public interface IQueryFileSystemInfo : IDirectoryWrapper
|
||||
public interface IQueryFileSystemInfo
|
||||
{
|
||||
IEnumerable<DisplayFileInfo> MatchFileSystemInfo(string search, string incompleteName, bool isRecursive);
|
||||
}
|
||||
|
||||
@@ -4,20 +4,22 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources
|
||||
{
|
||||
internal class DriveInformation : IDriveInformation
|
||||
{
|
||||
private static readonly IFileSystem _fileSystem = new FileSystem();
|
||||
private static readonly List<string> DriverNames = InitialDriverList().ToList();
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "Do not want to change the behavior of the application, but want to enforce static analysis")]
|
||||
private static IEnumerable<string> InitialDriverList()
|
||||
{
|
||||
var directorySeparatorChar = System.IO.Path.DirectorySeparatorChar;
|
||||
return DriveInfo.GetDrives()
|
||||
// Using InvariantCulture since this is internal
|
||||
var directorySeparatorChar = _fileSystem.Path.DirectorySeparatorChar;
|
||||
return _fileSystem.DriveInfo.GetDrives()
|
||||
.Select(driver => driver.Name.ToLower(CultureInfo.InvariantCulture).TrimEnd(directorySeparatorChar));
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
throw new ArgumentNullException(paramName: nameof(query));
|
||||
}
|
||||
|
||||
// Using OrdinalIgnoreCase since this is internal
|
||||
return _folderLinks.FolderLinks()
|
||||
.Where(x => x.Nickname.StartsWith(query, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
@@ -38,7 +39,8 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
throw new ArgumentNullException(nameof(search));
|
||||
}
|
||||
|
||||
if (search.StartsWith(@"\\", StringComparison.InvariantCulture))
|
||||
// Using Ordinal this is internal and we're comparing symbols
|
||||
if (search.StartsWith(@"\\", StringComparison.Ordinal))
|
||||
{ // share folder
|
||||
return true;
|
||||
}
|
||||
@@ -48,6 +50,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
|
||||
if (driverNames.Any())
|
||||
{
|
||||
// Using InvariantCultureIgnoreCase since this is searching for drive names
|
||||
if (driverNames.Any(dn => search.StartsWith(dn, StringComparison.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
// normal drive letter
|
||||
|
||||
@@ -2,20 +2,26 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using Wox.Infrastructure.FileSystemHelper;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources
|
||||
{
|
||||
public class QueryFileSystemInfo : DirectoryWrapper, IQueryFileSystemInfo
|
||||
public class QueryFileSystemInfo : IQueryFileSystemInfo
|
||||
{
|
||||
private readonly IDirectoryInfoFactory _directoryInfoFactory;
|
||||
|
||||
public QueryFileSystemInfo(IDirectoryInfoFactory directoryInfoFactory)
|
||||
{
|
||||
_directoryInfoFactory = directoryInfoFactory;
|
||||
}
|
||||
|
||||
public IEnumerable<DisplayFileInfo> MatchFileSystemInfo(string search, string incompleteName, bool isRecursive)
|
||||
{
|
||||
// search folder and add results
|
||||
var directoryInfo = new DirectoryInfo(search);
|
||||
var directoryInfo = _directoryInfoFactory.FromDirectoryName(search);
|
||||
var fileSystemInfos = directoryInfo.EnumerateFileSystemInfos(incompleteName, new EnumerationOptions()
|
||||
{
|
||||
MatchType = MatchType.Win32,
|
||||
@@ -30,7 +36,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
.Select(CreateDisplayFileInfo);
|
||||
}
|
||||
|
||||
private static DisplayFileInfo CreateDisplayFileInfo(FileSystemInfo fileSystemInfo)
|
||||
private static DisplayFileInfo CreateDisplayFileInfo(IFileSystemInfo fileSystemInfo)
|
||||
{
|
||||
return new DisplayFileInfo()
|
||||
{
|
||||
@@ -40,9 +46,9 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
};
|
||||
}
|
||||
|
||||
private static DisplayType GetDisplayType(FileSystemInfo fileSystemInfo)
|
||||
private static DisplayType GetDisplayType(IFileSystemInfo fileSystemInfo)
|
||||
{
|
||||
if (fileSystemInfo is DirectoryInfo)
|
||||
if (fileSystemInfo is IDirectoryInfo)
|
||||
{
|
||||
return DisplayType.Directory;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using ManagedCommon;
|
||||
using Microsoft.Plugin.Folder.Sources.Result;
|
||||
@@ -18,6 +19,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
{
|
||||
private readonly FolderSettings _settings;
|
||||
private readonly IQueryFileSystemInfo _queryFileSystemInfo;
|
||||
private readonly IDirectory _directory;
|
||||
|
||||
private static readonly HashSet<char> SpecialSearchChars = new HashSet<char>
|
||||
{
|
||||
@@ -26,10 +28,11 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
|
||||
private static string _warningIconPath;
|
||||
|
||||
public QueryInternalDirectory(FolderSettings folderSettings, IQueryFileSystemInfo queryFileSystemInfo)
|
||||
public QueryInternalDirectory(FolderSettings folderSettings, IQueryFileSystemInfo queryFileSystemInfo, IDirectory directory)
|
||||
{
|
||||
_settings = folderSettings;
|
||||
_queryFileSystemInfo = queryFileSystemInfo;
|
||||
_directory = directory;
|
||||
}
|
||||
|
||||
private static bool HasSpecialChars(string search)
|
||||
@@ -47,7 +50,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
private (string search, string incompleteName) Process(string search)
|
||||
{
|
||||
string incompleteName = string.Empty;
|
||||
if (HasSpecialChars(search) || !_queryFileSystemInfo.Exists($@"{search}\"))
|
||||
if (HasSpecialChars(search) || !_directory.Exists($@"{search}\"))
|
||||
{
|
||||
// if folder doesn't exist, we want to take the last part and use it afterwards to help the user
|
||||
// find the right folder.
|
||||
@@ -60,10 +63,11 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
}
|
||||
|
||||
// Remove everything after the last \ and add *
|
||||
// Using InvariantCulture since this is internal
|
||||
incompleteName = search.Substring(index + 1)
|
||||
.ToLower(CultureInfo.InvariantCulture) + "*";
|
||||
search = search.Substring(0, index + 1);
|
||||
if (!_queryFileSystemInfo.Exists(search))
|
||||
if (!_directory.Exists(search))
|
||||
{
|
||||
return default;
|
||||
}
|
||||
@@ -71,7 +75,8 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
else
|
||||
{
|
||||
// folder exist, add \ at the end of doesn't exist
|
||||
if (!search.EndsWith(@"\", StringComparison.InvariantCulture))
|
||||
// Using Ordinal since this is internal and is used for a symbol
|
||||
if (!search.EndsWith(@"\", StringComparison.Ordinal))
|
||||
{
|
||||
search += @"\";
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
|
||||
@@ -13,17 +13,31 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
private static readonly IShellAction ShellAction = new ShellAction();
|
||||
|
||||
private readonly IPath _path;
|
||||
|
||||
public FileItemResult()
|
||||
: this(new FileSystem().Path)
|
||||
{
|
||||
}
|
||||
|
||||
private FileItemResult(IPath path)
|
||||
{
|
||||
_path = path;
|
||||
}
|
||||
|
||||
public string FilePath { get; set; }
|
||||
|
||||
public string Title => Path.GetFileName(FilePath);
|
||||
public string Title => _path.GetFileName(FilePath);
|
||||
|
||||
public string Search { get; set; }
|
||||
|
||||
public Wox.Plugin.Result Create(IPublicAPI contextApi)
|
||||
{
|
||||
var result = new Wox.Plugin.Result(StringMatcher.FuzzySearch(Search, Path.GetFileName(FilePath)).MatchData)
|
||||
var result = new Wox.Plugin.Result(StringMatcher.FuzzySearch(Search, _path.GetFileName(FilePath)).MatchData)
|
||||
{
|
||||
Title = Title,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_file_result_subtitle, FilePath),
|
||||
IcoPath = FilePath,
|
||||
Action = c => ShellAction.Execute(FilePath, contextApi),
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
Title = Title,
|
||||
IcoPath = Path,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle),
|
||||
QueryTextDisplay = Path,
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path },
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
Title = Properties.Resources.Microsoft_plugin_folder_truncation_warning_title,
|
||||
QueryTextDisplay = Search,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Microsoft_plugin_folder_truncation_warning_subtitle, PostTruncationCount, PreTruncationCount),
|
||||
IcoPath = WarningIconPath,
|
||||
};
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
var sanitizedPath = Regex.Replace(search, @"[\/\\]+", "\\");
|
||||
|
||||
// A network path must start with \\
|
||||
if (!sanitizedPath.StartsWith("\\", StringComparison.InvariantCulture))
|
||||
// Using Ordinal since this is internal and used with a symbol
|
||||
if (!sanitizedPath.StartsWith("\\", StringComparison.Ordinal))
|
||||
{
|
||||
return sanitizedPath;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace Microsoft.Plugin.Folder
|
||||
{
|
||||
Title = Title,
|
||||
IcoPath = Path,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle),
|
||||
QueryTextDisplay = Path,
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path },
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -19,6 +19,8 @@ namespace Microsoft.Plugin.Indexer
|
||||
{
|
||||
internal class ContextMenuLoader : IContextMenu
|
||||
{
|
||||
private readonly IPath _path = new FileSystem().Path;
|
||||
|
||||
private readonly PluginInitContext _context;
|
||||
|
||||
public enum ResultType
|
||||
@@ -41,7 +43,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
var contextMenus = new List<ContextMenuResult>();
|
||||
if (selectedResult.ContextData is SearchResult record)
|
||||
{
|
||||
ResultType type = Path.HasExtension(record.Path) ? ResultType.File : ResultType.Folder;
|
||||
ResultType type = _path.HasExtension(record.Path) ? ResultType.File : ResultType.Folder;
|
||||
|
||||
if (type == ResultType.File)
|
||||
{
|
||||
@@ -95,7 +97,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
{
|
||||
if (type == ResultType.File)
|
||||
{
|
||||
Helper.OpenInConsole(Path.GetDirectoryName(record.Path));
|
||||
Helper.OpenInConsole(_path.GetDirectoryName(record.Path));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -147,9 +149,10 @@ namespace Microsoft.Plugin.Indexer
|
||||
// Function to test if the file can be run as admin
|
||||
private bool CanFileBeRunAsAdmin(string path)
|
||||
{
|
||||
string fileExtension = Path.GetExtension(path);
|
||||
string fileExtension = _path.GetExtension(path);
|
||||
foreach (string extension in appExtensions)
|
||||
{
|
||||
// Using OrdinalIgnoreCase since this is internal
|
||||
if (extension.Equals(fileExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Controls;
|
||||
@@ -24,6 +24,8 @@ namespace Microsoft.Plugin.Indexer
|
||||
{
|
||||
internal class Main : ISettingProvider, IPlugin, ISavable, IPluginI18n, IContextMenu, IDisposable, IDelayedExecutionPlugin
|
||||
{
|
||||
private static readonly IFileSystem _fileSystem = new FileSystem();
|
||||
|
||||
// This variable contains metadata about the Plugin
|
||||
private PluginInitContext _context;
|
||||
|
||||
@@ -38,7 +40,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
private readonly WindowsSearchAPI _api = new WindowsSearchAPI(_search);
|
||||
|
||||
// To obtain information regarding the drives that are indexed
|
||||
private readonly IndexerDriveDetection _driveDetection = new IndexerDriveDetection(new RegistryWrapper(), new DriveInfoWrapper());
|
||||
private readonly IndexerDriveDetection _driveDetection = new IndexerDriveDetection(new RegistryWrapper(), new DriveDetection.DriveInfoWrapper());
|
||||
|
||||
// Reserved keywords in oleDB
|
||||
private readonly string reservedStringPattern = @"^[\/\\\$\%]+$|^.*[<>].*$";
|
||||
@@ -110,12 +112,14 @@ namespace Microsoft.Plugin.Indexer
|
||||
foreach (var searchResult in searchResultsList)
|
||||
{
|
||||
var path = searchResult.Path;
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
var toolTipTitle = string.Format(CultureInfo.CurrentCulture, "{0} : {1}", Properties.Resources.Microsoft_plugin_indexer_name, searchResult.Title);
|
||||
var toolTipText = string.Format(CultureInfo.CurrentCulture, "{0} : {1}", Properties.Resources.Microsoft_plugin_indexer_path, path);
|
||||
string workingDir = null;
|
||||
if (_settings.UseLocationAsWorkingDir)
|
||||
{
|
||||
workingDir = Path.GetDirectoryName(path);
|
||||
workingDir = _fileSystem.Path.GetDirectoryName(path);
|
||||
}
|
||||
|
||||
Result r = new Result();
|
||||
@@ -149,7 +153,7 @@ namespace Microsoft.Plugin.Indexer
|
||||
r.ContextData = searchResult;
|
||||
|
||||
// If the result is a directory, then it's display should show a directory.
|
||||
if (Directory.Exists(path))
|
||||
if (_fileSystem.Directory.Exists(path))
|
||||
{
|
||||
r.QueryTextDisplay = path;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||
}
|
||||
|
||||
// # is URI syntax for the fragment component, need to be encoded so LocalPath returns complete path
|
||||
// Using OrdinalIgnoreCase since this is internal and used with symbols
|
||||
var string_path = ((string)oleDBResult.FieldData[0]).Replace("#", "%23", StringComparison.OrdinalIgnoreCase);
|
||||
var uri_path = new Uri(string_path);
|
||||
|
||||
@@ -89,10 +90,11 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||
// convert file pattern if it is not '*'. Don't create restriction for '*' as it includes all files.
|
||||
if (pattern != "*")
|
||||
{
|
||||
pattern = pattern.Replace("*", "%", StringComparison.InvariantCulture);
|
||||
pattern = pattern.Replace("?", "_", StringComparison.InvariantCulture);
|
||||
// Using Ordinal since these are internal and used with symbols
|
||||
pattern = pattern.Replace("*", "%", StringComparison.Ordinal);
|
||||
pattern = pattern.Replace("?", "_", StringComparison.Ordinal);
|
||||
|
||||
if (pattern.Contains("%", StringComparison.InvariantCulture) || pattern.Contains("_", StringComparison.InvariantCulture))
|
||||
if (pattern.Contains("%", StringComparison.Ordinal) || pattern.Contains("_", StringComparison.Ordinal))
|
||||
{
|
||||
queryHelper.QueryWhereRestrictions += " AND System.FileName LIKE '" + pattern + "' ";
|
||||
}
|
||||
|
||||
@@ -39,10 +39,13 @@
|
||||
</Item>
|
||||
<Item ItemId=";Microsoft_plugin_indexer_drivedetectionwarning" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
<Val><![CDATA[Warning: Not all files are indexed.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Upozornění: Ne všechny jednotky jsou indexované.]]></Val>
|
||||
<Val><![CDATA[Upozornění: Ne všechny soubory jsou indexované.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
||||
@@ -39,10 +39,13 @@
|
||||
</Item>
|
||||
<Item ItemId=";Microsoft_plugin_indexer_drivedetectionwarning" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
<Val><![CDATA[Warning: Not all files are indexed.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Warnung: Nicht alle Laufwerke sind indiziert.]]></Val>
|
||||
<Val><![CDATA[Warnung: Nicht alle Dateien sind indiziert.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
||||
@@ -39,10 +39,13 @@
|
||||
</Item>
|
||||
<Item ItemId=";Microsoft_plugin_indexer_drivedetectionwarning" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
<Val><![CDATA[Warning: Not all files are indexed.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Advertencia: No se indexaron todas las unidades.]]></Val>
|
||||
<Val><![CDATA[Advertencia: No se indexaron todos los archivos.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
||||
@@ -39,10 +39,13 @@
|
||||
</Item>
|
||||
<Item ItemId=";Microsoft_plugin_indexer_drivedetectionwarning" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
<Val><![CDATA[Warning: Not all files are indexed.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[警告: すべてのドライブがインデックス化されているわけではありません。]]></Val>
|
||||
<Val><![CDATA[警告: すべてのファイルがインデックス化されているわけではありません。]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
||||
@@ -39,10 +39,13 @@
|
||||
</Item>
|
||||
<Item ItemId=";Microsoft_plugin_indexer_drivedetectionwarning" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
<Val><![CDATA[Warning: Not all files are indexed.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Waarschuwing: niet alle stations zijn geïndexeerd.]]></Val>
|
||||
<Val><![CDATA[Waarschuwing: niet alle bestanden zijn geïndexeerd.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
||||
@@ -39,10 +39,13 @@
|
||||
</Item>
|
||||
<Item ItemId=";Microsoft_plugin_indexer_drivedetectionwarning" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
<Val><![CDATA[Warning: Not all files are indexed.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Ostrzeżenie: Nie wszystkie dyski są indeksowane.]]></Val>
|
||||
<Val><![CDATA[Ostrzeżenie: Nie wszystkie pliki są indeksowane.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
||||
@@ -39,10 +39,13 @@
|
||||
</Item>
|
||||
<Item ItemId=";Microsoft_plugin_indexer_drivedetectionwarning" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
<Val><![CDATA[Warning: Not all files are indexed.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Внимание! Проиндексированы не все диски.]]></Val>
|
||||
<Val><![CDATA[Предупреждение: индексируются не все файлы.]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
||||
@@ -39,10 +39,13 @@
|
||||
</Item>
|
||||
<Item ItemId=";Microsoft_plugin_indexer_drivedetectionwarning" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
<Val><![CDATA[Warning: Not all files are indexed.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[警告: 並非所有磁碟機皆已編製索引。]]></Val>
|
||||
<Val><![CDATA[警告: 並非所有檔案皆已編製索引。]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Warning: Not all drives are indexed.]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
||||
@@ -567,6 +567,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
var result = _cmderRunCommand.Result("cmder", string.Empty, mock.Object);
|
||||
|
||||
// Assert
|
||||
// Using Ordinal since this is used internally
|
||||
Assert.IsTrue(result.Title.Equals(_cmderRunCommand.Name, StringComparison.Ordinal));
|
||||
Assert.IsFalse(result.Title.Equals(_cmderRunCommand.Description, StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using Microsoft.Plugin.Program.Programs;
|
||||
using Microsoft.Plugin.Program.Storage;
|
||||
@@ -209,7 +210,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
FileSystemEventArgs e = new FileSystemEventArgs(WatcherChangeTypes.Created, "directory", path);
|
||||
|
||||
// File.ReadAllLines must be mocked for url applications
|
||||
var mockFile = new Mock<IFileWrapper>();
|
||||
var mockFile = new Mock<IFile>();
|
||||
mockFile.Setup(m => m.ReadAllLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
|
||||
Win32Program.FileWrapper = mockFile.Object;
|
||||
|
||||
@@ -256,7 +257,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
FileSystemEventArgs e = new FileSystemEventArgs(WatcherChangeTypes.Deleted, directory, path);
|
||||
|
||||
// File.ReadAllLines must be mocked for url applications
|
||||
var mockFile = new Mock<IFileWrapper>();
|
||||
var mockFile = new Mock<IFile>();
|
||||
mockFile.Setup(m => m.ReadAllLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
|
||||
Win32Program.FileWrapper = mockFile.Object;
|
||||
|
||||
@@ -279,7 +280,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
RenamedEventArgs e = new RenamedEventArgs(WatcherChangeTypes.Renamed, directory, newpath, oldpath);
|
||||
|
||||
// File.ReadAllLines must be mocked for url applications
|
||||
var mockFile = new Mock<IFileWrapper>();
|
||||
var mockFile = new Mock<IFile>();
|
||||
mockFile.Setup(m => m.ReadAllLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
|
||||
Win32Program.FileWrapper = mockFile.Object;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security;
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Microsoft.Plugin.Program
|
||||
{
|
||||
for (var i = 1; i < query.Terms.Count; i++)
|
||||
{
|
||||
// Using Ordinal since this is internal and used with a symbol
|
||||
if (!string.Equals(query.Terms[i], DoubleDash, StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.IO;
|
||||
using System.IO.Abstractions;
|
||||
|
||||
namespace Microsoft.Plugin.Program
|
||||
{
|
||||
@@ -16,11 +16,13 @@ namespace Microsoft.Plugin.Program
|
||||
/// </remarks>
|
||||
public class ProgramSource
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
|
||||
private string name;
|
||||
|
||||
public string Location { get; set; }
|
||||
|
||||
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
|
||||
public string Name { get => name ?? FileSystem.DirectoryInfo.FromDirectoryName(Location).Name; set => name = value; }
|
||||
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -19,6 +19,8 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
[Serializable]
|
||||
public partial class UWP
|
||||
{
|
||||
private static readonly IPath Path = new FileSystem().Path;
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string FullName { get; }
|
||||
@@ -204,6 +206,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
if (obj is UWP uwp)
|
||||
{
|
||||
// Using CurrentCultureIgnoreCase since this is used with FamilyName
|
||||
return FamilyName.Equals(uwp.FamilyName, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
else
|
||||
@@ -214,6 +217,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
// Using CurrentCultureIgnoreCase since this is used with FamilyName
|
||||
return FamilyName.GetHashCode(StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -31,6 +32,10 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
[Serializable]
|
||||
public class UWPApplication : IProgram
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
|
||||
public string AppListEntry { get; set; }
|
||||
|
||||
public string UniqueIdentifier { get; set; }
|
||||
@@ -111,6 +116,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
result.Title = DisplayName;
|
||||
result.SetTitleHighlightData(StringMatcher.FuzzySearch(query, Name).MatchData);
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
var toolTipTitle = string.Format(CultureInfo.CurrentCulture, "{0}: {1}", Properties.Resources.powertoys_run_plugin_program_file_name, result.Title);
|
||||
var toolTipText = string.Format(CultureInfo.CurrentCulture, "{0}: {1}", Properties.Resources.powertoys_run_plugin_program_file_path, Package.Location);
|
||||
result.ToolTipData = new ToolTipData(toolTipTitle, toolTipText);
|
||||
@@ -263,6 +269,8 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
if (File.Exists(manifest))
|
||||
{
|
||||
var file = File.ReadAllText(manifest);
|
||||
|
||||
// Using OrdinalIgnoreCase since this is used internally
|
||||
if (file.Contains("TrustLevel=\"mediumIL\"", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
@@ -276,12 +284,16 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
internal string ResourceFromPri(string packageFullName, string resourceReference)
|
||||
{
|
||||
const string prefix = "ms-resource:";
|
||||
|
||||
// Using OrdinalIgnoreCase since this is used internally
|
||||
if (!string.IsNullOrWhiteSpace(resourceReference) && resourceReference.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// magic comes from @talynone
|
||||
// https://github.com/talynone/Wox.Plugin.WindowsUniversalAppLauncher/blob/master/StoreAppLauncher/Helpers/NativeApiHelper.cs#L139-L153
|
||||
string key = resourceReference.Substring(prefix.Length);
|
||||
string parsed;
|
||||
|
||||
// Using Ordinal/OrdinalIgnorcase since these are used internally
|
||||
if (key.StartsWith("//", StringComparison.Ordinal))
|
||||
{
|
||||
parsed = prefix + key;
|
||||
@@ -540,6 +552,8 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
// windows 8 https://msdn.microsoft.com/en-us/library/windows/apps/br211475.aspx
|
||||
string path;
|
||||
bool isLogoUriSet;
|
||||
|
||||
// Using Ordinal since this is used internally with uri
|
||||
if (uri.Contains("\\", StringComparison.Ordinal))
|
||||
{
|
||||
path = Path.Combine(Package.Location, uri);
|
||||
@@ -598,6 +612,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
string currentBackgroundColor;
|
||||
if (BackgroundColor == "transparent")
|
||||
{
|
||||
// Using InvariantCulture since this is internal
|
||||
currentBackgroundColor = SystemParameters.WindowGlassBrush.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
@@ -20,12 +21,18 @@ using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.FileSystemHelper;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
using DirectoryWrapper = Wox.Infrastructure.FileSystemHelper.DirectoryWrapper;
|
||||
|
||||
namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
[Serializable]
|
||||
public class Win32Program : IProgram
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string UniqueIdentifier { get; set; }
|
||||
@@ -57,7 +64,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
// Wrappers for File Operations
|
||||
public static IFileVersionInfoWrapper FileVersionInfoWrapper { get; set; } = new FileVersionInfoWrapper();
|
||||
|
||||
public static IFileWrapper FileWrapper { get; set; } = new FileWrapper();
|
||||
public static IFile FileWrapper { get; set; } = new FileSystem().File;
|
||||
|
||||
public static IShellLinkHelper Helper { get; set; } = new ShellLinkHelper();
|
||||
|
||||
@@ -98,6 +105,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
// To Filter PWAs when the user searches for the main application
|
||||
// All Chromium based applications contain the --app-id argument
|
||||
// Reference : https://codereview.chromium.org/399045/show
|
||||
// Using Ordinal IgnoreCase since this is used internally
|
||||
bool isWebApplication = FullPath.Contains(ProxyWebApp, StringComparison.OrdinalIgnoreCase) && Arguments.Contains(AppIdArgument, StringComparison.OrdinalIgnoreCase);
|
||||
return isWebApplication;
|
||||
}
|
||||
@@ -121,6 +129,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
// check if any space separated query is a part of the app name or path name
|
||||
foreach (var subquery in subqueries)
|
||||
{
|
||||
// Using OrdinalIgnoreCase since these are used internally
|
||||
if (FullPath.Contains(subquery, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
pathContainsQuery = true;
|
||||
@@ -172,6 +181,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
{
|
||||
if (query != null && AppType == ApplicationType.RunCommand)
|
||||
{
|
||||
// Using OrdinalIgnoreCase since this is used internally
|
||||
if (!query.Equals(Name, StringComparison.OrdinalIgnoreCase) && !query.Equals(ExecutableName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
@@ -235,6 +245,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
result.Title = Name;
|
||||
result.SetTitleHighlightData(StringMatcher.FuzzySearch(query, Name).MatchData);
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
var toolTipTitle = string.Format(CultureInfo.CurrentCulture, "{0}: {1}", Properties.Resources.powertoys_run_plugin_program_file_name, result.Title);
|
||||
var toolTipText = string.Format(CultureInfo.CurrentCulture, "{0}: {1}", Properties.Resources.powertoys_run_plugin_program_file_path, FullPath);
|
||||
result.ToolTipData = new ToolTipData(toolTipTitle, toolTipText);
|
||||
@@ -342,6 +353,8 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
Name = Path.GetFileNameWithoutExtension(path),
|
||||
ExecutableName = Path.GetFileName(path),
|
||||
IcoPath = path,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
FullPath = path.ToLower(CultureInfo.CurrentCulture),
|
||||
UniqueIdentifier = path,
|
||||
ParentDirectory = Directory.GetParent(path).FullName,
|
||||
@@ -384,6 +397,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
// Using OrdinalIgnoreCase since this is used internally
|
||||
if (line.StartsWith(urlPrefix, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
urlPath = line.Substring(urlPrefix.Length);
|
||||
@@ -407,6 +421,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
}
|
||||
}
|
||||
|
||||
// Using OrdinalIgnoreCase since this is used internally
|
||||
if (line.StartsWith(iconFilePrefix, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
iconPath = line.Substring(iconFilePrefix.Length);
|
||||
@@ -465,6 +480,8 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
if (File.Exists(target) || Directory.Exists(target))
|
||||
{
|
||||
program.LnkResolvedPath = program.FullPath;
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
program.FullPath = Path.GetFullPath(target).ToLower(CultureInfo.CurrentCulture);
|
||||
program.AppType = GetAppTypeFromPath(target);
|
||||
|
||||
@@ -543,6 +560,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
string extension = Extension(path);
|
||||
ApplicationType appType = ApplicationType.GenericFile;
|
||||
|
||||
// Using OrdinalIgnoreCase since these are used internally with paths
|
||||
if (ExecutableApplicationExtensions.Contains(extension))
|
||||
{
|
||||
appType = ApplicationType.Win32Application;
|
||||
@@ -677,6 +695,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
|
||||
private static string Extension(string path)
|
||||
{
|
||||
// Using CurrentCulture since this is user facing
|
||||
var extension = Path.GetExtension(path)?.ToLower(CultureInfo.CurrentCulture);
|
||||
|
||||
if (!string.IsNullOrEmpty(extension))
|
||||
@@ -734,6 +753,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
.Distinct()
|
||||
.ToArray();
|
||||
|
||||
// Using OrdinalIgnoreCase since this is used internally with paths
|
||||
var programs1 = allPaths.AsParallel().Where(p => Extension(p).Equals(ShortcutExtension, StringComparison.OrdinalIgnoreCase)).Select(LnkProgram);
|
||||
var programs2 = allPaths.AsParallel().Where(p => Extension(p).Equals(ApplicationReferenceExtension, StringComparison.OrdinalIgnoreCase)).Select(CreateWin32Program);
|
||||
var programs3 = allPaths.AsParallel().Where(p => Extension(p).Equals(InternetShortcutExtension, StringComparison.OrdinalIgnoreCase)).Select(InternetShortcutProgram);
|
||||
@@ -768,6 +788,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
.Distinct()
|
||||
.ToArray();
|
||||
|
||||
// Using OrdinalIgnoreCase since this is used internally with paths
|
||||
var programs1 = paths.AsParallel().Where(p => Extension(p).Equals(ShortcutExtension, StringComparison.OrdinalIgnoreCase)).Select(LnkProgram);
|
||||
var programs2 = paths.AsParallel().Where(p => Extension(p).Equals(ApplicationReferenceExtension, StringComparison.OrdinalIgnoreCase)).Select(CreateWin32Program);
|
||||
var programs3 = paths.AsParallel().Where(p => Extension(p).Equals(InternetShortcutExtension, StringComparison.OrdinalIgnoreCase)).Select(InternetShortcutProgram);
|
||||
@@ -908,6 +929,7 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
&& !string.IsNullOrEmpty(app1.ExecutableName) && !string.IsNullOrEmpty(app2.ExecutableName)
|
||||
&& !string.IsNullOrEmpty(app1.FullPath) && !string.IsNullOrEmpty(app2.FullPath))
|
||||
{
|
||||
// Using OrdinalIgnoreCase since this is used internally
|
||||
return app1.Name.Equals(app2.Name, StringComparison.OrdinalIgnoreCase)
|
||||
&& app1.ExecutableName.Equals(app2.ExecutableName, StringComparison.OrdinalIgnoreCase)
|
||||
&& app1.FullPath.Equals(app2.FullPath, StringComparison.OrdinalIgnoreCase);
|
||||
@@ -924,6 +946,8 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
int fullPathPrime = 31;
|
||||
|
||||
int result = 1;
|
||||
|
||||
// Using Ordinal since this is used internally
|
||||
result = (result * namePrime) + obj.Name.ToUpperInvariant().GetHashCode(StringComparison.Ordinal);
|
||||
result = (result * executablePrime) + obj.ExecutableName.ToUpperInvariant().GetHashCode(StringComparison.Ordinal);
|
||||
result = (result * fullPathPrime) + obj.FullPath.ToUpperInvariant().GetHashCode(StringComparison.Ordinal);
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
// To obtain the last event associated with a particular app.
|
||||
while (eventHandlingQueue.TryPeek(out string currentAppPath))
|
||||
{
|
||||
// Using OrdinalIgnoreCase since this is used internally with paths
|
||||
if (string.IsNullOrEmpty(previousAppPath) || previousAppPath.Equals(currentAppPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// To dequeue a path only if it is the first one in the queue or if the path was the same as thre previous one (to avoid trying to create apps on duplicate events)
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Threading.Tasks;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Plugin.Logger;
|
||||
@@ -17,6 +18,9 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
{
|
||||
internal class Win32ProgramRepository : ListRepository<Programs.Win32Program>, IProgramRepository
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
|
||||
private const string LnkExtension = ".lnk";
|
||||
private const string UrlExtension = ".url";
|
||||
|
||||
@@ -145,6 +149,7 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
try
|
||||
{
|
||||
// To mitigate the issue of not having a FullPath for a shortcut app, we iterate through the items and find the app with the same hashcode.
|
||||
// Using OrdinalIgnoreCase since this is used internally
|
||||
if (extension.Equals(LnkExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
app = GetAppWithSameLnkResolvedPath(path);
|
||||
@@ -174,6 +179,7 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
{
|
||||
foreach (Win32Program app in Items)
|
||||
{
|
||||
// Using CurrentCultureIgnoreCase since application names could be dependent on currentculture See: https://github.com/microsoft/PowerToys/pull/5847/files#r468245190
|
||||
if (name.Equals(app.Name, StringComparison.CurrentCultureIgnoreCase) && executableName.Equals(app.ExecutableName, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
return app;
|
||||
@@ -189,7 +195,8 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
{
|
||||
foreach (Programs.Win32Program app in Items)
|
||||
{
|
||||
if (lnkResolvedPath.ToLower(CultureInfo.CurrentCulture).Equals(app.LnkResolvedPath, StringComparison.CurrentCultureIgnoreCase))
|
||||
// Using Invariant / OrdinalIgnoreCase since we're comparing paths
|
||||
if (lnkResolvedPath.ToUpperInvariant().Equals(app.LnkResolvedPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return app;
|
||||
}
|
||||
@@ -201,7 +208,9 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
private void OnAppCreated(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
string path = e.FullPath;
|
||||
if (!Path.GetExtension(path).Equals(UrlExtension, StringComparison.CurrentCultureIgnoreCase) && !Path.GetExtension(path).Equals(LnkExtension, StringComparison.CurrentCultureIgnoreCase))
|
||||
|
||||
// Using OrdinalIgnoreCase since we're comparing extensions
|
||||
if (!Path.GetExtension(path).Equals(UrlExtension, StringComparison.OrdinalIgnoreCase) && !Path.GetExtension(path).Equals(LnkExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Programs.Win32Program app = Programs.Win32Program.GetAppFromPath(path);
|
||||
if (app != null)
|
||||
@@ -214,7 +223,9 @@ namespace Microsoft.Plugin.Program.Storage
|
||||
private void OnAppChanged(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
string path = e.FullPath;
|
||||
if (Path.GetExtension(path).Equals(UrlExtension, StringComparison.CurrentCultureIgnoreCase) || Path.GetExtension(path).Equals(LnkExtension, StringComparison.CurrentCultureIgnoreCase))
|
||||
|
||||
// Using OrdinalIgnoreCase since we're comparing extensions
|
||||
if (Path.GetExtension(path).Equals(UrlExtension, StringComparison.OrdinalIgnoreCase) || Path.GetExtension(path).Equals(LnkExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// When a url or lnk app is installed, multiple created and changed events are triggered.
|
||||
// To prevent the code from acting on the first such event (which may still be during app installation), the events are added a common queue and dequeued by a background task at regular intervals - https://github.com/microsoft/PowerToys/issues/6429.
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Input;
|
||||
@@ -23,6 +24,11 @@ namespace Microsoft.Plugin.Shell
|
||||
{
|
||||
public class Main : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, ISavable
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
|
||||
private readonly ShellPluginSettings _settings;
|
||||
private readonly PluginJsonStorage<ShellPluginSettings> _storage;
|
||||
|
||||
@@ -84,6 +90,7 @@ namespace Microsoft.Plugin.Shell
|
||||
{
|
||||
if (m.Key == cmd)
|
||||
{
|
||||
// Using CurrentCulture since this is user facing
|
||||
result.SubTitle = Properties.Resources.wox_plugin_cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_cmd_cmd_has_been_executed_times, m.Value);
|
||||
return null;
|
||||
}
|
||||
@@ -91,6 +98,8 @@ namespace Microsoft.Plugin.Shell
|
||||
var ret = new Result
|
||||
{
|
||||
Title = m.Key,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = Properties.Resources.wox_plugin_cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_cmd_cmd_has_been_executed_times, m.Value),
|
||||
IcoPath = IconPath,
|
||||
Action = c =>
|
||||
@@ -128,6 +137,8 @@ namespace Microsoft.Plugin.Shell
|
||||
.Select(m => new Result
|
||||
{
|
||||
Title = m.Key,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = Properties.Resources.wox_plugin_cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_cmd_cmd_has_been_executed_times, m.Value),
|
||||
IcoPath = IconPath,
|
||||
Action = c =>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Text;
|
||||
using ManagedCommon;
|
||||
using Microsoft.Plugin.Uri.UriHelper;
|
||||
@@ -17,6 +17,10 @@ namespace Microsoft.Plugin.Uri
|
||||
{
|
||||
public class Main : IPlugin, IPluginI18n, IContextMenu, ISavable, IDisposable
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
|
||||
private readonly ExtendedUriParser _uriParser;
|
||||
private readonly UriResolver _uriResolver;
|
||||
private readonly PluginJsonStorage<UriSettings> _storage;
|
||||
@@ -119,6 +123,7 @@ namespace Microsoft.Plugin.Uri
|
||||
?? _registryWrapper.GetRegistryValue("HKEY_CLASSES_ROOT\\" + progId + "\\DefaultIcon", null);
|
||||
|
||||
// "Handles 'Indirect Strings' (UWP programs)"
|
||||
// Using Ordinal since this is internal and used with a symbol
|
||||
if (programLocation.StartsWith("@", StringComparison.Ordinal))
|
||||
{
|
||||
var directProgramLocationStringBuilder = new StringBuilder(128);
|
||||
@@ -137,6 +142,7 @@ namespace Microsoft.Plugin.Uri
|
||||
}
|
||||
else
|
||||
{
|
||||
// Using Ordinal since this is internal and used with a symbol
|
||||
var indexOfComma = programLocation.IndexOf(',', StringComparison.Ordinal);
|
||||
BrowserIconPath = indexOfComma > 0
|
||||
? programLocation.Substring(0, indexOfComma)
|
||||
|
||||
@@ -18,9 +18,10 @@ namespace Microsoft.Plugin.Uri.UriHelper
|
||||
}
|
||||
|
||||
// Handle common cases UriBuilder does not handle
|
||||
if (input.EndsWith(":", StringComparison.Ordinal)
|
||||
|| input.EndsWith(".", StringComparison.Ordinal)
|
||||
|| input.EndsWith(":/", StringComparison.Ordinal))
|
||||
// Using CurrentCulture since this is a user typed string
|
||||
if (input.EndsWith(":", StringComparison.CurrentCulture)
|
||||
|| input.EndsWith(".", StringComparison.CurrentCulture)
|
||||
|| input.EndsWith(":/", StringComparison.CurrentCulture))
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
throw new ArgumentNullException(nameof(text));
|
||||
}
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
searchText = searchText.ToLower(CultureInfo.CurrentCulture);
|
||||
text = text.ToLower(CultureInfo.CurrentCulture);
|
||||
|
||||
|
||||
@@ -563,6 +563,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
// Using CurrentCulture since this is user facing
|
||||
return string.Format(System.Globalization.CultureInfo.CurrentCulture, "{{Left={0},Top={1},Right={2},Bottom={3}}}", Left, Top, Right, Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
|
||||
set
|
||||
{
|
||||
// Using CurrentCulture since this is user facing
|
||||
searchText = value.ToLower(CultureInfo.CurrentCulture).Trim();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,6 +252,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
// 1) There is a weird flashing behavior when trying
|
||||
// to use ShowWindow for switching tabs in IE
|
||||
// 2) SetForegroundWindow fails on minimized windows
|
||||
// Using Ordinal since this is internal
|
||||
if (ProcessName.ToUpperInvariant().Equals("IEXPLORE.EXE", StringComparison.Ordinal) || !Minimized)
|
||||
{
|
||||
NativeMethods.SetForegroundWindow(Hwnd);
|
||||
@@ -270,6 +271,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
/// <returns>The title of the window</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
// Using CurrentCulture since this is user facing
|
||||
return Title + " (" + ProcessName.ToUpper(CultureInfo.CurrentCulture) + ")";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
<Application x:Class="PowerLauncher.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:theming="clr-namespace:Wox.Plugin;assembly=Wox.Plugin"
|
||||
ShutdownMode="OnMainWindowClose"
|
||||
Startup="OnStartup">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<theming:CustomLibraryThemeProvider x:Key="{x:Static theming:CustomLibraryThemeProvider.DefaultInstance}" />
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Themes/Dark.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace PowerLauncher.Helper
|
||||
{
|
||||
string uriString = uri.AbsoluteUri;
|
||||
|
||||
int commaIndex = uriString.IndexOf(',', StringComparison.InvariantCultureIgnoreCase);
|
||||
// Using Ordinal since this is internal and used with a symbol
|
||||
int commaIndex = uriString.IndexOf(',', StringComparison.Ordinal);
|
||||
var headers = uriString.Substring(0, commaIndex).Split(';');
|
||||
_contentType = headers[0];
|
||||
string dataString = uriString.Substring(commaIndex + 1);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.IO.Pipes;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@@ -29,6 +30,10 @@ namespace PowerLauncher.Helper
|
||||
public static class SingleInstance<TApplication>
|
||||
where TApplication : Application, ISingleInstanceApp
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
|
||||
/// <summary>
|
||||
/// String delimiter used in channel names.
|
||||
/// </summary>
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
@@ -21,6 +22,9 @@ namespace PowerLauncher
|
||||
{
|
||||
internal partial class ReportWindow
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
|
||||
public ReportWindow(Exception exception)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -44,7 +48,9 @@ namespace PowerLauncher
|
||||
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.AppendLine(ErrorReporting.RuntimeInfo());
|
||||
content.AppendLine($"Date: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
|
||||
|
||||
// Using CurrentCulture since this is displayed to user in the report window
|
||||
content.AppendLine($"Date: {DateTime.Now.ToString(CultureInfo.CurrentCulture)}");
|
||||
content.AppendLine("Exception:");
|
||||
content.AppendLine(exception.ToString());
|
||||
var paragraph = new Paragraph();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Threading;
|
||||
using System.Windows.Input;
|
||||
using ManagedCommon;
|
||||
@@ -26,14 +27,14 @@ namespace PowerLauncher
|
||||
|
||||
private const int MaxRetries = 10;
|
||||
private static readonly object _watcherSyncObject = new object();
|
||||
private readonly FileSystemWatcher _watcher;
|
||||
private readonly IFileSystemWatcher _watcher;
|
||||
private readonly PowerToysRunSettings _settings;
|
||||
|
||||
private readonly ThemeManager _themeManager;
|
||||
|
||||
public SettingsWatcher(PowerToysRunSettings settings, ThemeManager themeManager)
|
||||
{
|
||||
_settingsUtils = new SettingsUtils(new SystemIOProvider());
|
||||
_settingsUtils = new SettingsUtils();
|
||||
_settings = settings;
|
||||
_themeManager = themeManager;
|
||||
|
||||
@@ -92,6 +93,7 @@ namespace PowerLauncher
|
||||
_settings.IgnoreHotkeysOnFullscreen = overloadSettings.Properties.IgnoreHotkeysInFullscreen;
|
||||
}
|
||||
|
||||
// Using OrdinalIgnoreCase since this is internal
|
||||
var indexer = PluginManager.AllPlugins.Find(p => p.Metadata.Name.Equals("Windows Indexer", StringComparison.OrdinalIgnoreCase));
|
||||
if (indexer != null)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
@@ -14,6 +12,7 @@
|
||||
<system:String x:Key="Theme.BaseColorScheme">Dark</system:String>
|
||||
<system:String x:Key="Theme.ColorScheme">Accent1</system:String>
|
||||
<Color x:Key="Theme.PrimaryAccentColor">Black</Color>
|
||||
<system:Boolean x:Key="Theme.IsHighContrast">False</system:Boolean>
|
||||
|
||||
<Color x:Key="SystemBaseMediumLowColor">#FF818181</Color>
|
||||
<SolidColorBrush x:Key="SystemChromeLow" Color="#FF171717" options:Freeze="True" />
|
||||
@@ -37,7 +36,7 @@
|
||||
|
||||
<Color x:Key="ScrollBarBackgroundPointerOver">#FF1b1b1b</Color>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FFcdcdcd</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FFcdcdcd" />
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FFcdcdcd</Color>
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FF171717</Color>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
@@ -14,6 +12,7 @@
|
||||
<system:String x:Key="Theme.BaseColorScheme">HighContrast</system:String>
|
||||
<system:String x:Key="Theme.ColorScheme">Accent2</system:String>
|
||||
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
|
||||
<system:Boolean x:Key="Theme.IsHighContrast">True</system:Boolean>
|
||||
|
||||
<Color x:Key="SystemBaseMediumLowColor">#ffff00</Color>
|
||||
<SolidColorBrush x:Key="SystemChromeLow" Color="Black" options:Freeze="True" />
|
||||
@@ -37,7 +36,7 @@
|
||||
|
||||
<Color x:Key="ScrollBarBackgroundPointerOver">#FF000000</Color>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FFFFFFFF</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FFFFFFFF" />
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FFFFFFFF</Color>
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FFFFFFFF</Color>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
@@ -14,6 +12,7 @@
|
||||
<system:String x:Key="Theme.BaseColorScheme">HighContrast</system:String>
|
||||
<system:String x:Key="Theme.ColorScheme">Accent3</system:String>
|
||||
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
|
||||
<system:Boolean x:Key="Theme.IsHighContrast">True</system:Boolean>
|
||||
|
||||
<Color x:Key="SystemBaseMediumLowColor">#ffff00</Color>
|
||||
<SolidColorBrush x:Key="SystemChromeLow" Color="Black" options:Freeze="True" />
|
||||
@@ -37,7 +36,7 @@
|
||||
|
||||
<Color x:Key="ScrollBarBackgroundPointerOver">#FF000000</Color>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FFFFFFFF</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FFFFFFFF" />
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FFFFFFFF</Color>
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FFFFFFFF</Color>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
@@ -14,6 +12,7 @@
|
||||
<system:String x:Key="Theme.BaseColorScheme">HighContrast</system:String>
|
||||
<system:String x:Key="Theme.ColorScheme">Accent4</system:String>
|
||||
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
|
||||
<system:Boolean x:Key="Theme.IsHighContrast">True</system:Boolean>
|
||||
|
||||
<Color x:Key="SystemBaseMediumLowColor">#66FFFFFF</Color>
|
||||
<SolidColorBrush x:Key="SystemChromeLow" Color="Black" options:Freeze="True" />
|
||||
@@ -37,7 +36,7 @@
|
||||
|
||||
<Color x:Key="ScrollBarBackgroundPointerOver">#FF000000</Color>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FFFFFFFF</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FFFFFFFF" />
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FFFFFFFF</Color>
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FFFFFFFF</Color>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
@@ -14,6 +12,7 @@
|
||||
<system:String x:Key="Theme.BaseColorScheme">HighContrast</system:String>
|
||||
<system:String x:Key="Theme.ColorScheme">Accent5</system:String>
|
||||
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
|
||||
<system:Boolean x:Key="Theme.IsHighContrast">True</system:Boolean>
|
||||
|
||||
<Color x:Key="SystemBaseMediumLowColor">#66000000</Color>
|
||||
<SolidColorBrush x:Key="SystemChromeLow" Color="White" options:Freeze="True" />
|
||||
@@ -37,7 +36,7 @@
|
||||
|
||||
<Color x:Key="ScrollBarBackgroundPointerOver">#FFf0f0f0</Color>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FF000000</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FF000000" />
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FF000000</Color>
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FF000000</Color>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
@@ -14,6 +12,7 @@
|
||||
<system:String x:Key="Theme.BaseColorScheme">Light</system:String>
|
||||
<system:String x:Key="Theme.ColorScheme">Accent1</system:String>
|
||||
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
|
||||
<system:Boolean x:Key="Theme.IsHighContrast">False</system:Boolean>
|
||||
|
||||
<Color x:Key="SystemBaseMediumLowColor">#66000000</Color>
|
||||
<SolidColorBrush x:Key="SystemChromeLow" Color="#FFF2F2F2" options:Freeze="True" />
|
||||
@@ -37,7 +36,7 @@
|
||||
|
||||
<Color x:Key="ScrollBarBackgroundPointerOver">#FFf0f0f0</Color>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FF1d1d1d</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FF1d1d1d" />
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FF1d1d1d</Color>
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FFf3f3f3</Color>
|
||||
|
||||
|
||||
@@ -132,6 +132,7 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
if (index != null)
|
||||
{
|
||||
// Using InvariantCulture since this is internal
|
||||
results.SelectedIndex = int.Parse(index.ToString(), CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
@@ -438,8 +439,9 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
private void QueryHistory()
|
||||
{
|
||||
// Using CurrentCulture since query is received from user and used in downstream comparisons using CurrentCulture
|
||||
#pragma warning disable CA1308 // Normalize strings to uppercase
|
||||
var query = QueryText.ToLower(CultureInfo.InvariantCulture).Trim();
|
||||
var query = QueryText.ToLower(CultureInfo.CurrentCulture).Trim();
|
||||
#pragma warning restore CA1308 // Normalize strings to uppercase
|
||||
History.Clear();
|
||||
|
||||
@@ -528,6 +530,7 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
lock (_addResultsLock)
|
||||
{
|
||||
// Using CurrentCultureIgnoreCase since this is user facing
|
||||
if (queryText.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Results.Clear();
|
||||
@@ -565,6 +568,7 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
lock (_addResultsLock)
|
||||
{
|
||||
// Using CurrentCultureIgnoreCase since this is user facing
|
||||
if (queryText.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
currentCancellationToken.ThrowIfCancellationRequested();
|
||||
@@ -630,6 +634,7 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
// Using CurrentCultureIgnoreCase since this is user facing
|
||||
if (queryText.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
Results.Results.NotifyChanges();
|
||||
@@ -818,6 +823,7 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
// Using CurrentCultureIgnoreCase since this is user facing
|
||||
if (originQuery.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
ct.ThrowIfCancellationRequested();
|
||||
@@ -879,6 +885,7 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
// Using Ordinal this is internal
|
||||
return string.IsNullOrEmpty(queryText) || autoCompleteText.IndexOf(queryText, StringComparison.Ordinal) != 0;
|
||||
}
|
||||
}
|
||||
@@ -889,6 +896,7 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
// Using OrdinalIgnoreCase because we want the characters to be exact in autocomplete text and the query
|
||||
if (input.IndexOf(query, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
// Use the same case as the input query for the matched portion of the string
|
||||
@@ -906,6 +914,7 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
if (index == 0 && !string.IsNullOrEmpty(query))
|
||||
{
|
||||
// Using OrdinalIgnoreCase since this is internal
|
||||
if (input.IndexOf(query, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
return query + input.Substring(query.Length);
|
||||
|
||||
@@ -120,10 +120,13 @@
|
||||
</Item>
|
||||
<Item ItemId=";deseralization_error_title" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Powertoys Run deserialization error]]></Val>
|
||||
<Val><![CDATA[PowerToys Run deserialization error]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Chyba deserializace nástroje Spuštění PowerToys]]></Val>
|
||||
</Tgt>
|
||||
<Prev Cat="Text">
|
||||
<Val><![CDATA[Powertoys Run deserialization error]]></Val>
|
||||
</Prev>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
@@ -154,7 +157,7 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";reportWindow_file_bug" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Item ItemId=";reportWindow_file_bug" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Please file a bug in the]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
@@ -163,7 +166,7 @@
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";reportWindow_github_repo" ItemType="0;.resx" PsrId="211" Leaf="true">
|
||||
<Item ItemId=";reportWindow_github_repo" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[PowerToys GitHub repository]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
@@ -15,6 +15,11 @@ namespace Wox.Core.Plugin
|
||||
{
|
||||
internal abstract class PluginConfig
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
|
||||
private const string PluginConfigName = "plugin.json";
|
||||
private static readonly List<PluginMetadata> PluginMetadatas = new List<PluginMetadata>();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
@@ -15,6 +16,11 @@ namespace Wox.Core.Plugin
|
||||
{
|
||||
internal class PluginInstaller
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
|
||||
internal static void Install(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
@@ -35,7 +41,7 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
|
||||
PluginMetadata plugin = GetMetadataFromJson(tempFolder);
|
||||
if (plugin == null || plugin.Name == null)
|
||||
if (plugin?.Name == null)
|
||||
{
|
||||
MessageBox.Show("Install failed: plugin config is invalid");
|
||||
return;
|
||||
@@ -196,7 +202,7 @@ namespace Wox.Core.Plugin
|
||||
{
|
||||
if ((File.Exists(strDirectory + directoryName + fileName) && overWrite) || (!File.Exists(strDirectory + directoryName + fileName)))
|
||||
{
|
||||
using (FileStream streamWriter = File.Create(strDirectory + directoryName + fileName))
|
||||
using (Stream streamWriter = File.Create(strDirectory + directoryName + fileName))
|
||||
{
|
||||
byte[] data = new byte[2048];
|
||||
while (true)
|
||||
|
||||
@@ -6,7 +6,7 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
@@ -23,6 +23,9 @@ namespace Wox.Core.Plugin
|
||||
/// </summary>
|
||||
public static class PluginManager
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
|
||||
private static IEnumerable<PluginPair> _contextMenuPlugins = new List<PluginPair>();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -70,6 +70,8 @@ namespace Wox.Infrastructure.Exception
|
||||
|
||||
sb.AppendLine("## Environment");
|
||||
sb.AppendLine($"* Command Line: {Environment.CommandLine}");
|
||||
|
||||
// Using InvariantCulture since this is internal
|
||||
sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
|
||||
sb.AppendLine($"* Wox version: {Constant.Version}");
|
||||
sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}");
|
||||
|
||||
@@ -4,18 +4,27 @@
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
|
||||
namespace Wox.Infrastructure.FileSystemHelper
|
||||
{
|
||||
public class FileVersionInfoWrapper : IFileVersionInfoWrapper
|
||||
{
|
||||
private readonly IFile _file;
|
||||
|
||||
public FileVersionInfoWrapper()
|
||||
: this(new FileSystem().File)
|
||||
{
|
||||
}
|
||||
|
||||
public FileVersionInfoWrapper(IFile file)
|
||||
{
|
||||
_file = file;
|
||||
}
|
||||
|
||||
public FileVersionInfo GetVersionInfo(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
if (_file.Exists(path))
|
||||
{
|
||||
return FileVersionInfo.GetVersionInfo(path);
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
// 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.IO;
|
||||
using System.Security;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace Wox.Infrastructure.FileSystemHelper
|
||||
{
|
||||
public class FileWrapper : IFileWrapper
|
||||
{
|
||||
public FileWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
public string[] ReadAllLines(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
return File.ReadAllLines(path);
|
||||
}
|
||||
catch (System.Exception ex) when (ex is SecurityException || ex is UnauthorizedAccessException || ex is IOException)
|
||||
{
|
||||
Log.Info($"Unable to read File: {path}| {ex.Message}", GetType());
|
||||
|
||||
return new string[] { string.Empty };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// 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.
|
||||
|
||||
namespace Wox.Infrastructure.FileSystemHelper
|
||||
{
|
||||
public interface IFileWrapper
|
||||
{
|
||||
string[] ReadAllLines(string path);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
@@ -14,6 +14,12 @@ namespace Wox.Infrastructure
|
||||
{
|
||||
public static class Helper
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
private static readonly IFileInfoFactory FileInfo = FileSystem.FileInfo;
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
|
||||
/// <summary>
|
||||
/// http://www.yinwang.org/blog-cn/2015/11/21/programming-philosophy
|
||||
/// </summary>
|
||||
@@ -54,8 +60,8 @@ namespace Wox.Infrastructure
|
||||
}
|
||||
else
|
||||
{
|
||||
var time1 = new FileInfo(bundledDataPath).LastWriteTimeUtc;
|
||||
var time2 = new FileInfo(dataPath).LastWriteTimeUtc;
|
||||
var time1 = FileInfo.FromFileName(bundledDataPath).LastWriteTimeUtc;
|
||||
var time2 = FileInfo.FromFileName(dataPath).LastWriteTimeUtc;
|
||||
if (time1 != time2)
|
||||
{
|
||||
File.Copy(bundledDataPath, dataPath, true);
|
||||
|
||||
@@ -6,7 +6,7 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
@@ -21,6 +21,11 @@ namespace Wox.Infrastructure.Image
|
||||
{
|
||||
public static class ImageLoader
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
|
||||
private static readonly ImageCache ImageCache = new ImageCache();
|
||||
private static readonly ConcurrentDictionary<string, string> GuidToKey = new ConcurrentDictionary<string, string>();
|
||||
|
||||
@@ -131,6 +136,7 @@ namespace Wox.Infrastructure.Image
|
||||
return new ImageResult(ImageCache[path], ImageType.Cache);
|
||||
}
|
||||
|
||||
// Using OrdinalIgnoreCase since this is internal and used with paths
|
||||
if (path.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var imageSource = new BitmapImage(new Uri(path));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
@@ -24,6 +24,9 @@ namespace Wox.Infrastructure.Image
|
||||
|
||||
public static class WindowsThumbnailProvider
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
|
||||
// Based on https://stackoverflow.com/questions/21751747/extract-thumbnail-for-any-file-in-windows
|
||||
private const string IShellItem2Guid = "7E9FB0D3-919F-4307-AB2E-9B1860310C93";
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
@@ -19,18 +20,28 @@ namespace Wox.Infrastructure.Storage
|
||||
/// </summary>
|
||||
public class BinaryStorage<T> : IStorage<T>
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
// This storage helper returns whether or not to delete the binary storage items
|
||||
private const int _binaryStorage = 0;
|
||||
private StoragePowerToysVersionInfo _storageHelper;
|
||||
|
||||
public BinaryStorage(string filename)
|
||||
: this(filename, new FileSystem())
|
||||
{
|
||||
}
|
||||
|
||||
public BinaryStorage(string filename, IFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
|
||||
const string directoryName = "Cache";
|
||||
var directoryPath = Path.Combine(Constant.DataDirectory, directoryName);
|
||||
var path = _fileSystem.Path;
|
||||
var directoryPath = path.Combine(Constant.DataDirectory, directoryName);
|
||||
Helper.ValidateDirectory(directoryPath);
|
||||
|
||||
const string fileSuffix = ".cache";
|
||||
FilePath = Path.Combine(directoryPath, $"{filename}{fileSuffix}");
|
||||
FilePath = path.Combine(directoryPath, $"{filename}{fileSuffix}");
|
||||
}
|
||||
|
||||
public string FilePath { get; }
|
||||
@@ -42,17 +53,17 @@ namespace Wox.Infrastructure.Storage
|
||||
// Depending on the version number of the previously installed PT Run, delete the cache if it is found to be incompatible
|
||||
if (_storageHelper.ClearCache)
|
||||
{
|
||||
if (File.Exists(FilePath))
|
||||
if (_fileSystem.File.Exists(FilePath))
|
||||
{
|
||||
File.Delete(FilePath);
|
||||
_fileSystem.File.Delete(FilePath);
|
||||
|
||||
Log.Info($"Deleting cached data at <{FilePath}>", GetType());
|
||||
}
|
||||
}
|
||||
|
||||
if (File.Exists(FilePath))
|
||||
if (_fileSystem.File.Exists(FilePath))
|
||||
{
|
||||
if (new FileInfo(FilePath).Length == 0)
|
||||
if (_fileSystem.FileInfo.FromFileName(FilePath).Length == 0)
|
||||
{
|
||||
Log.Error($"Zero length cache file <{FilePath}>", GetType());
|
||||
|
||||
@@ -60,7 +71,7 @@ namespace Wox.Infrastructure.Storage
|
||||
return defaultData;
|
||||
}
|
||||
|
||||
using (var stream = new FileStream(FilePath, FileMode.Open))
|
||||
using (var stream = _fileSystem.FileStream.Create(FilePath, FileMode.Open))
|
||||
{
|
||||
var d = Deserialize(stream, defaultData);
|
||||
return d;
|
||||
@@ -76,7 +87,7 @@ namespace Wox.Infrastructure.Storage
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Suppressing this to enable FxCop. We are logging the exception, and going forward general exceptions should not be caught")]
|
||||
private T Deserialize(FileStream stream, T defaultData)
|
||||
private T Deserialize(Stream stream, T defaultData)
|
||||
{
|
||||
// http://stackoverflow.com/questions/2120055/binaryformatter-deserialize-gives-serializationexception
|
||||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
@@ -15,6 +16,10 @@ namespace Wox.Infrastructure.Storage
|
||||
/// </summary>
|
||||
public class JsonStorage<T>
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
|
||||
private readonly JsonSerializerSettings _serializerSettings;
|
||||
private T _data;
|
||||
|
||||
@@ -106,8 +111,8 @@ namespace Wox.Infrastructure.Storage
|
||||
|
||||
private void BackupOriginFile()
|
||||
{
|
||||
// Using CurrentCulture since this is user facing
|
||||
var timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fffffff", CultureInfo.CurrentCulture);
|
||||
// Using InvariantCulture since this is internal
|
||||
var timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fffffff", CultureInfo.InvariantCulture);
|
||||
var directory = Path.GetDirectoryName(FilePath).NonNull();
|
||||
var originName = Path.GetFileNameWithoutExtension(FilePath);
|
||||
var backupName = $"{originName}-{timestamp}{FileSuffix}";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.IO;
|
||||
using System.IO.Abstractions;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Wox.Infrastructure.Storage
|
||||
@@ -10,6 +10,9 @@ namespace Wox.Infrastructure.Storage
|
||||
public class PluginJsonStorage<T> : JsonStorage<T>
|
||||
where T : new()
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
|
||||
public PluginJsonStorage()
|
||||
{
|
||||
// C# related, add python related below
|
||||
|
||||
@@ -3,12 +3,15 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
|
||||
namespace Wox.Infrastructure.Storage
|
||||
{
|
||||
public class StoragePowerToysVersionInfo
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IFile File = FileSystem.File;
|
||||
|
||||
// This detail is accessed by the storage items and is used to decide if the cache must be deleted or not
|
||||
public bool ClearCache { get; set; }
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.IO;
|
||||
using System.IO.Abstractions;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Wox.Infrastructure.Storage
|
||||
@@ -10,6 +10,9 @@ namespace Wox.Infrastructure.Storage
|
||||
public class WoxJsonStorage<T> : JsonStorage<T>
|
||||
where T : new()
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
|
||||
public WoxJsonStorage()
|
||||
{
|
||||
var directoryPath = Path.Combine(Constant.DataDirectory, DirectoryName);
|
||||
|
||||
@@ -249,6 +249,7 @@ namespace Wox.Infrastructure
|
||||
}
|
||||
}
|
||||
|
||||
// Using CurrentCultureIgnoreCase since this relates to queries input by user
|
||||
if (string.Equals(query, stringToCompare, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
var bonusForExactMatch = 10;
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="NLog.Schema" Version="4.7.4" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
||||
<PackageReference Include="System.IO.Abstractions" Version="12.2.5" />
|
||||
<PackageReference Include="System.Runtime" Version="4.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Wox.Plugin
|
||||
@@ -26,6 +26,10 @@ namespace Wox.Plugin
|
||||
}
|
||||
}
|
||||
|
||||
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 = "PowerLauncher";
|
||||
public const string ModuleLocation = "Microsoft\\PowerToys\\PowerToys Run";
|
||||
public const string Plugins = "Plugins";
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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.Collections.Generic;
|
||||
using ControlzEx.Theming;
|
||||
|
||||
namespace Wox.Plugin
|
||||
{
|
||||
public class CustomLibraryThemeProvider : LibraryThemeProvider
|
||||
{
|
||||
public static readonly CustomLibraryThemeProvider DefaultInstance = new CustomLibraryThemeProvider();
|
||||
|
||||
public CustomLibraryThemeProvider()
|
||||
: base(true)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void FillColorSchemeValues(Dictionary<string, string> values, RuntimeThemeColorValues colorValues)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
{
|
||||
"DefaultValues": {
|
||||
"Theme.IsHighContrast": "false"
|
||||
},
|
||||
"BaseColorSchemes": [
|
||||
{
|
||||
"Name": "Dark",
|
||||
"Values": {
|
||||
"PrimaryAccentColor": "Black",
|
||||
"SystemBaseMediumLowColor": "#FF818181",
|
||||
"SystemChromeLow": "#FF171717",
|
||||
"TextControlPlaceholderForeground": "#FF818181",
|
||||
"TextBox.Static.Border": "Transparent",
|
||||
"TextBox.MouseOver.Border": "Transparent",
|
||||
"TextBox.Focus.Border": "Transparent",
|
||||
"ButtonBackgroundPointerOver": "#30FFFFFF",
|
||||
"ButtonBorderPointerOver": "#61FFFFFF",
|
||||
"ButtonBackgroundPressed": "#30FFFFFF",
|
||||
"ButtonBorderPressed": "#61FFFFFF",
|
||||
"ListViewItemBackgroundPointerOver": "#FF363636",
|
||||
"ControlTextBrushKey": "White",
|
||||
"SecondaryTextForeground": "#FFa1a1a1",
|
||||
"InactiveSelectionHighlightBrushKey": "White",
|
||||
"DialogBorderBrush": "#FF373737",
|
||||
"ScrollBarThumbBackground": "#FF7a7a7a",
|
||||
"ScrollBarThumbPointerOver": "#FF767676",
|
||||
"ScrollBarThumbPointerPressed": "#FFa4a4a4",
|
||||
"ScrollBarBackgroundPointerOver": "#FF1b1b1b",
|
||||
"ScrollBarLineButtonForeground": "#FFcdcdcd",
|
||||
"ScrollBarLineButtonForegroundPointerOver": "#FFcdcdcd",
|
||||
"ScrollBarLineButtonForegroundPointerPressed": "#FF171717",
|
||||
"ScrollBarLineButtonBackground": "Transparent",
|
||||
"ScrollBarLineButtonBackgroundPointerOver": "#FF313131",
|
||||
"ScrollBarLineButtonBackgroundPointerPressed": "#FFa4a4a4",
|
||||
"ToolTipBorderBrushKey": "#5B000000",
|
||||
"ToolTipForegroundBrushKey": "#FFFFFFFF",
|
||||
"ToolTipBackgroundBrushKey": "#FF2B2B2B"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Light",
|
||||
"Values": {
|
||||
"PrimaryAccentColor": "White",
|
||||
"SystemBaseMediumLowColor": "#66000000",
|
||||
"SystemChromeLow": "#FFF2F2F2",
|
||||
"TextControlPlaceholderForeground": "#FF5b5b5b",
|
||||
"TextBox.Static.Border": "Transparent",
|
||||
"TextBox.MouseOver.Border": "Transparent",
|
||||
"TextBox.Focus.Border": "Transparent",
|
||||
"ButtonBackgroundPointerOver": "#2E000000",
|
||||
"ButtonBorderPointerOver": "#61000000",
|
||||
"ButtonBackgroundPressed": "#30000000",
|
||||
"ButtonBorderPressed": "#61000000",
|
||||
"ListViewItemBackgroundPointerOver": "#FFd2d2d2",
|
||||
"ControlTextBrushKey": "Black",
|
||||
"SecondaryTextForeground": "#FF434343",
|
||||
"InactiveSelectionHighlightBrushKey": "Black",
|
||||
"DialogBorderBrush": "#FFf7f7f7",
|
||||
"ScrollBarThumbBackground": "#FF7a7a7a",
|
||||
"ScrollBarThumbPointerOver": "#FFa0a0a0",
|
||||
"ScrollBarThumbPointerPressed": "#FF747474",
|
||||
"ScrollBarBackgroundPointerOver": "#FFf0f0f0",
|
||||
"ScrollBarLineButtonForeground": "#FF1d1d1d",
|
||||
"ScrollBarLineButtonForegroundPointerOver": "#FF1d1d1d",
|
||||
"ScrollBarLineButtonForegroundPointerPressed": "#FFf3f3f3",
|
||||
"ScrollBarLineButtonBackground": "Transparent",
|
||||
"ScrollBarLineButtonBackgroundPointerOver": "#FFd2d2d2",
|
||||
"ScrollBarLineButtonBackgroundPointerPressed": "#FF5d5d5d",
|
||||
"ToolTipBorderBrushKey": "#FFD0D0D0",
|
||||
"ToolTipForegroundBrushKey": "#FF000000",
|
||||
"ToolTipBackgroundBrushKey": "#FFFBFBFB"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "HighContrast",
|
||||
"Values": {
|
||||
"Theme.IsHighContrast": "true",
|
||||
"PrimaryAccentColor": "White",
|
||||
"SystemBaseMediumLowColor": "#ffff00",
|
||||
"SystemChromeLow": "Black",
|
||||
"TextControlPlaceholderForeground": "#FF008000",
|
||||
"TextBox.Static.Border": "Transparent",
|
||||
"TextBox.MouseOver.Border": "Transparent",
|
||||
"TextBox.Focus.Border": "Transparent",
|
||||
"ButtonBackgroundPointerOver": "Black",
|
||||
"ButtonBorderPointerOver": "White",
|
||||
"ButtonBackgroundPressed": "White",
|
||||
"ButtonBorderPressed": "White",
|
||||
"ListViewItemBackgroundPointerOver": "#FF003300",
|
||||
"ControlTextBrushKey": "#FFffff00",
|
||||
"SecondaryTextForeground": "#FF008000",
|
||||
"InactiveSelectionHighlightBrushKey": "#FFFFFFFF",
|
||||
"DialogBorderBrush": "#FF373737",
|
||||
"ScrollBarThumbBackground": "White",
|
||||
"ScrollBarThumbPointerOver": "#FF008000",
|
||||
"ScrollBarThumbPointerPressed": "#FF008000",
|
||||
"ScrollBarBackgroundPointerOver": "#FF000000",
|
||||
"ScrollBarLineButtonForeground": "#FFFFFFFF",
|
||||
"ScrollBarLineButtonForegroundPointerOver": "#FFFFFFFF",
|
||||
"ScrollBarLineButtonForegroundPointerPressed": "#FFFFFFFF",
|
||||
"ScrollBarLineButtonBackground": "Black",
|
||||
"ScrollBarLineButtonBackgroundPointerOver": "#FF000000",
|
||||
"ScrollBarLineButtonBackgroundPointerPressed": "#FF000000",
|
||||
"ToolTipBorderBrushKey": "#5B000000",
|
||||
"ToolTipForegroundBrushKey": "#FFFFFFFF",
|
||||
"ToolTipBackgroundBrushKey": "#FF2B2B2B"
|
||||
}
|
||||
}
|
||||
],
|
||||
"ColorSchemes": []
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
mc:Ignorable="options">
|
||||
|
||||
<!-- Metadata -->
|
||||
<system:String x:Key="Theme.Name">{{ThemeName}}</system:String>
|
||||
<system:String x:Key="Theme.Origin">PowerToysRun</system:String>
|
||||
<system:String x:Key="Theme.DisplayName">{{ThemeDisplayName}}</system:String>
|
||||
<system:String x:Key="Theme.BaseColorScheme">{{BaseColorScheme}}</system:String>
|
||||
<system:String x:Key="Theme.ColorScheme">{{ColorScheme}}</system:String>
|
||||
<Color x:Key="Theme.PrimaryAccentColor">{{PrimaryAccentColor}}</Color>
|
||||
<system:Boolean x:Key="Theme.IsHighContrast">{{IsHighContrast}}</system:Boolean>
|
||||
|
||||
<Color x:Key="SystemBaseMediumLowColor">{{SystemBaseMediumLowColor}}</Color>
|
||||
<SolidColorBrush x:Key="SystemChromeLow" Color="{{SystemChromeLow}}" options:Freeze="True" />
|
||||
<SolidColorBrush x:Key="TextControlPlaceholderForeground" Color="{{TextControlPlaceholderForeground}}" />
|
||||
<SolidColorBrush x:Key="TextBox.Static.Border" Color="{{TextBox.Static.Border}}"/>
|
||||
<SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="{{TextBox.MouseOver.Border}}"/>
|
||||
<SolidColorBrush x:Key="TextBox.Focus.Border" Color="{{TextBox.Focus.Border}}"/>
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{{ButtonBackgroundPointerOver}}" />
|
||||
<SolidColorBrush x:Key="ButtonBorderPointerOver" Color="{{ButtonBorderPointerOver}}" />
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{{ButtonBackgroundPressed}}" />
|
||||
<SolidColorBrush x:Key="ButtonBorderPressed" Color="{{ButtonBorderPressed}}" />
|
||||
<SolidColorBrush x:Key="ListViewItemBackgroundPointerOver" Color="{{ListViewItemBackgroundPointerOver}}" />
|
||||
<SolidColorBrush x:Key="ControlTextBrushKey" Color="{{ControlTextBrushKey}}" />
|
||||
<SolidColorBrush x:Key="SecondaryTextForeground" Color="{{SecondaryTextForeground}}" />
|
||||
<SolidColorBrush x:Key="InactiveSelectionHighlightBrushKey" Color="{{InactiveSelectionHighlightBrushKey}}" />
|
||||
<SolidColorBrush x:Key="DialogBorderBrush" Color="{{DialogBorderBrush}}" />
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarThumbBackground" Color="{{ScrollBarThumbBackground}}" />
|
||||
<Color x:Key="ScrollBarThumbPointerOver">{{ScrollBarThumbPointerOver}}</Color>
|
||||
<Color x:Key="ScrollBarThumbPointerPressed">{{ScrollBarThumbPointerPressed}}</Color>
|
||||
|
||||
<Color x:Key="ScrollBarBackgroundPointerOver">{{ScrollBarBackgroundPointerOver}}</Color>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="{{ScrollBarLineButtonForeground}}" />
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">{{ScrollBarLineButtonForegroundPointerOver}}</Color>
|
||||
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">{{ScrollBarLineButtonForegroundPointerPressed}}</Color>
|
||||
|
||||
<SolidColorBrush x:Key="ScrollBarLineButtonBackground" Color="{{ScrollBarLineButtonBackground}}"/>
|
||||
<Color x:Key="ScrollBarLineButtonBackgroundPointerOver">{{ScrollBarLineButtonBackgroundPointerOver}}</Color>
|
||||
<Color x:Key="ScrollBarLineButtonBackgroundPointerPressed">{{ScrollBarLineButtonBackgroundPointerPressed}}</Color>
|
||||
|
||||
<SolidColorBrush x:Key="ToolTipBorderBrushKey" Color="{{ToolTipBorderBrushKey}}" />
|
||||
<SolidColorBrush x:Key="ToolTipForegroundBrushKey" Color="{{ToolTipForegroundBrushKey}}" />
|
||||
<SolidColorBrush x:Key="ToolTipBackgroundBrushKey" Color="{{ToolTipBackgroundBrushKey}}" />
|
||||
</ResourceDictionary>
|
||||
@@ -3,7 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
@@ -13,6 +13,10 @@ namespace Wox.Plugin.Logger
|
||||
{
|
||||
public static class Log
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
|
||||
public const string DirectoryName = "Logs";
|
||||
|
||||
public static string CurrentLogDirectory { get; }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wox.Plugin
|
||||
@@ -12,6 +12,9 @@ namespace Wox.Plugin
|
||||
[JsonObject(MemberSerialization.OptOut)]
|
||||
public class PluginMetadata : BaseModel
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
|
||||
private string _pluginDirectory;
|
||||
|
||||
private List<string> _actionKeywords;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
@@ -13,6 +13,9 @@ namespace Wox.Plugin
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
|
||||
private string _title;
|
||||
private ToolTipData _toolTipData;
|
||||
private string _pluginDirectory;
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
// 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.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Wox.Plugin.Logger;
|
||||
using Wox.Plugin.Properties;
|
||||
|
||||
namespace Wox.Plugin.SharedCommands
|
||||
{
|
||||
public static class FilesFolders
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Suppressing this to enable FxCop. We are logging the exception, and going forward general exceptions should not be caught")]
|
||||
public static void Copy(this string sourcePath, string targetPath)
|
||||
{
|
||||
// Get the subdirectories for the specified directory.
|
||||
DirectoryInfo dir = new DirectoryInfo(sourcePath);
|
||||
|
||||
if (!dir.Exists)
|
||||
{
|
||||
throw new DirectoryNotFoundException(
|
||||
"Source directory does not exist or could not be found: "
|
||||
+ sourcePath);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DirectoryInfo[] dirs = dir.GetDirectories();
|
||||
|
||||
// If the destination directory doesn't exist, create it.
|
||||
if (!Directory.Exists(targetPath))
|
||||
{
|
||||
Directory.CreateDirectory(targetPath);
|
||||
}
|
||||
|
||||
// Get the files in the directory and copy them to the new location.
|
||||
FileInfo[] files = dir.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
string temppath = Path.Combine(targetPath, file.Name);
|
||||
file.CopyTo(temppath, false);
|
||||
}
|
||||
|
||||
// Recursively copy subdirectories by calling itself on each subdirectory until there are no more to copy
|
||||
foreach (DirectoryInfo subdir in dirs)
|
||||
{
|
||||
string temppath = Path.Combine(targetPath, subdir.Name);
|
||||
Copy(subdir.FullName, temppath);
|
||||
}
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable is declared but never used. Due to #if debug vs release statement
|
||||
catch (Exception e)
|
||||
#pragma warning restore CS0168 // Variable is declared but never used
|
||||
{
|
||||
string error = $"Copying path {targetPath} has failed";
|
||||
Log.Exception(error, e, MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
// Using CurrentCulture since this is user facing
|
||||
System.Windows.MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.filesfolder_copy_failed, targetPath));
|
||||
RemoveFolder(targetPath);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Suppressing this to enable FxCop. We are logging the exception, and going forward general exceptions should not be caught")]
|
||||
public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fromDir = new DirectoryInfo(fromPath);
|
||||
var toDir = new DirectoryInfo(toPath);
|
||||
|
||||
if (fromDir.GetFiles("*", SearchOption.AllDirectories).Length != toDir.GetFiles("*", SearchOption.AllDirectories).Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fromDir.GetDirectories("*", SearchOption.AllDirectories).Length != toDir.GetDirectories("*", SearchOption.AllDirectories).Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable is declared but never used. Due to #if debug vs release statement
|
||||
catch (Exception e)
|
||||
#pragma warning restore CS0168 // Variable is declared but never used
|
||||
{
|
||||
string error = $"Unable to verify folders and files between {fromPath} and {toPath}";
|
||||
Log.Exception(error, e, MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
// Using CurrentCulture since this is user facing
|
||||
System.Windows.MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.filesfolder_verifybothfolderfilesequal_failed, fromPath, toPath));
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Suppressing this to enable FxCop. We are logging the exception, and going forward general exceptions should not be caught")]
|
||||
public static void RemoveFolder(this string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
Directory.Delete(path, true);
|
||||
}
|
||||
}
|
||||
#pragma warning disable CS0168 // Variable is declared but never used. Due to #if debug vs release statement
|
||||
catch (Exception e)
|
||||
#pragma warning restore CS0168 // Variable is declared but never used
|
||||
{
|
||||
string error = $"Not able to delete folder {path}";
|
||||
Log.Exception(error, e, MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#if DEBUG
|
||||
throw;
|
||||
#else
|
||||
// Using CurrentCulture since this is user facing
|
||||
System.Windows.MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.filesfolder_removefolder_failed, path));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
// 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;
|
||||
using System.Linq;
|
||||
|
||||
namespace Wox.Plugin.SharedCommands
|
||||
{
|
||||
public static class SearchWeb
|
||||
{
|
||||
/// <summary>
|
||||
/// Opens search in a new browser. If no browser path is passed in then Chrome is used.
|
||||
/// Leave browser path blank to use Chrome.
|
||||
/// </summary>
|
||||
public static void NewBrowserWindow(this Uri url, string browserPath)
|
||||
{
|
||||
if (url == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(url));
|
||||
}
|
||||
|
||||
var browserExecutableName = browserPath?
|
||||
.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None)
|
||||
.Last();
|
||||
|
||||
var browser = string.IsNullOrEmpty(browserExecutableName) ? "chrome" : browserPath;
|
||||
|
||||
// Internet Explorer will open url in new browser window, and does not take the --new-window parameter
|
||||
var browserArguments = browserExecutableName == "iexplore.exe" ? url.AbsoluteUri : "--new-window " + url.AbsoluteUri;
|
||||
|
||||
try
|
||||
{
|
||||
Process.Start(browser, browserArguments);
|
||||
}
|
||||
catch (System.ComponentModel.Win32Exception)
|
||||
{
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = url.AbsoluteUri,
|
||||
UseShellExecute = true,
|
||||
};
|
||||
Process.Start(psi);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens search as a tab in the default browser chosen in Windows settings.
|
||||
/// </summary>
|
||||
public static void NewTabInBrowser(this Uri url, string browserPath)
|
||||
{
|
||||
if (url == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(url));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(browserPath))
|
||||
{
|
||||
Process.Start(browserPath, url.AbsoluteUri);
|
||||
}
|
||||
else
|
||||
{
|
||||
Process.Start(url.AbsoluteUri);
|
||||
}
|
||||
}
|
||||
|
||||
// This error may be thrown for Process.Start(browserPath, url)
|
||||
catch (System.ComponentModel.Win32Exception)
|
||||
{
|
||||
Process.Start(url.AbsoluteUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// 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.Linq;
|
||||
using System.Windows;
|
||||
using MahApps.Metro.Theming;
|
||||
using ManagedCommon;
|
||||
using Microsoft.Win32;
|
||||
|
||||
@@ -40,31 +39,35 @@ namespace Wox.Plugin
|
||||
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
|
||||
new ControlzEx.Theming.LibraryTheme(
|
||||
highContrastOneThemeUri,
|
||||
MahAppsLibraryThemeProvider.DefaultInstance));
|
||||
CustomLibraryThemeProvider.DefaultInstance));
|
||||
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
|
||||
new ControlzEx.Theming.LibraryTheme(
|
||||
highContrastTwoThemeUri,
|
||||
MahAppsLibraryThemeProvider.DefaultInstance));
|
||||
CustomLibraryThemeProvider.DefaultInstance));
|
||||
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
|
||||
new ControlzEx.Theming.LibraryTheme(
|
||||
highContrastBlackThemeUri,
|
||||
MahAppsLibraryThemeProvider.DefaultInstance));
|
||||
CustomLibraryThemeProvider.DefaultInstance));
|
||||
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
|
||||
new ControlzEx.Theming.LibraryTheme(
|
||||
highContrastWhiteThemeUri,
|
||||
MahAppsLibraryThemeProvider.DefaultInstance));
|
||||
CustomLibraryThemeProvider.DefaultInstance));
|
||||
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
|
||||
new ControlzEx.Theming.LibraryTheme(
|
||||
lightThemeUri,
|
||||
MahAppsLibraryThemeProvider.DefaultInstance));
|
||||
CustomLibraryThemeProvider.DefaultInstance));
|
||||
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
|
||||
new ControlzEx.Theming.LibraryTheme(
|
||||
darkThemeUri,
|
||||
MahAppsLibraryThemeProvider.DefaultInstance));
|
||||
CustomLibraryThemeProvider.DefaultInstance));
|
||||
|
||||
ResetTheme();
|
||||
ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ControlzEx.Theming.ThemeSyncMode.SyncAll;
|
||||
ControlzEx.Theming.ThemeManager.Current.ThemeChanged += Current_ThemeChanged;
|
||||
|
||||
// Currently there is an issue in ControlzEx, so we must use SyncAll to sync also HighContrast themes.
|
||||
// We can change this after using next release.
|
||||
ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ControlzEx.Theming.ThemeSyncMode.SyncAll;
|
||||
|
||||
ControlzEx.Theming.ThemeManager.Current.SyncTheme();
|
||||
}
|
||||
|
||||
public Theme GetCurrentTheme()
|
||||
@@ -119,22 +122,22 @@ namespace Wox.Plugin
|
||||
else if (theme == Theme.HighContrastOne)
|
||||
{
|
||||
currentTheme = Theme.HighContrastOne;
|
||||
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastOneTheme);
|
||||
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastOneTheme, true);
|
||||
}
|
||||
else if (theme == Theme.HighContrastTwo)
|
||||
{
|
||||
currentTheme = Theme.HighContrastTwo;
|
||||
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastTwoTheme);
|
||||
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastTwoTheme, true);
|
||||
}
|
||||
else if (theme == Theme.HighContrastWhite)
|
||||
{
|
||||
currentTheme = Theme.HighContrastWhite;
|
||||
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastWhiteTheme);
|
||||
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastWhiteTheme, true);
|
||||
}
|
||||
else if (theme == Theme.HighContrastBlack)
|
||||
{
|
||||
currentTheme = Theme.HighContrastBlack;
|
||||
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastBlackTheme);
|
||||
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastBlackTheme, true);
|
||||
}
|
||||
else if (theme == Theme.Light)
|
||||
{
|
||||
@@ -157,7 +160,15 @@ namespace Wox.Plugin
|
||||
|
||||
private void Current_ThemeChanged(object sender, ControlzEx.Theming.ThemeChangedEventArgs e)
|
||||
{
|
||||
ResetTheme();
|
||||
ControlzEx.Theming.ThemeManager.Current.ThemeChanged -= Current_ThemeChanged;
|
||||
try
|
||||
{
|
||||
ResetTheme();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlzEx.Theming.ThemeManager.Current.ThemeChanged += Current_ThemeChanged;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
|
||||
@@ -49,6 +49,15 @@
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);**/*.Template.xaml</DefaultItemExcludes>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="**/*.Template.xaml" />
|
||||
<EmbeddedResource Include="**/GeneratorParameters.json" />
|
||||
<UpToDateCheckInput Include="**/*.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
@@ -67,7 +76,6 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.3.0" />
|
||||
<PackageReference Include="ControlzEx" Version="4.3.2" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Nepovedlo se zkopírovat cestu {0}. Aby se zachovala konzistence, cesta se odstraní.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Nepovedlo se odstranit složku {0}. Přejděte prosím na příslušné umístění a odstraňte ji ručně.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Nepovedlo se ověřit složky a soubory mezi {0} a {1}.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Fehler beim Kopieren des Pfads "{0}". Er wird nun aus Konsistenzgründen gelöscht.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Der Ordner "{0}" kann nicht gelöscht werden. Wechseln Sie zum Speicherort, und löschen Sie ihn manuell.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Die Ordner und Dateien zwischen "{0}" und "{1}" können nicht verifiziert werden.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Error al copiar la ruta de acceso {0}. Ahora se eliminará por coherencia.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[No se puede eliminar la carpeta {0}. Vaya a la ubicación y elimínela manualmente.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[No se pueden comprobar las carpetas y los archivos entre {0} y {1}.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[La copie du chemin {0} a échoué, il est maintenant supprimé pour assurer la cohérence]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Impossible de supprimer le dossier {0}, accédez à l'emplacement et supprimez-le manuellement]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Impossible de vérifier les dossiers et les fichiers entre {0} et {1}]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[A(z) {0} elérési út másolása sikertelen volt, a konzisztencia érdekében törlődik]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Nem sikerült törölni a(z) {0} mappát, lépjen a helyhez, és törölje manuálisan]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Nem sikerült ellenőrizni a mappákat és a fájlokat a(z) {0} és {1} között]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[パス {0} をコピーできませんでした。これは、整合性のために削除されます]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[フォルダー {0} を削除できません。その場所に移動して、手動で削除してください]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} と {1} の間のフォルダーとファイルを確認できません]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Kan het pad {0} niet kopiëren. Het pad wordt nu verwijderd voor consistentie]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Kan de map {0} niet verwijderen. Ga naar de locatie en om de map handmatig te verwijderen]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Kan geen mappen en bestanden controleren tussen {0} en {1}]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Falha ao copiar o caminho {0}, ele será excluído para consistência]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Não é possível excluir a pasta {0}, vá até o local e exclua-a manualmente]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Não é possível verificar pastas e arquivos entre {0} e {1}]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Не удалось скопировать путь {0}, он будет удален для обеспечения согласованности.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Не удается удалить папку {0}, перейдите в ее расположение и удалите ее вручную.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Не удается проверить папки и файлы между {0} и {1}.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
@@ -13,29 +13,29 @@
|
||||
<Item ItemId=";filesfolder_copy_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Copying path {0} has failed, it will now be deleted for consistency]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} yolu kopyalanamadığından şimdi tutarlılık için silinecek]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: targetPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_removefolder_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Not able to delete folder {0}, please go to the location and manually delete it]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} klasörü silinemiyor, lütfen konuma gidin ve kendiniz silin]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[parameter: path]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
<Item ItemId=";filesfolder_verifybothfolderfilesequal_failed" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[Unable to verify folders and files between {0} and {1}]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[{0} ile {1} arasındaki klasör ve dosyalar doğrulanamıyor]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
<Cmts>
|
||||
<Cmt Name="Dev"><![CDATA[paramaters: fromPath, toPath]]></Cmt>
|
||||
</Cmts>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user