Skip to content

Commit 482c039

Browse files
authored
Merge pull request #557 from emoacht/develop
Develop
2 parents afd60aa + 991ee1d commit 482c039

File tree

9 files changed

+35
-27
lines changed

9 files changed

+35
-27
lines changed

Source/IconImage/DarkAppIcon.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
</UserControl.Resources>
1919

2020
<Grid Background="{x:Null}">
21-
<!--<Rectangle Fill="{StaticResource BackBrush}"/>-->
22-
<Rectangle Fill="{StaticResource BackBrush}" RadiusX="20" RadiusY="20"/>
21+
<Rectangle Fill="{StaticResource BackBrush}" RadiusX="28" RadiusY="28"/>
2322

2423
<Grid>
2524
<Border BorderBrush="{StaticResource EdgeBrush}"

Source/IconImage/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("4.6.0.0")]
55-
[assembly: AssemblyFileVersion("4.6.0.0")]
54+
[assembly: AssemblyVersion("4.6.2.0")]
55+
[assembly: AssemblyFileVersion("4.6.2.0")]

Source/Installer/Product.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
<Product Id="*" Name="Monitorian" Manufacturer="emoacht" Version="4.6.1"
3+
<Product Id="*" Name="Monitorian" Manufacturer="emoacht" Version="4.6.2"
44
Language="1033" Codepage="1252" UpgradeCode="{81A4D148-75D3-462E-938D-8C208FB48E3C}">
55
<Package Id="*" InstallerVersion="500" Compressed="yes"
66
InstallScope="perMachine" InstallPrivileges="elevated"

Source/Monitorian.Core/AppKeeper.cs

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public async Task<bool> StartAsync(StartupEventArgs e, IEnumerable<string> addit
3737

3838
SubscribeExceptions();
3939

40-
var (success, response) = StartupAgent.Start(ProductInfo.Product, ProductInfo.StartupTaskId, OtherArguments);
40+
var (success, response) = StartupAgent.Start(ProductInfo.Product, ProductInfo.StartupTaskId, ForwardingArguments);
4141
if (!success && (response is not null))
4242
{
4343
ConsoleService.WriteLine(response);
@@ -66,6 +66,9 @@ public void Write(string content)
6666
public static IReadOnlyList<string> OtherArguments => _otherArguments?.ToArray() ?? [];
6767
private static string[] _otherArguments;
6868

69+
public static IReadOnlyList<string> ForwardingArguments => _forwardingArguments?.ToArray() ?? [];
70+
private static string[] _forwardingArguments;
71+
6972
public static IEnumerable<string> EnumerateStandardOptions() =>
7073
new[]
7174
{
@@ -78,26 +81,32 @@ public static IEnumerable<string> EnumerateStandardOptions() =>
7881

7982
private async Task ParseArgumentsAsync(StartupEventArgs e, string[] standardOptions)
8083
{
81-
// Load persistent arguments.
82-
var args = (await LoadArgumentsAsync())?.Split() ?? [];
83-
84-
// Concatenate current and persistent arguments.
84+
// Divide current arguments.
8585
// The first element of StartupEventArgs.Args is not executing assembly's path unlike
8686
// that of arguments provided by Environment.GetCommandLineArgs method.
87-
args = e.Args.Concat(args.Select(x => x.Trim('"'))).ToArray();
88-
if (args is not { Length: > 0 })
89-
return;
87+
var (currentStandard, currentOther) = Divide(e.Args);
9088

91-
const char optionMark = '/';
92-
var isStandard = false;
89+
// Divide persistent arguments.
90+
var persistentArgs = (await LoadArgumentsAsync())?.Split().Select(x => x.Trim('"'));
91+
var (persistentStandard, persistentOther) = Divide(persistentArgs);
9392

94-
var buffer = args
95-
.Where(x => !string.IsNullOrWhiteSpace(x))
96-
.GroupBy(x => (x[0] == optionMark) ? (isStandard = standardOptions.Contains(x.ToLower())) : isStandard)
97-
.ToArray();
93+
_standardArguments = persistentStandard.Concat(currentStandard).ToArray();
94+
_forwardingArguments = currentOther.ToArray();
95+
_otherArguments = persistentOther.Concat(_forwardingArguments).ToArray();
9896

99-
_standardArguments = buffer.SingleOrDefault(x => x.Key)?.ToArray();
100-
_otherArguments = buffer.SingleOrDefault(x => !x.Key)?.ToArray();
97+
(IEnumerable<string> standard, IEnumerable<string> other) Divide(IEnumerable<string> args)
98+
{
99+
const char optionMark = '/';
100+
var isStandard = false;
101+
102+
var buffer = args
103+
.Where(x => !string.IsNullOrWhiteSpace(x))
104+
.GroupBy(x => (x[0] == optionMark) ? (isStandard = standardOptions.Contains(x.ToLower())) : isStandard)
105+
.ToArray() ?? [];
106+
107+
return (standard: buffer.SingleOrDefault(x => x.Key) ?? Enumerable.Empty<string>(),
108+
other: buffer.SingleOrDefault(x => !x.Key) ?? Enumerable.Empty<string>());
109+
}
101110
}
102111

103112
private const string ArgumentsFileName = "arguments.txt";

Source/Monitorian.Core/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("4.6.1.0")]
37-
[assembly: AssemblyFileVersion("4.6.1.0")]
36+
[assembly: AssemblyVersion("4.6.2.0")]
37+
[assembly: AssemblyFileVersion("4.6.2.0")]
3838
[assembly: NeutralResourcesLanguage("en-US")]
3939

4040
// For unit test

Source/Monitorian/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("4.6.1.0")]
55-
[assembly: AssemblyFileVersion("4.6.1.0")]
54+
[assembly: AssemblyVersion("4.6.2.0")]
55+
[assembly: AssemblyFileVersion("4.6.2.0")]
5656
[assembly: Guid("a4cc5362-9b08-465b-ad64-5cfabc72a4c7")]
5757
[assembly: NeutralResourcesLanguage("en-US")]
327 Bytes
Binary file not shown.

Source/StartupAgency/PipeHolder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public PipeHolder(string name, Func<string[], Task<string>> handleRequestAsync)
3737
/// <summary>
3838
/// Creates <see cref="System.Threading.Semaphore"/> to start named pipes.
3939
/// </summary>
40-
/// <param name="args">Arguments to another instance</param>
40+
/// <param name="args">Arguments being forwarded to another instance</param>
4141
/// <returns>
4242
/// <para>success: True if no other instance exists and this instance successfully creates</para>
4343
/// <para>response: Response from another instance if that instance exists and returns an response</para>

Source/StartupAgency/StartupAgent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class StartupAgent : IDisposable
2222
/// </summary>
2323
/// <param name="name">Name</param>
2424
/// <param name="startupTaskId">Startup task ID</param>
25-
/// <param name="args">Arguments to another instance</param>
25+
/// <param name="args">Arguments being forwarded to another instance</param>
2626
/// <returns>
2727
/// <para>success: True if no other instance exists and this instance successfully starts</para>
2828
/// <para>response: Response from another instance if that instance exists and returns an response</para>

0 commit comments

Comments
 (0)