Skip to content

Commit d2febb0

Browse files
committed
Update 2.1.0
1 parent 6e5fa3f commit d2febb0

236 files changed

Lines changed: 2365 additions & 1603 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
0 Bytes
Binary file not shown.

.vs/OlibKey/v16/.suo

-2 KB
Binary file not shown.

App.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818

1919
<ContextMenu x:Key="TextBoxContextMenu">
2020
<MenuItem Command="ApplicationCommands.Cut" />
21-
<MenuItem Command="ApplicationCommands.Copy" />
21+
<MenuItem Command="ApplicationCommands.Copy">
22+
<MenuItem.Icon>
23+
<Image Width="16" Source="{DynamicResource copyDrawingImage}"/>
24+
</MenuItem.Icon>
25+
</MenuItem>
2226
<MenuItem Command="ApplicationCommands.Paste" />
2327
</ContextMenu>
2428

App.xaml.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ namespace OlibKey
1818
public partial class App
1919
{
2020
public new static MainWindow MainWindow;
21-
private static ResourceDictionary ResourceTheme;
21+
private static ResourceDictionary _resourceTheme;
2222
public static Setting Setting;
2323

24-
private static object sync = new object();
24+
public static object Sync = new object();
2525

2626
private static List<CultureInfo> Languages => new List<CultureInfo>();
2727

@@ -53,12 +53,12 @@ protected override void OnStartup(StartupEventArgs e)
5353

5454
Language = Lang.Default.IsFirstLanguage ? CultureInfo.CurrentCulture : Lang.Default.DefaultLanguage;
5555

56-
ResourceTheme = Resources.MergedDictionaries[2];
56+
_resourceTheme = Resources.MergedDictionaries[2];
5757
if (Setting.ApplyTheme != null)
58-
ResourceTheme.Source = new Uri($"/Themes/{Setting.ApplyTheme}.xaml", UriKind.Relative);
58+
_resourceTheme.Source = new Uri($"/Themes/{Setting.ApplyTheme}.xaml", UriKind.Relative);
5959

6060
MainWindow = new MainWindow();
61-
bool startHide = false;
61+
var startHide = false;
6262
if (Setting.AutorunApplication)
6363
foreach (var i in e.Args)
6464
if (i == "/StartupHide")
@@ -149,16 +149,19 @@ private void WriteLog(object sender, System.Windows.Threading.DispatcherUnhandle
149149
{
150150
try
151151
{
152-
string pathToLog = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log");
152+
var pathToLog = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log");
153153
if (!Directory.Exists(pathToLog))
154-
Directory.CreateDirectory(pathToLog);
155-
string filename = Path.Combine(pathToLog, $"{AppDomain.CurrentDomain.FriendlyName}_{DateTime.Now:dd.MM.yyy}.log");
156-
string fullText = $"[{DateTime.Now:dd.MM.yyy HH:mm:ss.fff}] [{e.Exception.TargetSite.DeclaringType}.{e.Exception.TargetSite.Name}()]\n{e.Exception}\r\n";
157-
lock (sync) File.AppendAllText(filename, fullText, Encoding.GetEncoding("UTF-8"));
154+
Directory.CreateDirectory(pathToLog);
155+
var filename = Path.Combine(pathToLog, $"{AppDomain.CurrentDomain.FriendlyName}_{DateTime.Now:dd.MM.yyy}.log");
156+
var fullText = $"[{DateTime.Now:dd.MM.yyy HH:mm:ss.fff}] [{e.Exception.TargetSite.DeclaringType}.{e.Exception.TargetSite.Name}()]\n{e.Exception}\r\n";
157+
lock (Sync) File.AppendAllText(filename, fullText, Encoding.GetEncoding("UTF-8"));
158158

159159
MessageBox.Show((string)FindResource("MB9") + $"\n{e.Exception.Message}", (string)FindResource("Error"), MessageBoxButton.OK, MessageBoxImage.Error);
160160
}
161-
catch { }
161+
catch
162+
{
163+
// ignored
164+
}
162165
}
163166
}
164167
}

CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9-
## [2.0.0.0] - 2020-03-04
9+
## [2.1.0] - 2020-04-30
10+
### Added
11+
- New item Reminder added.
12+
- New option for quick rendering in the settings.
13+
- Added ability to create custom folders.
14+
- Search added.
15+
- New icons added.
16+
17+
### Changed
18+
- Updated user interface.
19+
- Base storage method changed.
20+
- Animations on the start page are simplified.
21+
- Now, when changing the theme, the resource with icons is reloaded.
22+
- The name of the database now does not contain an extension.
23+
- Minor changes in the logical component.
24+
25+
### Fixed
26+
- Partially fixed display of text (blur).
27+
- If you lock the store, and then create a new one, the unlock button will become active.
28+
29+
## [2.0.0] - 2020-03-04
1030
### Added
1131
- Added buttons for moving items.
1232
- Added icons for items in the list.

Controls/AccountListItem.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<Border Background="White" CornerRadius="999" Grid.RowSpan="2" Height="25" Width="25" Margin="5,0">
1818
<Image x:Name="imageIcon" Source="{Binding IconWebSite, UpdateSourceTrigger=PropertyChanged}" Margin="5"/>
1919
</Border>
20-
<TextBlock Text="{Binding AccountName}" FontWeight="Bold" FontSize="16" Grid.Column="1" Foreground="{DynamicResource ForegroundWindow}"/>
20+
<TextBlock Text="{Binding AccountName}" FontWeight="Bold" FontSize="16" Grid.Row="0" Grid.Column="1" Foreground="{DynamicResource ForegroundWindow}"/>
2121
<TextBlock Text="{Binding Username}" FontSize="12" Grid.Column="1" Grid.Row="1" Foreground="{DynamicResource ForegroundOpacity}"/>
2222
</Grid>
2323
</UserControl>

Controls/AccountListItem.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public partial class AccountListItem : UserControl
1717
public Action<Account> ShowContentCallback { get; set; }
1818
public Action<Account> EditContentCallback { get; set; }
1919
public Action FocusCallback { get; set; }
20-
public Account AccountContext { get => DataContext as Account; }
20+
public Account AccountContext => DataContext as Account;
2121
public AccountListItem() => InitializeComponent();
2222

2323
public DispatcherTimer timer;
@@ -65,9 +65,9 @@ private void Timer_Tick(object sender, EventArgs e)
6565
{
6666
timer.Stop();
6767

68-
ReminderWindow reminderWindow = new ReminderWindow
68+
var reminderWindow = new ReminderWindow
6969
{
70-
accountListItem = this,
70+
AccountListItem = this,
7171
lNameElement = {Content = AccountContext.AccountName},
7272
lTimeStart = {Content = AccountContext.Username}
7373
};

Controls/FolderListItem.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace OlibKey.Controls
88
/// </summary>
99
public partial class FolderListItem : UserControl
1010
{
11-
public CustomFolder FolderContext { get => DataContext as CustomFolder; }
11+
public CustomFolder FolderContext => DataContext as CustomFolder;
1212
public FolderListItem() => InitializeComponent();
1313
}
1414
}

