Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Core/Upsilon.Apps.Passkey.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<Title>$(AssemblyName)</Title>
<Authors>Yassin Lokhat</Authors>
<Description>A local stored Password Manager Core.</Description>
<AssemblyVersion>1.0.1</AssemblyVersion>
<FileVersion>1.0.1</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
1,041 changes: 1,041 additions & 0 deletions Core/Utils/QrCode.cs

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions GUI/WPF/Upsilon.Apps.Passkey.GUI.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<Authors>Yassin Lokhat</Authors>
<Description>A local stored Password Manager GUI.</Description>
<Version>3.0.0</Version>
<AssemblyVersion>3.0.0</AssemblyVersion>
<FileVersion>3.0.0</FileVersion>
<AssemblyVersion>1.0.1</AssemblyVersion>
<FileVersion>1.0.1</FileVersion>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>

Expand All @@ -23,12 +23,6 @@
<ProjectReference Include="..\..\Core\Upsilon.Apps.Passkey.Core.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="QRCodeEncoderLibrary">
<HintPath>dll\QRCodeEncoderLibrary.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<None Update="raw\vidpll-sVqi93MN9TymqpQ==UGOcrUlBjHsiPMUpOVwOKjiSUBw=.pku">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
36 changes: 21 additions & 15 deletions GUI/WPF/Views/QrCodeView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using QRCodeEncoderLibrary;
using System.Drawing;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using Upsilon.Apps.Passkey.Core.Utils;
using Upsilon.Apps.Passkey.GUI.WPF.Themes;
using Upsilon.Apps.Passkey.GUI.WPF.ViewModels;

Expand Down Expand Up @@ -61,22 +61,28 @@ public static void CopyToClipboard(string text)

private static BitmapImage _getBitmap(string content)
{
QREncoder qrGenerator = new()
{
ErrorCorrection = ErrorCorrection.H
};
bool[,] matrix = qrGenerator.Encode(content);
int unit = 20;
bool[,] qrCode = QrCode.Generate(content);
int height = qrCode.GetLength(0);
int width = qrCode.GetLength(1);

QRSaveBitmapImage qrCodeImage = new(matrix)
{
ModuleSize = 100,
QuietZone = 50
};
Bitmap bitmap = new((height + 2) * unit, (width + 2) * unit);

MemoryStream ms = new();
qrCodeImage.SaveQRCodeToImageFile(ms, ImageFormat.Bmp);
using (Graphics g = Graphics.FromImage(bitmap))
{
g.FillRectangle(Brushes.White, 0, 0, (height + 2) * unit, (width + 2) * unit);

Bitmap bitmap = (Bitmap)Image.FromStream(ms);
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
if (qrCode[i, j])
{
g.FillRectangle(Brushes.Black, (i + 1) * unit, (j + 1) * unit, unit, unit);
}
}
}
}

using MemoryStream memory = new();
bitmap.Save(memory, ImageFormat.Png);
Expand Down
8 changes: 4 additions & 4 deletions GUI/WPF/Views/UserServicesView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ private void _showActivities_MenuItem_Click(object sender, RoutedEventArgs e)
&& MainViewModel.UserActivitiesView.IsLoaded)
{
UserActivitiesViewModel? vm = MainViewModel.UserActivitiesView.DataContext as UserActivitiesViewModel;
vm?.NeedsReview = false;
_ = (vm?.NeedsReview = false);

_ = MainViewModel.UserActivitiesView.Activate();
return;
Expand Down Expand Up @@ -348,7 +348,7 @@ private void _activityWarnings_MI_Click(object sender, RoutedEventArgs e)
&& MainViewModel.UserActivitiesView.IsLoaded)
{
UserActivitiesViewModel? vm = MainViewModel.UserActivitiesView.DataContext as UserActivitiesViewModel;
vm?.NeedsReview = true;
_ = (vm?.NeedsReview = true);

_ = MainViewModel.UserActivitiesView.Activate();
return;
Expand Down Expand Up @@ -381,8 +381,8 @@ private void _expiredOrLeakedPasswordWarnings_MI_Click(object sender, RoutedEven
&& MainViewModel.AccountPasswordsWarningView.IsLoaded)
{
AccountPasswordsWarningViewModel? vm = MainViewModel.AccountPasswordsWarningView.DataContext as AccountPasswordsWarningViewModel;
vm?.WarningType = sender == _expiredPasswordWarnings_MI
? WarningType.PasswordUpdateReminderWarning : WarningType.PasswordLeakedWarning;
_ = (vm?.WarningType = sender == _expiredPasswordWarnings_MI
? WarningType.PasswordUpdateReminderWarning : WarningType.PasswordLeakedWarning);

_ = MainViewModel.AccountPasswordsWarningView.Activate();
return;
Expand Down
Binary file removed GUI/WPF/dll/QRCodeEncoderLibrary.dll
Binary file not shown.