Skip to content

Commit aa725ab

Browse files
committed
Supported command to run when count reached
1 parent d0439b5 commit aa725ab

30 files changed

+465
-50
lines changed

build/nsis/setup.nsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
!define PRODUCT_NAME "GenshinWoodmen"
2-
!define PRODUCT_VERSION "1.3.1.0"
2+
!define PRODUCT_VERSION "1.4.0.0"
33
!define PRODUCT_PUBLISHER "ema"
4-
!define PRODUCT_WEB_SITE "https://github.com/emako"
4+
!define PRODUCT_WEB_SITE "https://github.com/genshin-matrix"
55
!define PRODUCT_LEGAL "Licensed under MIT"
66

77
VIProductVersion "${PRODUCT_VERSION}"

src/GenshinWoodmen/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<v:LanguageToBoolConverter x:Key="LanguageToBoolConverter"/>
2424
<v:AddConverter x:Key="AddConverter"/>
2525
<v:ReverseConverter x:Key="ReverseConverter"/>
26+
<v:EqualsConverter x:Key="EqualsConverter"/>
2627
<tb:TaskbarIcon x:Key="PART_Taskbar"
2728
IconSource="Resources/favcion.ico"
2829
ToolTipText="Genshin Woodmen"

src/GenshinWoodmen/App.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public void CheckSingleInstance()
8787

8888
try
8989
{
90-
handle = EventWaitHandle.OpenExisting(Pack.Name);
90+
handle = EventWaitHandle.OpenExisting(Pack.Alias);
9191
handle.Set();
9292
Shutdown();
9393
}
9494
catch (WaitHandleCannotBeOpenedException)
9595
{
96-
handle = new EventWaitHandle(false, EventResetMode.AutoReset, Pack.Name);
96+
handle = new EventWaitHandle(false, EventResetMode.AutoReset, Pack.Alias);
9797
}
9898
GC.KeepAlive(handle);
9999
_ = Task.Run(() =>

src/GenshinWoodmen/Core/NativeMethods.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Runtime.InteropServices;
33
using System.Management;
4+
using System.Windows.Interop;
5+
using System.Windows;
46

57
namespace GenshinWoodmen.Core
68
{
@@ -11,6 +13,9 @@ internal static class NativeMethods
1113

1214
public const int SC_RESTORE = 0xF120;
1315

16+
public const int GWL_EXSTYLE = -20;
17+
public const int WS_EX_TOOLWINDOW = 0x00000080;
18+
1419
public const uint ES_AWAYMODE_REQUIRED = 0x00000040;
1520
public const uint ES_CONTINUOUS = 0x80000000;
1621
public const uint ES_DISPLAY_REQUIRED = 0x00000002;
@@ -112,6 +117,12 @@ internal static class NativeMethods
112117
[DllImport("user32.dll")]
113118
public static extern IntPtr MonitorFromPoint(POINT pt, uint dwFlags);
114119

120+
[DllImport("user32.dll")]
121+
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
122+
123+
[DllImport("user32.dll", CharSet = CharSet.Auto)]
124+
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
125+
115126
public static void Focus(IntPtr hwnd)
116127
{
117128
_ = SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
@@ -271,6 +282,14 @@ public static void SetBrightness(byte targetBrightness)
271282
break;
272283
}
273284
}
285+
286+
public static void SetToolWindow(IntPtr hwnd)
287+
{
288+
int style = (int)GetWindowLong(hwnd, GWL_EXSTYLE);
289+
290+
style |= WS_EX_TOOLWINDOW;
291+
SetWindowLong(hwnd, GWL_EXSTYLE, style);
292+
}
274293
}
275294

276295
[StructLayout(LayoutKind.Sequential)]

