Skip to content

Commit 3ab9c7c

Browse files
authored
v1.3.8 release
1 parent 3acc511 commit 3ab9c7c

8 files changed

+710
-299
lines changed

SafeNotes/AppManager.cs

Lines changed: 519 additions & 225 deletions
Large diffs are not rendered by default.

SafeNotes/AppSettings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ public class AppSettings
55
public string EntryText { get; set; } = string.Empty;
66
public string NotepadSaveText { get; set; } = string.Empty;
77
public bool SaveDate { get; set; } = true;
8+
public bool DisableNotifications { get; set; } = false;
89
public bool LightMode { get; set; } = false;
910
public bool IsUserLoggedIn { get; set; } = false;
1011
public bool FirstTimeOpened { get; set; } = true;
12+
public bool RequirePinCode { get; set; } = false;
13+
public string PinCode { get; set; } = null;
1114
public string Entries { get; set; } = string.Empty;
1215
}

SafeNotes/EventHandlers.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ public async Task CheckForUpdatesAsync()
106106

107107
// Write the batch file for replacing the old version
108108
File.WriteAllText(batFilePath, $@"
109-
@echo off
110-
echo Update starting >> ""{logPath}""
111-
timeout /t 2 /nobreak > nul
112-
del /f /q ""{currentExePath}"" >> ""{logPath}"" 2>&1
113-
move /y ""{tempExePath}"" ""{currentExePath}"" >> ""{logPath}"" 2>&1
114-
start ""SafeNotes"" ""{currentExePath}""
115-
echo Update complete >> ""{logPath}""
116-
");
109+
@echo off
110+
echo Update starting >> ""{logPath}""
111+
timeout /t 2 /nobreak > nul
112+
del /f /q ""{currentExePath}"" >> ""{logPath}"" 2>&1
113+
move /y ""{tempExePath}"" ""{currentExePath}"" >> ""{logPath}"" 2>&1
114+
start ""SafeNotes"" ""{currentExePath}""
115+
echo Update complete >> ""{logPath}""
116+
");
117117

118118
// Launch the batch file to replace the app
119119
Process.Start(new ProcessStartInfo

SafeNotes/JournalUtilities.cs

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// File: SafeNotes/Utilities.cs
22
using System;
33
using System.IO;
4+
using System.Linq;
45

56
namespace SafeNotes
67
{
@@ -10,27 +11,16 @@ private void UpdateEntriesCountAndSaveToFile()
1011
{
1112
// Update the savedEntriesCount label
1213
SavedEntriesCount.Text = "Saved entries: " + EntriesListBox.Items.Count.ToString();
13-
14-
string exeDirectory = AppDomain.CurrentDomain.BaseDirectory;
15-
string filePath = Path.Combine(exeDirectory, "entries.txt");
16-
17-
// Now save all entries to a txt file in the location of the application's .exe
18-
string[] entries = new string[EntriesListBox.Items.Count];
19-
for (int i = 0; i < EntriesListBox.Items.Count; i++)
20-
{
21-
// Do not include "ListViewItem:" in the txt file, instead say Entry # and the number of the entry
22-
entries[i] = EntriesListBox.Items[i].ToString().Replace("ListViewItem: {", "").Replace("}", "");
23-
}
24-
System.IO.File.WriteAllLines(filePath, entries);
2514
}
2615

2716
private string FindManagerPath(string managerName)
2817
{
2918
string[] paths = {
30-
"C:\\Program Files\\" + managerName + "\\" + managerName + ".exe",
31-
"C:\\Program Files (x86)\\" + managerName + "\\" + managerName + ".exe"
19+
Path.Combine("C:\\Program Files", managerName, managerName + ".exe"),
20+
Path.Combine("C:\\Program Files (x86)", managerName, managerName + ".exe")
3221
};
3322

23+
// Check in Program Files and Program Files (x86)
3424
foreach (string path in paths)
3525
{
3626
if (File.Exists(path))
@@ -39,6 +29,18 @@ private string FindManagerPath(string managerName)
3929
}
4030
}
4131

32+
// Check AppData\Local and all subdirectories
33+
string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), managerName);
34+
if (Directory.Exists(appDataPath))
35+
{
36+
string[] exeFiles = Directory.GetFiles(appDataPath, "*.exe", SearchOption.AllDirectories)
37+
.Where(f => Path.GetFileName(f).ToLower().Contains(managerName.ToLower()))
38+
.ToArray();
39+
if (exeFiles.Length > 0)
40+
{
41+
return exeFiles[0];
42+
}
43+
}
4244
return null;
4345
}
4446

@@ -47,31 +49,31 @@ private string GetManagerArgs(string managerName)
4749
switch (managerName)
4850
{
4951
case "Bitwarden":
50-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
52+
return "--password" + UserPassword.Text;
5153
case "KeePass Password Safe 2":
52-
return "\" -user=\"" + UserPassword.Text + "\" -pw=\"" + UserConfirmPassword.Text + "\"";
54+
return "\"-pw=\"" + UserPassword.Text + "\"";
5355
case "1Password":
54-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
56+
return "--password" + UserPassword.Text;
5557
case "LastPass":
56-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
58+
return "--password" + UserPassword.Text;
5759
case "ProtonPass":
58-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
60+
return "--password" + UserPassword.Text;
5961
case "NordPass":
60-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
62+
return "--password" + UserPassword.Text;
6163
case "Dashlane":
62-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
64+
return "--password" + UserPassword.Text;
6365
case "Zoho Vault":
64-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
66+
return "--password" + UserPassword.Text;
6567
case "RoboForm":
66-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
68+
return "--password" + UserPassword.Text;
6769
case "Sticky Password":
68-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
70+
return "--password" + UserPassword.Text;
6971
case "Keeper":
70-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
72+
return "--password" + UserPassword.Text;
7173
case "Enpass":
72-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
74+
return "--password" + UserPassword.Text;
7375
case "Total Password":
74-
return "--username " + UserPassword.Text + " --password " + UserConfirmPassword.Text;
76+
return "--password" + UserPassword.Text;
7577
default:
7678
return null;
7779
}

0 commit comments

Comments
 (0)