Skip to content

Commit

Permalink
improved stabillity
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickiel committed Sep 29, 2024
1 parent c51385b commit 96c9499
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/FastAccountSwitcher.CLI/FastAccountSwitcher.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

</Project>
19 changes: 17 additions & 2 deletions src/FastAccountSwitcher.CLI/Services/PasswordService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
using FastAccountSwitcher.CLI.Services;
using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Text.Json;
Expand Down Expand Up @@ -27,7 +29,20 @@ public void DeletePassword(string userName)
List<Credential> credentials = ReadCredentials();
var credential = credentials.FirstOrDefault(c => c.UserName.Equals(userName, StringComparison.OrdinalIgnoreCase));

return credential == null ? null : UnprotectPassword(credential.ProtectedPassword);
if(credential is null)
{
return null;
}

try
{
return UnprotectPassword(credential.ProtectedPassword);
}
catch (Exception ex)
{
LoggingService.LogException(ex);
return null;
}
}

public void SetPassword(string userName, SecureString password)
Expand Down
4 changes: 2 additions & 2 deletions src/FastAccountSwitcher.GUI/FastAccountSwitcher.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
<PackageReference Include="System.DirectoryServices" Version="8.0.0" />
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="8.0.0" />
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="TaskScheduler" Version="2.11.0" />
<PackageReference Include="WPF-UI" Version="3.0.4" />
<PackageReference Include="WPF-UI" Version="3.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Fast Account Switcher"
"ProductCode" = "8:{708AAD1D-DA2F-43BF-898D-33C60295ABFE}"
"PackageCode" = "8:{F847DC99-9928-4DE0-9DEB-1A2D06CA07B0}"
"ProductCode" = "8:{4830A848-CD75-439E-BE22-90DF1A83F5D2}"
"PackageCode" = "8:{AF8CAB13-6D86-4677-806A-487FCF4DACFA}"
"UpgradeCode" = "8:{3BB84402-A6C5-4543-AAA0-9CD8D42E26C2}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:1.0.0"
"ProductVersion" = "8:1.1.0"
"Manufacturer" = "8:Patrick Demichiel"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down

0 comments on commit 96c9499

Please sign in to comment.