Skip to content

Commit aefb221

Browse files
author
Dylan Bickerstaff
committed
.
1 parent c60e155 commit aefb221

11 files changed

+127
-377
lines changed

CommonProperties.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<TargetFramework>net8.0-windows</TargetFramework>
44
<ApplicationIcon>..\SuperLauncherAssets\logo.ico</ApplicationIcon>
55
<Product>Super Launcher</Product>
6+
<AssemblyTitle>Super Launcher</AssemblyTitle>
67
<AssemblyVersion>2.1.0.0</AssemblyVersion>
78
<FileVersion>2.1.0.0</FileVersion>
89
<NeutralLanguage>en-US</NeutralLanguage>
@@ -17,5 +18,11 @@
1718
<PlatformTarget>x64</PlatformTarget>
1819
<Platforms>x64</Platforms>
1920
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
21+
<NoWarn>CS0108</NoWarn>
2022
</PropertyGroup>
23+
<!--<ItemGroup>
24+
<AssemblyAttribute Include="System.Reflection.AssemblyTitleAttribute">
25+
<_Parameter1>Super Launcher</_Parameter1>
26+
</AssemblyAttribute>
27+
</ItemGroup>-->
2128
</Project>

SuperLauncher/CredentialExpirationService.cs

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,36 @@ namespace SuperLauncher
99
public static class CredentialExpirationService
1010
{
1111
private static Timer Timer = new();
12-
public static DateTime ExpirationDate = DateTime.MaxValue;
12+
public static DateTime PasswordLastSet = DateTime.MaxValue;
13+
public static TimeSpan MaxPasswordAge = TimeSpan.MaxValue;
14+
public static string PasswordExpirationMessage
15+
{
16+
get
17+
{
18+
return
19+
"Password expires in " +
20+
ExpirationTimeSpan.Days +
21+
" day(s), " +
22+
ExpirationTimeSpan.Hours +
23+
" hour(s) and " +
24+
ExpirationTimeSpan.Seconds +
25+
" second(s).";
26+
}
27+
}
28+
public static DateTime PasswordExpirationDate
29+
{
30+
get
31+
{
32+
return PasswordLastSet.Add(MaxPasswordAge);
33+
}
34+
}
35+
public static TimeSpan ExpirationTimeSpan
36+
{
37+
get
38+
{
39+
return PasswordExpirationDate.Subtract(DateTime.Now);
40+
}
41+
}
1342
public static void Initialize()
1443
{
1544
Timer.Elapsed += CheckExpiration;
@@ -36,9 +65,11 @@ public static void CheckExpiration(object s = null, object e = null)
3665
ds.Filter = "(objectSid=" + WindowsIdentity.GetCurrent().User.Value + ")";
3766
SearchResult user = ds.FindOne();
3867
bool pwdNeverExpires = (((int)user.Properties["userAccountControl"][0]) & 0x00010000) == 0x00010000; //https://learn.microsoft.com/en-us/windows/win32/api/iads/ne-iads-ads_user_flag_enum
39-
DateTime ExpirationDate = DateTime.FromFileTime((long)user.Properties["pwdLastSet"][0]);
40-
TimeSpan maxPwdAge = TimeSpan.FromMicroseconds((long)root.Properties["maxPwdAge"][0] / 10 * -1);
41-
68+
PasswordLastSet = DateTime.FromFileTime((long)user.Properties["pwdLastSet"][0]);
69+
MaxPasswordAge = TimeSpan.FromMicroseconds((long)root.Properties["maxPwdAge"][0] / 10 * -1);
70+
ModernLauncherNotifyIcon.Icon.BalloonTipTitle = RunAsHelper.GetCurrentDomainWithUserName();
71+
ModernLauncherNotifyIcon.Icon.BalloonTipText = PasswordExpirationMessage;
72+
ModernLauncherNotifyIcon.Icon.ShowBalloonTip(0);
4273
}
4374
catch
4475
{

SuperLauncher/ModernLauncher.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ private void SetElevateLabels()
137137
{
138138
ElevateIcon.Content = "";
139139
}
140-
141140
}
142141
private void Window_Loaded(object sender, RoutedEventArgs e)
143142
{
@@ -287,7 +286,7 @@ private void BtnAdd_Click(object sender, RoutedEventArgs e)
287286
}
288287
private void ElevateUser_MouseEnter(object sender, MouseEventArgs e)
289288
{
290-
ExpirationBadge = new("Test");
289+
ExpirationBadge = new(CredentialExpirationService.PasswordExpirationMessage);
291290
ExpirationBadge.Show();
292291
}
293292
private void ElevateUser_MouseLeave(object sender, MouseEventArgs e)

SuperLauncher/ModernLauncherBadge.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:SuperLauncher"
77
mc:Ignorable="d"
8-
Title="ModernLauncherBadge" Height="48" Width="125" ResizeMode="NoResize" ShowInTaskbar="False" SizeToContent="WidthAndHeight" Topmost="True" AllowsTransparency="True" WindowStyle="None" Background="Transparent" ShowActivated="False">
8+
Title="ModernLauncherBadge" SizeChanged="Window_SizeChanged" Height="48" Width="125" ResizeMode="NoResize" ShowInTaskbar="False" SizeToContent="WidthAndHeight" Topmost="True" AllowsTransparency="True" WindowStyle="None" Background="Transparent" ShowActivated="False">
99
<Grid>
1010
<Grid Margin="10,10,10,10">
1111
<Rectangle RadiusX="14" RadiusY="14" Fill="#FF121212" />

SuperLauncher/ModernLauncherBadge.xaml.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Windows;
3+
using static System.Net.Mime.MediaTypeNames;
34

45
namespace SuperLauncher
56
{
@@ -8,12 +9,17 @@ namespace SuperLauncher
89
/// </summary>
910
public partial class ModernLauncherBadge : Window
1011
{
12+
private string Text = "Super Launcher";
1113
public ModernLauncherBadge(string Text)
1214
{
15+
this.Text = Text;
1316
InitializeComponent();
14-
LabelText.Content = Text;
1517
}
1618
private void Label_Initialized(object sender, EventArgs e)
19+
{
20+
LabelText.Content = Text;
21+
}
22+
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
1723
{
1824
Win32Interop.GetCursorPos(out Win32Interop.POINT point);
1925
Top = ModernLauncher.DPI.ScalePixelsDown(point.y);

SuperLauncher/ModernLauncherIcon.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private void UserControl_MouseUp(object sender, MouseButtonEventArgs e)
124124
ModernLauncherContextMenuIcon menuItems = new(this);
125125
menu.Frame.Content = menuItems;
126126
Win32Interop.GetCursorPos(out Win32Interop.POINT point);
127-
menu.Left = ModernLauncher.DPI.ScalePixelsDown(point.x);
127+
menu.Left = ModernLauncher.DPI.ScalePixelsDown(point.x) - 200;
128128
menu.Top = ModernLauncher.DPI.ScalePixelsDown(point.y) - 100;
129129
menuItems.MouseUp += Menu_MouseUp;
130130
menu.Show();

SuperLauncher/ModernLauncherNotifyIcon.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public static void Initialize()
99
{
1010
Icon = new()
1111
{
12+
Text = "Super Launcher",
1213
Icon = Resources.logo,
1314
Visible = true
1415
};

SuperLauncher/Program.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
using System;
22
using System.Diagnostics;
3-
using System.Timers;
4-
53

64
namespace SuperLauncher
75
{
86
static class Program
97
{
108
public static bool ModernApplicationShuttingDown = false;
119
public static System.Windows.Application ModernApplication;
12-
public static Timer accountMonitorTimer = new Timer(TimeSpan.FromMinutes(30));
1310
public static string[] Arguments;
1411
/// <summary>
1512
/// The main entry point for the application.
@@ -43,10 +40,7 @@ public static void Main(string[] arguments)
4340
public static void ModernApplicationShutdown()
4441
{
4542
ModernApplicationShuttingDown = true;
46-
accountMonitorTimer.Stop();
47-
accountMonitorTimer.Dispose();
4843
ModernApplication.Shutdown();
4944
}
50-
5145
}
5246
}

SuperLauncher/Properties/app.manifest

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="0.0.0.0" name="SuperLauncher"/>
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5+
<security>
6+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7+
<!-- UAC Manifest Options
8+
If you want to change the Windows User Account Control level replace the
9+
requestedExecutionLevel node with one of the following.
10+
11+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
12+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
13+
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
14+
15+
Specifying requestedExecutionLevel element will disable file and registry virtualization.
16+
Remove this element if your application requires this virtualization for backwards
17+
compatibility.
18+
-->
19+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
20+
</requestedPrivileges>
21+
</security>
22+
</trustInfo>
23+
24+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
25+
<application>
26+
<!-- A list of the Windows versions that this application has been tested on
27+
and is designed to work with. Uncomment the appropriate elements
28+
and Windows will automatically select the most compatible environment. -->
29+
30+
<!-- Windows Vista -->
31+
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
32+
33+
<!-- Windows 7 -->
34+
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
35+
36+
<!-- Windows 8 -->
37+
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
38+
39+
<!-- Windows 8.1 -->
40+
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
41+
42+
<!-- Windows 10 -->
43+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
44+
45+
</application>
46+
</compatibility>
47+
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
48+
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
49+
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
50+
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
51+
52+
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
53+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
54+
<windowsSettings>
55+
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
56+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
57+
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
58+
</windowsSettings>
59+
</application>
60+
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
61+
<dependency>
62+
<dependentAssembly>
63+
<assemblyIdentity
64+
type="win32"
65+
name="Microsoft.Windows.Common-Controls"
66+
version="6.0.0.0"
67+
processorArchitecture="*"
68+
publicKeyToken="6595b64144ccf1df"
69+
language="*"
70+
/>
71+
</dependentAssembly>
72+
</dependency>
73+
</assembly>

SuperLauncher/SuperLauncher.csproj

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,8 @@
44
<OutputType>WinExe</OutputType>
55
<UseWindowsForms>true</UseWindowsForms>
66
<UseWPF>true</UseWPF>
7+
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
78
</PropertyGroup>
8-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
9-
<NoWarn>1701;1702;WFAC010</NoWarn>
10-
</PropertyGroup>
11-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
12-
<NoWarn>1701;1702;WFAC010</NoWarn>
13-
</PropertyGroup>
14-
<ItemGroup>
15-
<AdditionalFiles Remove="app.manifest" />
16-
</ItemGroup>
179
<ItemGroup>
1810
<None Remove="48.png" />
1911
<None Remove="Resources\banner.png" />

0 commit comments

Comments
 (0)