src/GenshinWoodmen/Core/Settings/SettingsManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace GenshinWoodmen.Core
66
internal class SettingsManager
77
{
88
public static event Action? Reloaded;
9-
public static readonly string Path = SpecialPathProvider.GetPath($"{Pack.Name}.yaml");
9+
public static readonly string Path = SpecialPathProvider.GetPath($"{Pack.Alias}.yaml");
1010
public static SettingsCache Cache = Init();
1111

1212
public static void Setup()

src/GenshinWoodmen/Core/SpecialPathProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal class SpecialPathProvider
1010
public static string GetPath(string baseName)
1111
{
1212
string appUserPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
13-
string configPath = Path.Combine(Path.Combine(appUserPath, Pack.Name), baseName);
13+
string configPath = Path.Combine(Path.Combine(appUserPath, Pack.Alias), baseName);
1414

1515
if (!Directory.Exists(new FileInfo(configPath).DirectoryName))
1616
{
@@ -21,7 +21,7 @@ public static string GetPath(string baseName)
2121

2222
public static string GetTempPath(string baseName)
2323
{
24-
return Path.Combine(TempPath + Pack.Name, baseName);
24+
return Path.Combine(TempPath + Pack.Alias, baseName);
2525
}
2626
}
2727
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.Reflection;
3+
using System.Text;
4+
5+
namespace GenshinWoodmen.Core
6+
{
7+
internal static class AssemblyUtils
8+
{
9+
public static string GetAssemblyVersion(this Assembly assembly, VersionType type = VersionType.Major | VersionType.Minor | VersionType.Build, string prefix = null, string subfix = null)
10+
{
11+
Version version = assembly.GetName().Version!;
12+
StringBuilder sb = new();
13+
14+
if (prefix != null)
15+
{
16+
sb.Append(prefix);
17+
}
18+
if (type.HasFlag(VersionType.Major))
19+
{
20+
sb.Append(version!.Major);
21+
}
22+
if (type.HasFlag(VersionType.Minor))
23+
{
24+
if (sb.Length > 0)
25+
sb.Append(".");
26+
sb.Append(version!.Minor);
27+
}
28+
if (type.HasFlag(VersionType.Build))
29+
{
30+
if (sb.Length > 0)
31+
sb.Append(".");
32+
sb.Append(version.Build);
33+
}
34+
if (type.HasFlag(VersionType.Revision))
35+
{
36+
if (sb.Length > 0)
37+
sb.Append(".");
38+
sb.Append(version.Revision);
39+
}
40+
if (subfix != null)
41+
{
42+
sb.Append(subfix);
43+
}
44+
return sb.ToString();
45+
}
46+
47+
[Flags]
48+
public enum VersionType
49+
{
50+
Major = 0,
51+
Minor = 1,
52+
Build = 2,
53+
Revision = 4,
54+
}
55+
}
56+
}

src/GenshinWoodmen/Core/UsageManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ await Task.Run(() =>
1818
{
1919
try
2020
{
21-
byte[] image = ResourceUtils.GetBytes("pack://application:,,,/genshin-woodmen;component/Resources/usage" + type switch
21+
byte[] image = ResourceUtils.GetBytes($"pack://application:,,,/{Pack.Name};component/Resources/usage" + type switch
2222
{
2323
UsageImageType.Single => "_single",
2424
UsageImageType.Multi => "_multi",

src/GenshinWoodmen/GenshinWoodmen.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
<ApplicationIcon>Resources\favcion.ico</ApplicationIcon>
1010
<ApplicationManifest>app.manifest</ApplicationManifest>
1111
<Platforms>x64</Platforms>
12-
<AssemblyName>genshin-woodmen</AssemblyName>
1312
<UseWindowsForms>True</UseWindowsForms>
14-
<AssemblyVersion>1.3.1</AssemblyVersion>
15-
<FileVersion>1.3.1</FileVersion>
16-
<Version>$(VersionPrefix)1.3.1</Version>
13+
<AssemblyVersion>1.4.0</AssemblyVersion>
14+
<FileVersion>1.4.0</FileVersion>
15+
<Version>$(VersionPrefix)1.4.0</Version>
1716
<Authors>ema</Authors>
1817
<Company>Lemutec</Company>
1918
<RestoreSources>$(RestoreSources);..\packages\vccli.net\;https://api.nuget.org/v3/index.json</RestoreSources>

src/GenshinWoodmen/GenshinWoodmen.csproj.user

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
<_LastSelectedProfileId>D:\GitHub\genshin-woodmen\src\GenshinWoodmen\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
55
</PropertyGroup>
66
<ItemGroup>
7+
<Compile Update="Views\CountReachSettingsDialog.xaml.cs">
8+
<SubType>Code</SubType>
9+
</Compile>
710
<Compile Update="Views\DialogWindow.xaml.cs">
811
<SubType>Code</SubType>
912
</Compile>
1013
</ItemGroup>
1114
<ItemGroup>
15+
<Page Update="Views\CountReachSettingsDialog.xaml">
16+
<SubType>Designer</SubType>
17+
</Page>
1218
<Page Update="Views\DialogWindow.xaml">
1319
<SubType>Designer</SubType>
1420
</Page>

0 commit comments

Comments
 (0)