Skip to content

Commit

Permalink
Finish task and publish 3.1.1003.0 version
Browse files Browse the repository at this point in the history
1.Finish task and publish 3.1.1003.0 version
2.Disable code warning
3.Import AppxPackaging.dll API
  • Loading branch information
Gaoyifei1011 committed Oct 3, 2024
1 parent 1ec4086 commit 4d12cb1
Show file tree
Hide file tree
Showing 63 changed files with 520 additions and 114 deletions.
1 change: 1 addition & 0 deletions Description/README_EN-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ A toolbox that integrates multiple gadgets.
### Project References (Sort by alphabetical order)

> * [Microsoft.UI.Xaml](https://github.com/microsoft/microsoft-ui-xaml) 
> * [Microsoft.Windows.SDK.BuildTools](https://aka.ms/WinSDKProjectURL) 
> * [Microsoft.Windows.SDK.Contracts](https://aka.ms/WinSDKProjectURL) 
> * [Microsoft.WindowsAppSDK](https://github.com/microsoft/windowsappsdk) 
> * [Mile.Xaml](https://github.com/ProjectMile/Mile.Xaml) 
Expand Down
1 change: 1 addition & 0 deletions Description/README_ZH-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
### 项目引用(按英文首字母排序)

> * [Microsoft.UI.Xaml](https://github.com/microsoft/microsoft-ui-xaml) 
> * [Microsoft.Windows.SDK.BuildTools](https://aka.ms/WinSDKProjectURL) 
> * [Microsoft.Windows.SDK.Contracts](https://aka.ms/WinSDKProjectURL) 
> * [Microsoft.WindowsAppSDK](https://github.com/microsoft/windowsappsdk) 
> * [Mile.Xaml](https://github.com/ProjectMile/Mile.Xaml) 
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
### 项目引用(按英文首字母排序)

> * [Microsoft.UI.Xaml](https://github.com/microsoft/microsoft-ui-xaml) 
> * [Microsoft.Windows.SDK.BuildTools](https://aka.ms/WinSDKProjectURL) 
> * [Microsoft.Windows.SDK.Contracts](https://aka.ms/WinSDKProjectURL) 
> * [Microsoft.WindowsAppSDK](https://github.com/microsoft/windowsappsdk) 
> * [Mile.Xaml](https://github.com/ProjectMile/Mile.Xaml) 
Expand Down
3 changes: 3 additions & 0 deletions WindowsTools/Helpers/Backdrop/BackdropHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
using WindowsTools.WindowsAPI.ComTypes;
using WindowsTools.WindowsAPI.PInvoke.Combase;

// 抑制 CA1806 警告
#pragma warning disable CA1806

namespace WindowsTools.Helpers.Backdrop
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions WindowsTools/Helpers/Root/FeatureAccessHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using System.Text;
using WindowsTools.WindowsAPI.PInvoke.Kernel32;

// 抑制 CA1806 警告
#pragma warning disable CA1806

namespace WindowsTools.Helpers.Root
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions WindowsTools/Models/DownloadModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
using Windows.UI.Xaml;
using WindowsTools.Extensions.DataType.Enums;

// 抑制 CA1822 警告
#pragma warning disable CA1822

namespace WindowsTools.Models
{
public sealed class DownloadModel : INotifyPropertyChanged
Expand Down
3 changes: 3 additions & 0 deletions WindowsTools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
using WindowsTools.Views.Windows;
using WindowsTools.WindowsAPI.ComTypes;

// 抑制 CA1806 警告
#pragma warning disable CA1806

namespace WindowsTools
{
/// <summary>
Expand Down
10 changes: 7 additions & 3 deletions WindowsTools/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using System.Reflection;
using System.Resources;

// 程序集信息设置
[assembly: AssemblyCompany("高怡飞")]
[assembly: AssemblyCopyright("Copyright ©2024 高怡飞, All Rights Reserved.")]
[assembly: AssemblyDescription("Windows 工具箱")]
[assembly: AssemblyFileVersion("3.0.1001.0")]
[assembly: AssemblyInformationalVersion("3.0.1001.0")]
[assembly: AssemblyFileVersion("3.1.1003.0")]
[assembly: AssemblyInformationalVersion("3.1.1003.0")]
[assembly: AssemblyProduct("Windows 工具箱")]
[assembly: AssemblyTitle("Windows 工具箱")]
[assembly: AssemblyVersion("3.0.1001.0")]
[assembly: AssemblyVersion("3.1.1003.0")]

// 应用程序默认区域性的资源控制器设置
[assembly: NeutralResourcesLanguage("en-us")]
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
using WindowsTools.WindowsAPI.ComTypes;
using WindowsTools.WindowsAPI.PInvoke.Ole32;

// 抑制 CA1806 警告
#pragma warning disable CA1806

namespace WindowsTools.Services.Controls.Download
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
using WindowsTools.Services.Root;
using WindowsTools.WindowsAPI.PInvoke.Shell32;

// 抑制 CA1806 警告
#pragma warning disable CA1806

namespace WindowsTools.Services.Controls.Settings
{
/// <summary>
Expand Down
32 changes: 26 additions & 6 deletions WindowsTools/Services/Controls/Settings/LanguageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices.ComTypes;
using System.Windows.Forms;
using Windows.Globalization;
using WindowsTools.Extensions.DataType.Constant;
using WindowsTools.Services.Root;
using WindowsTools.WindowsAPI.ComTypes;
using WindowsTools.WindowsAPI.PInvoke.Shlwapi;

namespace WindowsTools.Services.Controls.Settings
{
Expand All @@ -16,8 +18,9 @@ namespace WindowsTools.Services.Controls.Settings
/// </summary>
public static class LanguageService
{
private static readonly string resourceFileName = string.Format("{0}.resources.dll", Assembly.GetExecutingAssembly().GetName().Name);
private static readonly string settingsKey = ConfigKey.LanguageKey;
private static readonly Guid CLSID_AppxFactory = new("5842A140-FF9F-4166-8F5C-62F5B7B0C781");
private static readonly IAppxFactory appxFactory = Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_AppxFactory)) as IAppxFactory;
private static DictionaryEntry defaultAppLanguage;

public static DictionaryEntry AppLanguage { get; private set; }
Expand All @@ -35,15 +38,32 @@ private static void InitializeLanguageList()
{
try
{
string[] resourceFolder = Directory.GetFiles(AppContext.BaseDirectory, resourceFileName, SearchOption.AllDirectories);
if (ShlwapiLibrary.SHCreateStreamOnFileEx(Path.Combine(AppContext.BaseDirectory, "AppxManifest.xml"), STGM.STGM_SHARE_DENY_READ | STGM.STGM_SHARE_EXCLUSIVE, 0, false, null, out IStream stream) is 0)
{
appxFactory.CreateManifestReader(stream, out IAppxManifestReader2 appxManifestReader);

if (appxManifestReader.GetQualifiedResources(out IAppxManifestQualifiedResourcesEnumerator appxManifestQualifiedResourcesEnumerator) is 0)
{
while (appxManifestQualifiedResourcesEnumerator.GetHasCurrent(out bool hasCurrent) is 0 && (hasCurrent is true))
{
if (appxManifestQualifiedResourcesEnumerator.GetCurrent(out IAppxManifestQualifiedResource appxManifestQualifiedResource) is 0 && appxManifestQualifiedResource.GetLanguage(out string language) is 0)
{
AppLanguagesList.Add(language);
}

appxManifestQualifiedResourcesEnumerator.MoveNext(out _);
}
}
}

foreach (string file in resourceFolder)
if (AppLanguagesList.Count is 0)
{
AppLanguagesList.Add(Path.GetFileName(Path.GetDirectoryName(file)));
AppLanguagesList.Add("en-us");
}

AppLanguagesList.Sort();
}
catch
catch (Exception)
{
AppLanguagesList.Clear();
AppLanguagesList.Add("en-us");
Expand Down
3 changes: 3 additions & 0 deletions WindowsTools/Services/Root/LogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
using System.Threading.Tasks;
using WindowsTools.WindowsAPI.PInvoke.Shell32;

// 抑制 CA1806 警告
#pragma warning disable CA1806

namespace WindowsTools.Services.Root
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions WindowsTools/Services/Root/SystemTrayService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
using WindowsTools.Services.Controls.Settings;
using WindowsTools.WindowsAPI.PInvoke.Uxtheme;

// 抑制 CA1806,IDE0060 警告
#pragma warning disable CA1806,IDE0060

namespace WindowsTools.Services.Root
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions WindowsTools/Services/Shell/ShellMenuService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
using WindowsTools.Services.Root;
using WindowsTools.WindowsAPI.PInvoke.Shell32;

// 抑制 CA1806 警告
#pragma warning disable CA1806

namespace WindowsTools.Services.Shell
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion WindowsTools/UI/Backdrop/ColorSourceEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace WindowsTools.UI.Backdrop
{
[Guid("61C23C20-AE69-4D8E-94CF-50078DF638F2")]
public class ColorSourceEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
public sealed class ColorSourceEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
{
public Color Color { get; set; } = Color.FromArgb(255, 255, 255, 255);

Expand Down
2 changes: 1 addition & 1 deletion WindowsTools/UI/Backdrop/CompositeEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace WindowsTools.UI.Backdrop
{
[Guid("48FC9F51-F6AC-48F1-8B58-3B28AC46F76D")]
public class CompositeEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
public sealed class CompositeEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
{
public CanvasComposite Mode { get; set; } = CanvasComposite.SourceOver;

Expand Down
2 changes: 1 addition & 1 deletion WindowsTools/UI/Backdrop/CrossFadeEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace WindowsTools.UI.Backdrop
{
[Guid("12F575E8-4DB1-485F-9A84-03A07DD3829F")]
public class CrossFadeEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
public sealed class CrossFadeEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
{
public float CrossFade { get; set; } = 0.5f;

Expand Down
4 changes: 2 additions & 2 deletions WindowsTools/UI/Backdrop/DesktopAcrylicBackdrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ private void UpdateBrush()
/// <summary>
/// 创建 DesktopAcrylic 背景色
/// </summary>
private CompositionBrush BuildDesktopAcrylicEffectBrush(Compositor compositor, Color tintColor, float tintOpacity, float luminosityOpacity)
private CompositionEffectBrush BuildDesktopAcrylicEffectBrush(Compositor compositor, Color tintColor, float tintOpacity, float luminosityOpacity)
{
Color convertedLuminosityColor = ColorConversion.GetEffectiveLuminosityColor(tintColor, tintOpacity, luminosityOpacity);
Color convertedTintColor = ColorConversion.GetEffectiveTintColor(tintColor, tintOpacity, luminosityOpacity);
Expand Down Expand Up @@ -780,7 +780,7 @@ private CompositionBrush BuildDesktopAcrylicEffectBrush(Compositor compositor, C
/// <summary>
/// 创建回退色切换时的动画颜色
/// </summary>
private CompositionBrush CreateCrossFadeEffectBrush(Compositor compositor, CompositionBrush from, CompositionBrush to)
private CompositionEffectBrush CreateCrossFadeEffectBrush(Compositor compositor, CompositionBrush from, CompositionBrush to)
{
CrossFadeEffect crossFadeEffect = new()
{
Expand Down
7 changes: 5 additions & 2 deletions WindowsTools/UI/Backdrop/MicaBackdrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
using WindowsTools.WindowsAPI.PInvoke.Kernel32;
using WindowsTools.WindowsAPI.PInvoke.User32;

// 抑制 CA1822 警告
#pragma warning disable CA1822

namespace WindowsTools.UI.Backdrop
{
/// <summary>
Expand Down Expand Up @@ -592,7 +595,7 @@ private void UpdateBrush()
/// <summary>
/// 创建 Mica 背景色
/// </summary>
private CompositionBrush BuildMicaEffectBrush(Compositor compositor, Color tintColor, float tintOpacity, float luminosityOpacity)
private CompositionEffectBrush BuildMicaEffectBrush(Compositor compositor, Color tintColor, float tintOpacity, float luminosityOpacity)
{
// Tint Color.
ColorSourceEffect tintColorEffect = new()
Expand Down Expand Up @@ -654,7 +657,7 @@ private CompositionBrush BuildMicaEffectBrush(Compositor compositor, Color tintC
/// <summary>
/// 创建回退色切换时的动画颜色
/// </summary>
private CompositionBrush CreateCrossFadeEffectBrush(Compositor compositor, CompositionBrush from, CompositionBrush to)
private CompositionEffectBrush CreateCrossFadeEffectBrush(Compositor compositor, CompositionBrush from, CompositionBrush to)
{
CrossFadeEffect crossFadeEffect = new()
{
Expand Down
5 changes: 0 additions & 5 deletions WindowsTools/UI/Backdrop/OpacityEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ public int GetEffectId(out Guid id)
return 0;
}

public static bool IsSupported
{
get { return true; }
}

public int GetNamedPropertyMapping(string name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
{
switch (name)
Expand Down
3 changes: 3 additions & 0 deletions WindowsTools/UI/Backdrop/SystemBackdrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using Windows.UI.Composition.Desktop;
using Windows.UI.Xaml;

// 抑制 CA1822 警告
#pragma warning disable CA1822

namespace WindowsTools.UI.Backdrop
{
/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions WindowsTools/UI/Dialogs/OperationFailedDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
using WindowsTools.Strings;
using WindowsTools.UI.TeachingTips;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060
// 抑制 CA1822,IDE0060 警告
#pragma warning disable CA1822,IDE0060

namespace WindowsTools.UI.Dialogs
{
Expand Down
4 changes: 2 additions & 2 deletions WindowsTools/UI/Dialogs/RestartAppsDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Windows.Forms;
using Windows.UI.Xaml.Controls;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060
// 抑制 CA1822,IDE0060 警告
#pragma warning disable CA1822,IDE0060

namespace WindowsTools.UI.Dialogs
{
Expand Down
5 changes: 3 additions & 2 deletions WindowsTools/Views/Pages/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
using WindowsTools.UI.TeachingTips;
using WindowsTools.WindowsAPI.PInvoke.Kernel32;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060
// 抑制 CA1806,IDE0060 警告
#pragma warning disable CA1806,IDE0060

namespace WindowsTools.Views.Pages
{
Expand Down Expand Up @@ -58,6 +58,7 @@ public bool IsChecking
private ListDictionary ReferenceList { get; } = new()
{
{ "Microsoft.UI.Xaml", "https://github.com/microsoft/microsoft-ui-xaml"},
{ "Microsoft.Windows.SDK.BuildTools", "https://aka.ms/WinSDKProjectURL"},
{ "Microsoft.Windows.SDK.Contracts", "https://aka.ms/WinSDKProjectURL"},
{ "Microsoft.WindowsAppSDK", "https://github.com/microsoft/windowsappsdk"},
{ "Mile.Xaml", "https://github.com/ProjectMile/Mile.Xaml"},
Expand Down
4 changes: 2 additions & 2 deletions WindowsTools/Views/Pages/CodeScannerPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
using ZXing.Common;
using ZXing.QrCode;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060
// 抑制 CA1822,IDE0060 警告
#pragma warning disable CA1822,IDE0060

namespace WindowsTools.Views.Pages
{
Expand Down
4 changes: 2 additions & 2 deletions WindowsTools/Views/Pages/DownloadManagerPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
using WindowsTools.WindowsAPI.ComTypes;
using WindowsTools.WindowsAPI.PInvoke.Shell32;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060
// 抑制 CA1806,IDE0060 警告
#pragma warning disable CA1806,IDE0060

namespace WindowsTools.Views.Pages
{
Expand Down
4 changes: 2 additions & 2 deletions WindowsTools/Views/Pages/FileNamePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
using WindowsTools.UI.TeachingTips;
using WindowsTools.WindowsAPI.ComTypes;

// 抑制 IDE0060 警告
#pragma warning disable IDE0060
// 抑制 CA1806,IDE0060 警告
#pragma warning disable CA1806,IDE0060

namespace WindowsTools.Views.Pages
{
Expand Down
Loading

0 comments on commit 4d12cb1

Please sign in to comment.