Core/Animations.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ namespace OlibKey.Core
88
{
99
public static class Animations
1010
{
11-
public async static Task ClosingWindowAnimation(Window w, ScaleTransform transform)
11+
public static async Task ClosingWindowAnimation(Window w, ScaleTransform transform)
1212
{
13-
DoubleAnimation anim = new DoubleAnimation { Duration = TimeSpan.FromSeconds(0.2), From = 1, To = 0, AccelerationRatio = 1};
14-
DoubleAnimation anim1 = new DoubleAnimation
13+
var anim = new DoubleAnimation { Duration = TimeSpan.FromSeconds(0.2), From = 1, To = 0, AccelerationRatio = 1};
14+
var anim1 = new DoubleAnimation
1515
{
1616
Duration = TimeSpan.FromSeconds(0.2),
1717
AccelerationRatio = 1,

Core/Encryptor.cs

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,40 @@ private static byte[] GetRandomBytes()
1919

2020
private static byte[] AES_Encrypt(byte[] bytesToBeEncrypted, byte[] passwordBytes)
2121
{
22-
byte[] encryptedBytes;
2322
byte[] saltBytes = {1, 2, 3, 4, 5, 6, 7, 8};
24-
using (var ms = new MemoryStream())
25-
{
26-
var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, 2000);
27-
using var aes = new RijndaelManaged {KeySize = 256, BlockSize = 128, Mode = CipherMode.CBC};
28-
aes.Key = key.GetBytes(aes.KeySize / 8);
29-
aes.IV = key.GetBytes(aes.BlockSize / 8);
30-
using (var cs = new CryptoStream(ms, aes.CreateEncryptor(), CryptoStreamMode.Write))
31-
{
32-
cs.Write(bytesToBeEncrypted, 0, bytesToBeEncrypted.Length);
33-
cs.Close();
34-
}
35-
36-
encryptedBytes = ms.ToArray();
37-
}
38-
39-
return encryptedBytes;
23+
24+
using var ms = new MemoryStream();
25+
26+
var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, 2000);
27+
using var aes = new RijndaelManaged {KeySize = 256, BlockSize = 128, Mode = CipherMode.CBC};
28+
aes.Key = key.GetBytes(aes.KeySize / 8);
29+
aes.IV = key.GetBytes(aes.BlockSize / 8);
30+
31+
using var cs = new CryptoStream(ms, aes.CreateEncryptor(), CryptoStreamMode.Write);
32+
33+
cs.Write(bytesToBeEncrypted, 0, bytesToBeEncrypted.Length);
34+
cs.Close();
35+
36+
return ms.ToArray();
4037
}
4138

4239
private static byte[] AES_Decrypt(byte[] bytesToBeDecrypted, byte[] passwordBytes)
4340
{
44-
byte[] decryptedBytes;
4541
byte[] saltBytes = {1, 2, 3, 4, 5, 6, 7, 8};
46-
using (var ms = new MemoryStream())
47-
{
48-
var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, 2000);
49-
using var aes = new RijndaelManaged {KeySize = 256, BlockSize = 128, Mode = CipherMode.CBC};
50-
aes.Key = key.GetBytes(aes.KeySize / 8);
51-
aes.IV = key.GetBytes(aes.BlockSize / 8);
52-
using (var cs = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write))
53-
{
54-
cs.Write(bytesToBeDecrypted, 0, bytesToBeDecrypted.Length);
55-
cs.Close();
56-
}
57-
58-
decryptedBytes = ms.ToArray();
59-
}
60-
61-
return decryptedBytes;
42+
43+
using var ms = new MemoryStream();
44+
45+
var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, 2000);
46+
using var aes = new RijndaelManaged {KeySize = 256, BlockSize = 128, Mode = CipherMode.CBC};
47+
aes.Key = key.GetBytes(aes.KeySize / 8);
48+
aes.IV = key.GetBytes(aes.BlockSize / 8);
49+
50+
using var cs = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write);
51+
52+
cs.Write(bytesToBeDecrypted, 0, bytesToBeDecrypted.Length);
53+
cs.Close();
54+
55+
return ms.ToArray();
6256
}
6357

6458
public static string EncryptString(string text, string password)
@@ -71,21 +65,21 @@ public static string EncryptString(string text, string password)
7165
for (var i = 0; i < baSalt.Length; i ++) baEncrypted[i] = baSalt[i];
7266
for (var i = 0; i < baText.Length; i ++) baEncrypted[i + baSalt.Length] = baText[i];
7367
baEncrypted = AES_Encrypt(baEncrypted, baPwdHash);
74-
string result = Convert.ToBase64String(baEncrypted);
75-
return result;
68+
69+
return Convert.ToBase64String(baEncrypted);
7670
}
7771

7872
public static string DecryptString(string text, string password)
7973
{
80-
byte[] baPwd = Encoding.UTF8.GetBytes(password);
81-
byte[] baPwdHash = SHA256.Create().ComputeHash(baPwd);
82-
byte[] baText = Convert.FromBase64String(text);
83-
byte[] baDecrypted = AES_Decrypt(baText, baPwdHash);
84-
int saltLength = SaltLength;
85-
byte[] baResult = new byte[baDecrypted.Length - saltLength];
74+
var baPwd = Encoding.UTF8.GetBytes(password);
75+
var baPwdHash = SHA256.Create().ComputeHash(baPwd);
76+
var baText = Convert.FromBase64String(text);
77+
var baDecrypted = AES_Decrypt(baText, baPwdHash);
78+
var saltLength = SaltLength;
79+
var baResult = new byte[baDecrypted.Length - saltLength];
8680
for (int i = 0; i < baResult.Length; i ++) baResult[i] = baDecrypted[i + saltLength];
87-
string result = Encoding.UTF8.GetString(baResult);
88-
return result;
81+
82+
return Encoding.UTF8.GetString(baResult);
8983
}
9084
}
9185
}

0 commit comments

Comments
 (0)