16 Commits

Author SHA1 Message Date
adaa6256cd feat: file metadata 2026-03-12 11:11:34 +01:00
d0f54655b8 chore; WTF 2026-03-11 22:16:47 +01:00
fe92236978 chore: bump version 2026-03-11 22:10:32 +01:00
ff101bf569 hotfix: directory init fixes & installer file naming system 2026-03-11 22:08:15 +01:00
74fddcdb9d chore: bump to 1.4.3 2026-03-11 14:46:02 +01:00
3cc1631d5a Merge pull request 'feature/autocomplete' (#8) from feature/autocomplete into master
Reviewed-on: #8
2026-03-11 14:41:46 +01:00
0e8c9fc691 chore(autocomplete): documentation 2026-03-11 14:38:12 +01:00
a0de93f98c feat: autocompletions 2026-03-11 14:28:43 +01:00
da8ce47f8b bump: installer version 2026-03-10 17:17:50 +01:00
e8972ed2bb Merge pull request 'feat(autoupdate): detect install type' (#7) from feature/auto-update into master
Reviewed-on: #7
2026-03-10 17:15:04 +01:00
41b3725faa feat(autoupdate): detect install type 2026-03-10 17:13:42 +01:00
1366481931 Merge pull request 'feature/auto-update' (#6) from feature/auto-update into master
Reviewed-on: #6
2026-03-10 16:40:01 +01:00
56165cae46 Merge branch 'master' into feature/auto-update 2026-03-10 16:39:50 +01:00
86e6be2bd3 fix: autoupdater failing to fetch prerelease versions 2026-03-10 16:38:18 +01:00
f24d1321a8 feat(autoupdate): remove trailing zeros, show prerelease tag 2026-03-10 16:17:04 +01:00
8245955e9c Merge pull request 'feature/auto-update' (#5) from feature/auto-update into master
Reviewed-on: #5
2026-03-10 16:03:55 +01:00
23 changed files with 7678 additions and 136 deletions

View File

@@ -21,6 +21,12 @@
} }
"Entry" "Entry"
{ {
"MsmKey" = "8:_058C8316BA034FF38880D3C8838A3F74"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_39292C9AEE694F0B982DDECDC0233E12" "MsmKey" = "8:_39292C9AEE694F0B982DDECDC0233E12"
"OwnerKey" = "8:_UNDEFINED" "OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED"
@@ -160,6 +166,26 @@
"IsDependency" = "11:FALSE" "IsDependency" = "11:FALSE"
"IsolateTo" = "8:" "IsolateTo" = "8:"
} }
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_058C8316BA034FF38880D3C8838A3F74"
{
"SourcePath" = "8:E:\\Development\\Scripts\\CM3Merge\\merged-cars.json"
"TargetName" = "8:car_data.json"
"Tag" = "8:"
"Folder" = "8:_91D306E0AE6B4CA09DB4A07129FBDD93"
"Condition" = "8:"
"Transitive" = "11:TRUE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_39292C9AEE694F0B982DDECDC0233E12" "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_39292C9AEE694F0B982DDECDC0233E12"
{ {
"SourcePath" = "8:D:\\Assets\\Car Manager\\Icon\\CarMgm_Icon.ico" "SourcePath" = "8:D:\\Assets\\Car Manager\\Icon\\CarMgm_Icon.ico"
@@ -332,15 +358,15 @@
{ {
"Name" = "8:Microsoft Visual Studio" "Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Car Manager 3" "ProductName" = "8:Car Manager 3"
"ProductCode" = "8:{8FDFF7ED-D464-4F87-BA8F-BDC1000520E4}" "ProductCode" = "8:{C464F09B-4ED2-46D4-A17B-49BD0F6E6566}"
"PackageCode" = "8:{83DA7553-805F-4A70-921B-9A6FB0787780}" "PackageCode" = "8:{D55B03D7-E738-48F7-B6BD-87113014326E}"
"UpgradeCode" = "8:{6FF57925-465E-4DB9-85DA-CE933191A3DD}" "UpgradeCode" = "8:{6FF57925-465E-4DB9-85DA-CE933191A3DD}"
"AspNetVersion" = "8:2.0.50727.0" "AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE" "RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE" "RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE" "InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:1.4.0" "ProductVersion" = "8:1.4.4"
"Manufacturer" = "8:Jaro Digital" "Manufacturer" = "8:Jaro Digital"
"ARPHELPTELEPHONE" = "8:" "ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:" "ARPHELPLINK" = "8:"
@@ -413,10 +439,32 @@
"Name" = "8:[Manufacturer]" "Name" = "8:[Manufacturer]"
"Condition" = "8:" "Condition" = "8:"
"AlwaysCreate" = "11:FALSE" "AlwaysCreate" = "11:FALSE"
"DeleteAtUninstall" = "11:FALSE" "DeleteAtUninstall" = "11:TRUE"
"Transitive" = "11:FALSE" "Transitive" = "11:FALSE"
"Keys" "Keys"
{ {
"{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_022FD53D0D4C4621A160F70F2E4A81DE"
{
"Name" = "8:CarManager3"
"Condition" = "8:"
"AlwaysCreate" = "11:FALSE"
"DeleteAtUninstall" = "11:TRUE"
"Transitive" = "11:FALSE"
"Keys"
{
}
"Values"
{
"{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_22123BF42909409F8D665A142188737C"
{
"Name" = "8:InstallType"
"Condition" = "8:"
"Transitive" = "11:TRUE"
"ValueTypes" = "3:1"
"Value" = "8:MSI"
}
}
}
} }
"Values" "Values"
{ {

View File

@@ -16,6 +16,12 @@
<setting name="AllowPrerelease" serializeAs="String"> <setting name="AllowPrerelease" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="LastFetchedAutoCompletions" serializeAs="String">
<value>2026-01-01</value>
</setting>
<setting name="FetchAutoCompletionsInterval" serializeAs="String">
<value>24.00:00:00</value>
</setting>
</CarManagerV3.Properties.Settings> </CarManagerV3.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>

View File

@@ -15,7 +15,7 @@
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.4.0</ApplicationVersion> <ApplicationVersion>1.4.4</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
@@ -23,9 +23,12 @@
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets> <ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<ApplicationIcon>CarMgm_Icon.ico</ApplicationIcon> <ApplicationIcon>CarMgm_Icon.ico</ApplicationIcon>
<AssemblyTitle>Car Manager 3</AssemblyTitle> <AssemblyTitle>CarManager3</AssemblyTitle>
<Product>Car Manager 3</Product> <Product>CarManager3</Product>
<Version>1.4.0</Version> <Version>1.4.4</Version>
<Authors>Jaro Digital</Authors>
<Company>Jaro Digital</Company>
<Title>Car Manager 3</Title>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -178,22 +178,7 @@ namespace CarManagerV3
try try
{ {
string[] parts = csv.Split(';'); string[] parts = csv.Split(';');
// is part 7 a valid int? if not set it to 0 and log a warning. System.Diagnostics.Debug.WriteLine(csv);
if (parts.Length == 7)
{
Console.Error.WriteLine($"Warning: CSV string has only 7 fields, expected 8. Setting Order to 0. CSV: {csv}");
if (!StateManager.askForMigration())
{
throw new Exception("User declined migration. Cannot parse CSV string with missing Order field.");
}
Array.Resize(ref parts, 8);
parts[7] = "0";
}
else if (parts.Length != 8)
{
throw new FormatException($"CSV string has {parts.Length} fields, expected 8. CSV: {csv}");
}
Car temp = new Car(parts[0], parts[1], parts[2], int.Parse(parts[3]), parts[4], int.Parse(parts[5]), decimal.Parse(parts[6]), int.Parse(parts[7])); Car temp = new Car(parts[0], parts[1], parts[2], int.Parse(parts[3]), parts[4], int.Parse(parts[5]), decimal.Parse(parts[6]), int.Parse(parts[7]));
return temp; return temp;
} }

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CarManagerV3.Classes
{
internal class CarManufacturer
{
public string Name { get; set; }
public List<string> Models { get; set; }
public CarManufacturer(string name)
{
Name = name;
Models = new List<string>();
}
public void AddModel(string model)
{
Models.Add(model);
}
public override string ToString()
{
return $"{Name} - Models: {string.Join(", ", Models)}";
}
public List<string> GetModels()
{
return Models;
}
public void RemoveModel(string model)
{
Models.Remove(model);
}
public void ClearModels()
{
Models.Clear();
}
public string GetModelByQuery(string query)
{
return Models.FirstOrDefault(m => m.Equals(query, StringComparison.OrdinalIgnoreCase));
}
}
}

View File

@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CarManagerV3.Manager;
namespace CarManagerV3.Classes
{
internal class FileMeta
{
private string version;
private DateTime lastModified;
public string Version { get { return version; } set { version = value; } }
public DateTime LastModified { get { return lastModified; } }
public FileMeta(string version)
{
this.version = version;
this.lastModified = DateTime.Now;
}
public static FileMeta FromCSV(string csv)
{
string[] parts = csv.Split(';');
if (parts.Length < 3)
{
throw new FormatException("CSV format is incorrect. Expected format: product;version;lastModified");
}
return new FileMeta(parts[1]) { lastModified = DateTime.Parse(parts[2]) };
}
public static FileMeta Generate()
{
string version = Updater.GetCurrentVersion();
return new FileMeta(version);
}
public static bool IsFileMeta(string csv)
{
return csv.StartsWith("CarManager3;");
}
public static bool IsOlderVersion(FileMeta meta)
{
string version = Updater.GetCurrentVersion();
return Updater.IsNewerVersion(version, meta.Version);
}
public static bool NeedsUpdate(FileMeta meta)
{
string version = Updater.GetCurrentVersion();
return Updater.IsNewerVersion(version, meta.Version) && FileUpdate.GetRequiredUpdates(meta.Version).Count > 0;
}
public void Modify()
{
lastModified = DateTime.Now;
}
public string ToCSV()
{
return $"CarManager3;{version};{lastModified}";
}
public override string ToString()
{
return $"File Version: {version}, Last Modified: {lastModified}";
}
}
}

View File

@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CarManagerV3.Manager;
namespace CarManagerV3.Classes
{
internal class FileUpdate
{
public string version;
public bool needUpdate;
public Func<string, string> updateAction;
public static List<FileUpdate> GetUpdates()
{
return new List<FileUpdate>
{
new FileUpdate {
version = "1.4.3.0",
needUpdate = true,
updateAction = (fileContent) =>
{
// Implement the logic to update the file content for version
List<string> parts = fileContent.Split(";").ToList();
parts[4] = "Black";
return string.Join(";", parts);
}
},
new FileUpdate {
version = "1.4.4.0",
needUpdate = false
}
// Add more FileUpdate instances for other versions as needed
};
}
public static List<FileUpdate> GetRequiredUpdates(string fromVersion)
{
string currentVersion = Updater.GetCurrentVersion();
// Get all updates whos version is greater than fromVersion
return GetUpdates().Where(update => string.Compare(update.version, fromVersion) > 0 && string.Compare(update.version, currentVersion) <= 0 && update.needUpdate && update.updateAction != null).ToList();
}
public static string ApplyUpdates(string fileContent, string fileVersion)
{
List<FileUpdate> updates = GetRequiredUpdates(fileVersion);
foreach (var update in updates)
{
if (update.needUpdate && update.updateAction != null)
{
fileContent = update.updateAction(fileContent);
}
}
return fileContent;
}
public static List<string> ApplyUpdatesToALl(List<string> fileContents, string fileVersion)
{
List<FileUpdate> updates = GetRequiredUpdates(fileVersion);
List<string> updatedContents = new List<string>();
foreach (var content in fileContents)
{
string updatedContent = content;
foreach (var update in updates)
{
if (update.needUpdate && update.updateAction != null)
{
updatedContent = update.updateAction(updatedContent);
}
}
updatedContents.Add(updatedContent);
}
return updatedContents;
}
public static string PerformOldLegacyUpdate(string fileContent)
{
string[] parts = fileContent.Split(';');
// is part 7 a valid int? if not set it to 0 and log a warning.
if (parts.Length == 7)
{
Console.Error.WriteLine($"Warning: CSV string has only 7 fields, expected 8. Setting Order to 0. CSV: {fileContent}");
if (!StateManager.askForMigration())
{
throw new Exception("User declined migration. Cannot parse CSV string with missing Order field.");
}
Array.Resize(ref parts, 8);
parts[7] = "0";
return string.Join(";", parts);
}
else if (parts.Length != 8)
{
throw new FormatException($"CSV string has {parts.Length} fields, expected 8. CSV: {fileContent}");
}
return fileContent;
}
}
}

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using CarManagerV3.Util;
namespace CarManagerV3 namespace CarManagerV3
{ {
@@ -29,6 +30,39 @@ namespace CarManagerV3
{ {
lblID.Text = $"ID: {car.Id}"; lblID.Text = $"ID: {car.Id}";
} }
SetAutoCompleteForMake();
SetAutoCompleteForModel();
SetAutoCompleteForColor();
}
private void SetAutoCompleteForMake()
{
var makes = CarCompletions.GetCarBrands();
var makeAutoComplete = new AutoCompleteStringCollection();
makeAutoComplete.AddRange(makes.ToArray());
tbxMake.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
tbxMake.AutoCompleteSource = AutoCompleteSource.CustomSource;
tbxMake.AutoCompleteCustomSource = makeAutoComplete;
}
private void SetAutoCompleteForModel()
{
var models = CarCompletions.GetCarModels(tbxMake.Text);
var modelAutoComplete = new AutoCompleteStringCollection();
modelAutoComplete.AddRange(models.ToArray());
tbxModel.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
tbxModel.AutoCompleteSource = AutoCompleteSource.CustomSource;
tbxModel.AutoCompleteCustomSource = modelAutoComplete;
}
private void SetAutoCompleteForColor()
{
var colors = CarCompletions.CommonColors;
var colorAutoComplete = new AutoCompleteStringCollection();
colorAutoComplete.AddRange(colors.ToArray());
tbxColor.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
tbxColor.AutoCompleteSource = AutoCompleteSource.CustomSource;
tbxColor.AutoCompleteCustomSource = colorAutoComplete;
} }
/// <summary> /// <summary>
@@ -69,6 +103,7 @@ namespace CarManagerV3
() => car.Make = ValueOrFormer(tbxMake.Text, car.Make), () => car.Make = ValueOrFormer(tbxMake.Text, car.Make),
() => tbxMake.Text = car.Make () => tbxMake.Text = car.Make
); );
SetAutoCompleteForModel();
} }
private void tbxModel_TextChanged(object sender, EventArgs e) private void tbxModel_TextChanged(object sender, EventArgs e)
@@ -163,7 +198,8 @@ namespace CarManagerV3
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{ {
if (keyData == Keys.Enter) // Ctrl+S to save, Esc to close, Delete to delete
if (keyData == (Keys.Control | Keys.S))
{ {
btnSave.PerformClick(); btnSave.PerformClick();
return true; // Indicate that the key has been handled return true; // Indicate that the key has been handled

View File

@@ -30,7 +30,7 @@
{ {
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); tlpWrapper = new System.Windows.Forms.TableLayoutPanel();
flpCars = new System.Windows.Forms.FlowLayoutPanel(); flpCars = new System.Windows.Forms.FlowLayoutPanel();
tlpControls = new System.Windows.Forms.TableLayoutPanel(); tlpControls = new System.Windows.Forms.TableLayoutPanel();
btnNewCar = new System.Windows.Forms.Button(); btnNewCar = new System.Windows.Forms.Button();
@@ -53,35 +53,40 @@
toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
openWelcomeScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); openWelcomeScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
clearRecentFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); clearRecentFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
imageList1 = new System.Windows.Forms.ImageList(components);
aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
checkForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); checkForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
gitRepositoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); gitRepositoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
tableLayoutPanel1.SuspendLayout(); tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
lblFileInfo = new System.Windows.Forms.Label();
imageList1 = new System.Windows.Forms.ImageList(components);
tlpWrapper.SuspendLayout();
tlpControls.SuspendLayout(); tlpControls.SuspendLayout();
tlpSearch.SuspendLayout(); tlpSearch.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pbxSearch).BeginInit(); ((System.ComponentModel.ISupportInitialize)pbxSearch).BeginInit();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
tableLayoutPanel2.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// tableLayoutPanel1 // tlpWrapper
// //
tableLayoutPanel1.ColumnCount = 1; tlpWrapper.ColumnCount = 1;
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); tlpWrapper.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
tableLayoutPanel1.Controls.Add(flpCars, 0, 2); tlpWrapper.Controls.Add(flpCars, 0, 2);
tableLayoutPanel1.Controls.Add(tlpControls, 0, 1); tlpWrapper.Controls.Add(tlpControls, 0, 1);
tableLayoutPanel1.Controls.Add(menuStrip1, 0, 0); tlpWrapper.Controls.Add(menuStrip1, 0, 0);
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; tlpWrapper.Controls.Add(tableLayoutPanel2, 0, 3);
tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); tlpWrapper.Dock = System.Windows.Forms.DockStyle.Fill;
tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); tlpWrapper.Location = new System.Drawing.Point(0, 0);
tableLayoutPanel1.Name = "tableLayoutPanel1"; tlpWrapper.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tableLayoutPanel1.RowCount = 3; tlpWrapper.Name = "tlpWrapper";
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); tlpWrapper.RowCount = 4;
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); tlpWrapper.RowStyles.Add(new System.Windows.Forms.RowStyle());
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); tlpWrapper.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
tableLayoutPanel1.Size = new System.Drawing.Size(902, 653); tlpWrapper.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
tableLayoutPanel1.TabIndex = 0; tlpWrapper.RowStyles.Add(new System.Windows.Forms.RowStyle());
tableLayoutPanel1.Paint += tableLayoutPanel1_Paint; tlpWrapper.Size = new System.Drawing.Size(902, 653);
tlpWrapper.TabIndex = 0;
tlpWrapper.Paint += tableLayoutPanel1_Paint;
// //
// flpCars // flpCars
// //
@@ -91,7 +96,7 @@
flpCars.Location = new System.Drawing.Point(3, 82); flpCars.Location = new System.Drawing.Point(3, 82);
flpCars.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); flpCars.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
flpCars.Name = "flpCars"; flpCars.Name = "flpCars";
flpCars.Size = new System.Drawing.Size(896, 567); flpCars.Size = new System.Drawing.Size(896, 541);
flpCars.TabIndex = 1; flpCars.TabIndex = 1;
// //
// tlpControls // tlpControls
@@ -292,14 +297,6 @@
clearRecentFilesToolStripMenuItem.Text = "Clear recent files"; clearRecentFilesToolStripMenuItem.Text = "Clear recent files";
clearRecentFilesToolStripMenuItem.Click += clearRecentFilesToolStripMenuItem_Click; clearRecentFilesToolStripMenuItem.Click += clearRecentFilesToolStripMenuItem_Click;
// //
// imageList1
//
imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
imageList1.ImageStream = (System.Windows.Forms.ImageListStreamer)resources.GetObject("imageList1.ImageStream");
imageList1.TransparentColor = System.Drawing.Color.Transparent;
imageList1.Images.SetKeyName(0, "Icon_Search.png");
imageList1.Images.SetKeyName(1, "Icon_Add.png");
//
// aboutToolStripMenuItem // aboutToolStripMenuItem
// //
aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { checkForUpdatesToolStripMenuItem, gitRepositoryToolStripMenuItem }); aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { checkForUpdatesToolStripMenuItem, gitRepositoryToolStripMenuItem });
@@ -310,23 +307,57 @@
// checkForUpdatesToolStripMenuItem // checkForUpdatesToolStripMenuItem
// //
checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem"; checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem";
checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(224, 26); checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(213, 26);
checkForUpdatesToolStripMenuItem.Text = "Check for Updates"; checkForUpdatesToolStripMenuItem.Text = "Check for Updates";
checkForUpdatesToolStripMenuItem.Click += checkForUpdatesToolStripMenuItem_Click; checkForUpdatesToolStripMenuItem.Click += checkForUpdatesToolStripMenuItem_Click;
// //
// gitRepositoryToolStripMenuItem // gitRepositoryToolStripMenuItem
// //
gitRepositoryToolStripMenuItem.Name = "gitRepositoryToolStripMenuItem"; gitRepositoryToolStripMenuItem.Name = "gitRepositoryToolStripMenuItem";
gitRepositoryToolStripMenuItem.Size = new System.Drawing.Size(224, 26); gitRepositoryToolStripMenuItem.Size = new System.Drawing.Size(213, 26);
gitRepositoryToolStripMenuItem.Text = "Git Repository"; gitRepositoryToolStripMenuItem.Text = "Git Repository";
gitRepositoryToolStripMenuItem.Click += gitRepositoryToolStripMenuItem_Click; gitRepositoryToolStripMenuItem.Click += gitRepositoryToolStripMenuItem_Click;
// //
// tableLayoutPanel2
//
tableLayoutPanel2.AutoSize = true;
tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
tableLayoutPanel2.ColumnCount = 2;
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
tableLayoutPanel2.Controls.Add(lblFileInfo, 0, 0);
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
tableLayoutPanel2.Location = new System.Drawing.Point(3, 630);
tableLayoutPanel2.Name = "tableLayoutPanel2";
tableLayoutPanel2.RowCount = 1;
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
tableLayoutPanel2.Size = new System.Drawing.Size(896, 20);
tableLayoutPanel2.TabIndex = 4;
//
// lblFileInfo
//
lblFileInfo.AutoSize = true;
lblFileInfo.ForeColor = System.Drawing.SystemColors.ActiveBorder;
lblFileInfo.Location = new System.Drawing.Point(3, 0);
lblFileInfo.Name = "lblFileInfo";
lblFileInfo.Size = new System.Drawing.Size(150, 20);
lblFileInfo.TabIndex = 0;
lblFileInfo.Text = "No File info available";
//
// imageList1
//
imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
imageList1.ImageStream = (System.Windows.Forms.ImageListStreamer)resources.GetObject("imageList1.ImageStream");
imageList1.TransparentColor = System.Drawing.Color.Transparent;
imageList1.Images.SetKeyName(0, "Icon_Search.png");
imageList1.Images.SetKeyName(1, "Icon_Add.png");
//
// MainForm // MainForm
// //
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(902, 653); ClientSize = new System.Drawing.Size(902, 653);
Controls.Add(tableLayoutPanel1); Controls.Add(tlpWrapper);
Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
MainMenuStrip = menuStrip1; MainMenuStrip = menuStrip1;
Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
@@ -334,21 +365,23 @@
Name = "MainForm"; Name = "MainForm";
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
Text = "Carmanager 3"; Text = "Carmanager 3";
tableLayoutPanel1.ResumeLayout(false); tlpWrapper.ResumeLayout(false);
tableLayoutPanel1.PerformLayout(); tlpWrapper.PerformLayout();
tlpControls.ResumeLayout(false); tlpControls.ResumeLayout(false);
tlpSearch.ResumeLayout(false); tlpSearch.ResumeLayout(false);
tlpSearch.PerformLayout(); tlpSearch.PerformLayout();
((System.ComponentModel.ISupportInitialize)pbxSearch).EndInit(); ((System.ComponentModel.ISupportInitialize)pbxSearch).EndInit();
menuStrip1.ResumeLayout(false); menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout(); menuStrip1.PerformLayout();
tableLayoutPanel2.ResumeLayout(false);
tableLayoutPanel2.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tlpWrapper;
private System.Windows.Forms.FlowLayoutPanel flpCars; private System.Windows.Forms.FlowLayoutPanel flpCars;
private System.Windows.Forms.TableLayoutPanel tlpControls; private System.Windows.Forms.TableLayoutPanel tlpControls;
private System.Windows.Forms.TextBox tbxSearch; private System.Windows.Forms.TextBox tbxSearch;
@@ -375,5 +408,7 @@
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem gitRepositoryToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem gitRepositoryToolStripMenuItem;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Label lblFileInfo;
} }
} }

View File

@@ -4,8 +4,10 @@ using System.Data;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using CarManagerV3.Classes;
using CarManagerV3.Forms; using CarManagerV3.Forms;
using CarManagerV3.Manager; using CarManagerV3.Manager;
using CarManagerV3.Util;
namespace CarManagerV3 namespace CarManagerV3
{ {
@@ -65,8 +67,19 @@ namespace CarManagerV3
{ {
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease)) if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
{ {
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(), Updater.GetLatestVersion()); if (InstallModeDetector.IsInstalledViaMsi())
{
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(true), Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
updatePrompt.ShowDialog(); updatePrompt.ShowDialog();
} else
{
DialogResult updateResult = MessageBox.Show($"A new version of Car Manager is available! \nYour Version: {Updater.GetCurrentVersion(true)} \nLatest Version: {Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease)} \n\nDo you want to open the Git repository to download the update?", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (updateResult == DialogResult.Yes)
{
Updater.OpenReleasePage(Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
}
}
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -74,6 +87,8 @@ namespace CarManagerV3
Console.Error.WriteLine("Error checking for updates: " + ex.Message); Console.Error.WriteLine("Error checking for updates: " + ex.Message);
} }
CarCompletions.UpdateCarCompletionDataAsync();
} }
@@ -204,7 +219,7 @@ namespace CarManagerV3
Car other = cars.Where(c => c.Order < order).OrderByDescending(c => c.Order).FirstOrDefault(); Car other = cars.Where(c => c.Order < order).OrderByDescending(c => c.Order).FirstOrDefault();
if (other != null) if (other != null)
{ {
Console.WriteLine($"Swapping order of {car.ToString()} ({car.Order}) and {other.ToString()} ({other.Order})"); System.Diagnostics.Debug.WriteLine($"Swapping order of {car.ToString()} ({car.Order}) and {other.ToString()} ({other.Order})");
int temp = car.Order; int temp = car.Order;
car.Order = other.Order; car.Order = other.Order;
other.Order = temp; other.Order = temp;
@@ -221,7 +236,7 @@ namespace CarManagerV3
Car other = cars.Where(c => c.Order > order).OrderBy(c => c.Order).FirstOrDefault(); Car other = cars.Where(c => c.Order > order).OrderBy(c => c.Order).FirstOrDefault();
if (other != null) if (other != null)
{ {
Console.WriteLine($"Swapping order of {car.ToString()} ({car.Order}) and {other.ToString()} ({other.Order})"); System.Diagnostics.Debug.WriteLine($"Swapping order of {car.ToString()} ({car.Order}) and {other.ToString()} ({other.Order})");
int temp = car.Order; int temp = car.Order;
car.Order = other.Order; car.Order = other.Order;
other.Order = temp; other.Order = temp;
@@ -251,6 +266,16 @@ namespace CarManagerV3
flpCars.Refresh(); flpCars.Refresh();
flpCars.Invalidate(); flpCars.Invalidate();
flpCars.Update(); flpCars.Update();
refreshMeta();
}
private void refreshMeta()
{
FileMeta meta = SafeManager.GetFileMeta(filepath);
string version = Updater.GetCurrentVersion(true);
lblFileInfo.Text = $"Car Manager 3 v.{version}, " + meta.ToString();
} }
@@ -363,6 +388,7 @@ namespace CarManagerV3
refreshCars(cars); refreshCars(cars);
SafeManager.SaveCars(filepath, cars); SafeManager.SaveCars(filepath, cars);
MessageBox.Show("File saved successfully.", "Save File", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("File saved successfully.", "Save File", MessageBoxButtons.OK, MessageBoxIcon.Information);
refreshMeta();
} }
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
@@ -571,12 +597,12 @@ namespace CarManagerV3
{ {
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease)) if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
{ {
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(), Updater.GetLatestVersion()); UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(true), Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease));
updatePrompt.ShowDialog(); updatePrompt.ShowDialog();
} }
else else
{ {
MessageBox.Show($"You are already using the latest version. ({Updater.GetCurrentVersion()})", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show($"You are already using the latest version. \nYour Version: {Updater.GetCurrentVersion(true)} \nLatest Version: {Updater.GetLatestVersion(Properties.Settings.Default.AllowPrerelease)}", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -117,9 +117,6 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnNewCar.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btnNewCar.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
@@ -142,6 +139,9 @@
VXs21p8MAVc2KdQAvwAAAABJRU5ErkJggg== VXs21p8MAVc2KdQAvwAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 17</value> <value>153, 17</value>
</metadata> </metadata>
@@ -150,15 +150,15 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAYAQAAAJNU0Z0AUkBTAIBAQIB SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAYAQAAAJNU0Z0AUkBTAIBAQIB
AAGYAQABmAEAARQBAAEUAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABUAMAARQDAAEBAQABIAYAARn/ AAGwAQABsAEAARQBAAEUAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABUAMAARQDAAEBAQABIAYAARn/
AP8AzAADCAEKAyMBMgMuAUYDFgEe/wAtAAMIAQoDIwEyAk8BTgGXAlYBVAGrAy4BRv8ALQADIwEyAk8B AP8AzAADCAEKAyMBMgMuAUYDFgEe/wAtAAMIAQoDIwEyAk8BTgGXAlYBVAGrAy4BRv8ALQADIwEyAk8B
TgGXAf8BmQEzAf8DTgGWAyMBMiwAA10BzAT/9AADKAE8Ak8BTgGXAl8BWwHTA04BlgMjATIDCAEKLAAD TgGXAf8BmQEzAf8DTgGWAyMBMiwAA10BzAT/9AADKAE8Ak8BTgGXAl8BWwHTA04BlgMjATIDCAEKLAAD
XQHMBP/UAAMDAQQDDwETA0QBewJPAU4BlwNNAZIDQAFuAwYBBwMpAT0DTgGYAlsBWQHAAk8BTgGXAyMB XQHMBP/UAAMDAQQDDwETA0QBewJPAU4BlwNNAZIDQAFuAwYBBwMpAT0DTgGYAlsBWQHAAk8BTgGXAyMB
MgMIAQowAANdAcwE/9AAAxMBGgMxAU0DRAF5AlwBWQHBAmEBXQHPAl0BWwHKAlcBVQG0Az8BbQNSAaMC MgMIAQowAANdAcwE/9AAAxMBGgMxAU0DRAF5AlwBWQHBAmEBXQHPAl0BWwHKAlcBVQG0Az8BbQNSAaMC
WwFZAcADTgGYAygBPDgAA10BzAT/zAADAwEEAzEBTQJZAVcBvAJgAV0BzgNLAYwDQAFvA0ABbwNLAYwC WwFZAcADTgGYAygBPDgAA10BzAT/zAADAwEEAzEBTQJZAVcBvAJgAV0BzgNLAYwDQAFvA0ABbwNLAYwC
YAFdAc4BfAFtAVMB9AJTAVEBogMpAT08AANdAcwE/8wAAw8BEwNEAXkCYAFdAc4DBgEIBAIIAAQCAwYB YAFdAc4BeAFoAVMB9AJTAVEBogMpAT08AANdAcwE/8wAAw8BEwNEAXkCYAFdAc4DBgEIBAIIAAQCAwYB
CAJgAV0BzgM+AWsDBAEFKAADXQHMLP+4AANEAXkDWgG/A0sBjAQCEAAEAgNLAYwCWgFYAbcDQQFxKAAD CAJgAV0BzgM+AWsDBAEFKAADXQHMLP+4AANEAXkDWgG/A0sBjAQCEAAEAgNLAYwCWgFYAbcDQQFxKAAD
UgGjA10BzANdAcwDXQHMA10BzAOFAfUE/wNdAcwDXQHMA10BzANdAcwDXQHMuAACTwFOAZcCYAFdAc4D UgGjA10BzANdAcwDXQHMA10BzAN/AfUE/wNdAcwDXQHMA10BzANdAcwDXQHMuAACTwFOAZcCYAFdAc4D
QAFvGAADQAFvAl8BXAHLA04BlDwAA10BzAT/zAACTwFOAZcCYAFdAc4DQAFvGAADQAFvAl4BWwHNA04B QAFvGAADQAFvAl8BXAHLA04BlDwAA10BzAT/zAACTwFOAZcCYAFdAc4DQAFvGAADQAFvAl4BWwHNA04B
ljwAA10BzAT/zAADRAF6AlsBWQHAA0sBjAQCEAAEAgNLAYwCWgFYAb0CRAFDAXc8AANdAcwE/8wAAw4B ljwAA10BzAT/zAADRAF6AlsBWQHAA0sBjAQCEAAEAgNLAYwCWgFYAb0CRAFDAXc8AANdAcwE/8wAAw4B
EgNEAXgCYAFdAc4DBgEIBAIIAAQCAwYBCAJgAV0BzgJDAUIBdQMMAQ88AANdAcwE/8wAAwMBBAMxAU0C EgNEAXgCYAFdAc4DBgEIBAIIAAQCAwYBCAJgAV0BzgJDAUIBdQMMAQ88AANdAcwE/8wAAwMBBAMxAU0C

View File

@@ -36,15 +36,27 @@
btnAccept = new System.Windows.Forms.Button(); btnAccept = new System.Windows.Forms.Button();
btnDiscard = new System.Windows.Forms.Button(); btnDiscard = new System.Windows.Forms.Button();
tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
lblCompletionsRefreshWindow = new System.Windows.Forms.Label();
lblDataLocation = new System.Windows.Forms.Label(); lblDataLocation = new System.Windows.Forms.Label();
tbxDataLocation = new System.Windows.Forms.TextBox(); tbxDataLocation = new System.Windows.Forms.TextBox();
cbxPreRelease = new System.Windows.Forms.CheckBox();
flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
nudCompletionIntervalHours = new System.Windows.Forms.NumericUpDown();
label3 = new System.Windows.Forms.Label();
nudCompletionIntervalMinutes = new System.Windows.Forms.NumericUpDown();
label4 = new System.Windows.Forms.Label();
tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
btnReset = new System.Windows.Forms.Button(); btnReset = new System.Windows.Forms.Button();
cbxPreRelease = new System.Windows.Forms.CheckBox(); flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
lblEnv = new System.Windows.Forms.Label();
flowLayoutPanel1.SuspendLayout(); flowLayoutPanel1.SuspendLayout();
flowLayoutPanel2.SuspendLayout(); flowLayoutPanel2.SuspendLayout();
tableLayoutPanel1.SuspendLayout(); tableLayoutPanel1.SuspendLayout();
flowLayoutPanel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)nudCompletionIntervalHours).BeginInit();
((System.ComponentModel.ISupportInitialize)nudCompletionIntervalMinutes).BeginInit();
tableLayoutPanel2.SuspendLayout(); tableLayoutPanel2.SuspendLayout();
flowLayoutPanel3.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// flowLayoutPanel1 // flowLayoutPanel1
@@ -84,10 +96,10 @@
flowLayoutPanel2.Controls.Add(btnDiscard); flowLayoutPanel2.Controls.Add(btnDiscard);
flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
flowLayoutPanel2.Location = new System.Drawing.Point(249, 0); flowLayoutPanel2.Location = new System.Drawing.Point(249, 30);
flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
flowLayoutPanel2.Name = "flowLayoutPanel2"; flowLayoutPanel2.Name = "flowLayoutPanel2";
flowLayoutPanel2.Size = new System.Drawing.Size(240, 64); flowLayoutPanel2.Size = new System.Drawing.Size(240, 44);
flowLayoutPanel2.TabIndex = 2; flowLayoutPanel2.TabIndex = 2;
// //
// btnAccept // btnAccept
@@ -118,27 +130,46 @@
tableLayoutPanel1.ColumnCount = 2; tableLayoutPanel1.ColumnCount = 2;
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
tableLayoutPanel1.Controls.Add(lblCompletionsRefreshWindow, 0, 2);
tableLayoutPanel1.Controls.Add(lblDataLocation, 0, 0); tableLayoutPanel1.Controls.Add(lblDataLocation, 0, 0);
tableLayoutPanel1.Controls.Add(tbxDataLocation, 1, 0); tableLayoutPanel1.Controls.Add(tbxDataLocation, 1, 0);
tableLayoutPanel1.Controls.Add(cbxPreRelease, 1, 1); tableLayoutPanel1.Controls.Add(cbxPreRelease, 0, 1);
tableLayoutPanel1.Controls.Add(flowLayoutPanel4, 1, 2);
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
tableLayoutPanel1.Location = new System.Drawing.Point(0, 86); tableLayoutPanel1.Location = new System.Drawing.Point(0, 86);
tableLayoutPanel1.Name = "tableLayoutPanel1"; tableLayoutPanel1.Name = "tableLayoutPanel1";
tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0); tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
tableLayoutPanel1.RowCount = 3; tableLayoutPanel1.RowCount = 7;
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 0F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
tableLayoutPanel1.Size = new System.Drawing.Size(499, 531); tableLayoutPanel1.Size = new System.Drawing.Size(499, 531);
tableLayoutPanel1.TabIndex = 3; tableLayoutPanel1.TabIndex = 3;
// //
// lblCompletionsRefreshWindow
//
lblCompletionsRefreshWindow.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
lblCompletionsRefreshWindow.AutoSize = true;
lblCompletionsRefreshWindow.Location = new System.Drawing.Point(13, 66);
lblCompletionsRefreshWindow.Margin = new System.Windows.Forms.Padding(3);
lblCompletionsRefreshWindow.MaximumSize = new System.Drawing.Size(150, 0);
lblCompletionsRefreshWindow.Name = "lblCompletionsRefreshWindow";
lblCompletionsRefreshWindow.Size = new System.Drawing.Size(148, 1);
lblCompletionsRefreshWindow.TabIndex = 4;
lblCompletionsRefreshWindow.Text = "Refresh completions after";
lblCompletionsRefreshWindow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblDataLocation // lblDataLocation
// //
lblDataLocation.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; lblDataLocation.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
lblDataLocation.AutoSize = true; lblDataLocation.AutoSize = true;
lblDataLocation.Location = new System.Drawing.Point(13, 6); lblDataLocation.Location = new System.Drawing.Point(13, 6);
lblDataLocation.Name = "lblDataLocation"; lblDataLocation.Name = "lblDataLocation";
lblDataLocation.Size = new System.Drawing.Size(102, 20); lblDataLocation.Size = new System.Drawing.Size(148, 20);
lblDataLocation.TabIndex = 0; lblDataLocation.TabIndex = 0;
lblDataLocation.Text = "Data Location"; lblDataLocation.Text = "Data Location";
lblDataLocation.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; lblDataLocation.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -146,38 +177,11 @@
// tbxDataLocation // tbxDataLocation
// //
tbxDataLocation.Dock = System.Windows.Forms.DockStyle.Fill; tbxDataLocation.Dock = System.Windows.Forms.DockStyle.Fill;
tbxDataLocation.Location = new System.Drawing.Point(121, 3); tbxDataLocation.Location = new System.Drawing.Point(167, 3);
tbxDataLocation.Name = "tbxDataLocation"; tbxDataLocation.Name = "tbxDataLocation";
tbxDataLocation.Size = new System.Drawing.Size(365, 27); tbxDataLocation.Size = new System.Drawing.Size(319, 27);
tbxDataLocation.TabIndex = 1; tbxDataLocation.TabIndex = 1;
// //
// tableLayoutPanel2
//
tableLayoutPanel2.ColumnCount = 2;
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
tableLayoutPanel2.Controls.Add(flowLayoutPanel2, 1, 0);
tableLayoutPanel2.Controls.Add(btnReset, 0, 0);
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
tableLayoutPanel2.Location = new System.Drawing.Point(0, 553);
tableLayoutPanel2.Name = "tableLayoutPanel2";
tableLayoutPanel2.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
tableLayoutPanel2.RowCount = 1;
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
tableLayoutPanel2.Size = new System.Drawing.Size(499, 64);
tableLayoutPanel2.TabIndex = 4;
//
// btnReset
//
btnReset.AutoSize = true;
btnReset.Location = new System.Drawing.Point(13, 3);
btnReset.Name = "btnReset";
btnReset.Size = new System.Drawing.Size(130, 30);
btnReset.TabIndex = 3;
btnReset.Text = "Revert to default";
btnReset.UseVisualStyleBackColor = true;
btnReset.Click += btnReset_Click;
//
// cbxPreRelease // cbxPreRelease
// //
cbxPreRelease.AutoSize = true; cbxPreRelease.AutoSize = true;
@@ -190,6 +194,114 @@
cbxPreRelease.Text = "Pre-Release channel"; cbxPreRelease.Text = "Pre-Release channel";
cbxPreRelease.UseVisualStyleBackColor = true; cbxPreRelease.UseVisualStyleBackColor = true;
// //
// flowLayoutPanel4
//
flowLayoutPanel4.AutoSize = true;
flowLayoutPanel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
flowLayoutPanel4.Controls.Add(nudCompletionIntervalHours);
flowLayoutPanel4.Controls.Add(label3);
flowLayoutPanel4.Controls.Add(nudCompletionIntervalMinutes);
flowLayoutPanel4.Controls.Add(label4);
flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
flowLayoutPanel4.Location = new System.Drawing.Point(164, 66);
flowLayoutPanel4.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
flowLayoutPanel4.Name = "flowLayoutPanel4";
flowLayoutPanel4.Size = new System.Drawing.Size(325, 1);
flowLayoutPanel4.TabIndex = 5;
//
// nudCompletionIntervalHours
//
nudCompletionIntervalHours.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
nudCompletionIntervalHours.Location = new System.Drawing.Point(3, 3);
nudCompletionIntervalHours.Name = "nudCompletionIntervalHours";
nudCompletionIntervalHours.Size = new System.Drawing.Size(44, 27);
nudCompletionIntervalHours.TabIndex = 0;
nudCompletionIntervalHours.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
//
// label3
//
label3.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom;
label3.AutoSize = true;
label3.Location = new System.Drawing.Point(53, 0);
label3.Name = "label3";
label3.Size = new System.Drawing.Size(24, 33);
label3.TabIndex = 1;
label3.Text = "h :";
label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// nudCompletionIntervalMinutes
//
nudCompletionIntervalMinutes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
nudCompletionIntervalMinutes.Location = new System.Drawing.Point(83, 3);
nudCompletionIntervalMinutes.Name = "nudCompletionIntervalMinutes";
nudCompletionIntervalMinutes.Size = new System.Drawing.Size(44, 27);
nudCompletionIntervalMinutes.TabIndex = 2;
nudCompletionIntervalMinutes.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
//
// label4
//
label4.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom;
label4.AutoSize = true;
label4.Location = new System.Drawing.Point(133, 0);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(22, 33);
label4.TabIndex = 3;
label4.Text = "m";
label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tableLayoutPanel2
//
tableLayoutPanel2.AutoSize = true;
tableLayoutPanel2.ColumnCount = 2;
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
tableLayoutPanel2.Controls.Add(flowLayoutPanel2, 1, 1);
tableLayoutPanel2.Controls.Add(btnReset, 0, 1);
tableLayoutPanel2.Controls.Add(flowLayoutPanel3, 0, 0);
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
tableLayoutPanel2.Location = new System.Drawing.Point(0, 543);
tableLayoutPanel2.Name = "tableLayoutPanel2";
tableLayoutPanel2.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
tableLayoutPanel2.RowCount = 2;
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
tableLayoutPanel2.Size = new System.Drawing.Size(499, 74);
tableLayoutPanel2.TabIndex = 4;
//
// btnReset
//
btnReset.AutoSize = true;
btnReset.Location = new System.Drawing.Point(13, 33);
btnReset.Name = "btnReset";
btnReset.Size = new System.Drawing.Size(130, 30);
btnReset.TabIndex = 3;
btnReset.Text = "Revert to default";
btnReset.UseVisualStyleBackColor = true;
btnReset.Click += btnReset_Click;
//
// flowLayoutPanel3
//
flowLayoutPanel3.AutoSize = true;
flowLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
tableLayoutPanel2.SetColumnSpan(flowLayoutPanel3, 2);
flowLayoutPanel3.Controls.Add(lblEnv);
flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
flowLayoutPanel3.Location = new System.Drawing.Point(10, 5);
flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0, 5, 0, 5);
flowLayoutPanel3.Name = "flowLayoutPanel3";
flowLayoutPanel3.Size = new System.Drawing.Size(479, 20);
flowLayoutPanel3.TabIndex = 4;
//
// lblEnv
//
lblEnv.AutoSize = true;
lblEnv.ForeColor = System.Drawing.SystemColors.GrayText;
lblEnv.Location = new System.Drawing.Point(3, 0);
lblEnv.Name = "lblEnv";
lblEnv.Size = new System.Drawing.Size(131, 20);
lblEnv.TabIndex = 0;
lblEnv.Text = "Environment: %E%";
//
// SettingsForm // SettingsForm
// //
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
@@ -211,9 +323,16 @@
flowLayoutPanel2.ResumeLayout(false); flowLayoutPanel2.ResumeLayout(false);
tableLayoutPanel1.ResumeLayout(false); tableLayoutPanel1.ResumeLayout(false);
tableLayoutPanel1.PerformLayout(); tableLayoutPanel1.PerformLayout();
flowLayoutPanel4.ResumeLayout(false);
flowLayoutPanel4.PerformLayout();
((System.ComponentModel.ISupportInitialize)nudCompletionIntervalHours).EndInit();
((System.ComponentModel.ISupportInitialize)nudCompletionIntervalMinutes).EndInit();
tableLayoutPanel2.ResumeLayout(false); tableLayoutPanel2.ResumeLayout(false);
tableLayoutPanel2.PerformLayout(); tableLayoutPanel2.PerformLayout();
flowLayoutPanel3.ResumeLayout(false);
flowLayoutPanel3.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion
@@ -230,5 +349,13 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Button btnReset; private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.CheckBox cbxPreRelease; private System.Windows.Forms.CheckBox cbxPreRelease;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private System.Windows.Forms.Label lblEnv;
private System.Windows.Forms.Label lblCompletionsRefreshWindow;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4;
private System.Windows.Forms.NumericUpDown nudCompletionIntervalHours;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown nudCompletionIntervalMinutes;
private System.Windows.Forms.Label label4;
} }
} }

View File

@@ -7,6 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using CarManagerV3.Util;
namespace CarManagerV3.Forms namespace CarManagerV3.Forms
{ {
@@ -42,6 +43,11 @@ namespace CarManagerV3.Forms
read: () => Properties.Settings.Default.AllowPrerelease, read: () => Properties.Settings.Default.AllowPrerelease,
write: v => Properties.Settings.Default.AllowPrerelease = v); write: v => Properties.Settings.Default.AllowPrerelease = v);
//TODO: implement refresh settings
lblEnv.Text = lblEnv.Text.Replace("%E%", InstallModeDetector.IsInstalledViaMsi() ? "Installed via MSI" : "Running in portable mode");
} }
private void SettingsForm_Load(object sender, EventArgs e) private void SettingsForm_Load(object sender, EventArgs e)
@@ -57,10 +63,33 @@ namespace CarManagerV3.Forms
private void saveSettings() private void saveSettings()
{ {
bool requiresRestart = false;
foreach (var kvp in settingsMap) foreach (var kvp in settingsMap)
{
kvp.Value.Save(); kvp.Value.Save();
if (kvp.Value.RequiresRestart())
requiresRestart = true;
}
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
if(requiresRestart)
{
DialogResult result = MessageBox.Show(
"Some changes you made require a restart to take effect. Do you want to restart now?",
"Restart Required",
MessageBoxButtons.YesNo,
MessageBoxIcon.Information);
if (result == DialogResult.Yes)
{
Application.Restart();
} else
{
MessageBox.Show("Please restart the application as soon as possible to ensure all changes take effect.", "Restart Recommended", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
} }
private void resetSettings() private void resetSettings()
@@ -103,6 +132,7 @@ namespace CarManagerV3.Forms
void Load(); void Load();
void Save(); void Save();
void Reset(); void Reset();
bool RequiresRestart();
} }
internal sealed class SettingBinding<T> : ISettingBinding internal sealed class SettingBinding<T> : ISettingBinding
@@ -112,14 +142,18 @@ namespace CarManagerV3.Forms
private readonly Func<T> read; private readonly Func<T> read;
private readonly Action<T> write; private readonly Action<T> write;
private readonly Action<T, T>? onChange; private readonly Action<T, T>? onChange;
private readonly bool requiresRestart;
private bool changeRequiresRestart;
public SettingBinding(Control control, T defaultValue, Func<T> read, Action<T> write, Action<T, T>? onChange = null) public SettingBinding(Control control, T defaultValue, Func<T> read, Action<T> write, bool requiresRestart = false, Action<T, T>? onChange = null)
{ {
this.control = control; this.control = control;
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
this.read = read; this.read = read;
this.write = write; this.write = write;
this.onChange = onChange; this.onChange = onChange;
this.requiresRestart = requiresRestart;
this.changeRequiresRestart = false;
} }
public void Load() public void Load()
@@ -137,10 +171,15 @@ namespace CarManagerV3.Forms
if (onChange != null && !EqualityComparer<T>.Default.Equals(before, after)) if (onChange != null && !EqualityComparer<T>.Default.Equals(before, after))
onChange(before, after); onChange(before, after);
if (requiresRestart && !EqualityComparer<T>.Default.Equals(before, after))
changeRequiresRestart = true;
} }
public void Reset() => write(defaultValue); public void Reset() => write(defaultValue);
public bool RequiresRestart() => changeRequiresRestart;
private void ApplyToControl(T value) private void ApplyToControl(T value)
{ {
switch (control) switch (control)

View File

@@ -18,6 +18,10 @@ namespace CarManagerV3.Forms
InitializeComponent(); InitializeComponent();
lblInstalledVersion.Text = lblInstalledVersion.Text.Replace("?.?.?", currentVersion); lblInstalledVersion.Text = lblInstalledVersion.Text.Replace("?.?.?", currentVersion);
lblLatestVersion.Text = lblLatestVersion.Text.Replace("?.?.?", latestVersion); lblLatestVersion.Text = lblLatestVersion.Text.Replace("?.?.?", latestVersion);
if (Updater.IsLatestVersionPrerelease())
{
lblLatestVersion.Text += " (Pre-release)";
}
} }
@@ -28,15 +32,6 @@ namespace CarManagerV3.Forms
private void btnInstallUpdate_Click(object sender, EventArgs e) private void btnInstallUpdate_Click(object sender, EventArgs e)
{ {
/*
var msgbox = new PleaseWait();
msgbox.Show();
Application.DoEvents();
StateManager.UpdateCar(car);
Image fooimg = ImageManager.GetImage(car);
msgbox.Close();
this.Close();
*/
PleaseWait loadForm = new PleaseWait("Downloading the newest version..."); PleaseWait loadForm = new PleaseWait("Downloading the newest version...");
try try
{ {
@@ -58,7 +53,7 @@ namespace CarManagerV3.Forms
private void btnReadChangelog_Click(object sender, EventArgs e) private void btnReadChangelog_Click(object sender, EventArgs e)
{ {
Updater.openReleasePage(); Updater.OpenReleasePage();
} }
} }
} }

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using CarManagerV3.Classes;
using CarManagerV3.Manager;
namespace CarManagerV3 namespace CarManagerV3
@@ -50,13 +52,13 @@ namespace CarManagerV3
{ {
try try
{ {
//string directory = Path.GetDirectoryName(path); string directory = Path.GetDirectoryName(path);
Console.WriteLine($"Initializing file and folders for path: {path}"); Console.WriteLine($"Initializing file and folders for path: {path}");
if (!Directory.Exists(path)) if (!Directory.Exists(directory))
{ {
Directory.CreateDirectory(path); Directory.CreateDirectory(directory);
} }
if(!folderOnly) InitializeFile(path); if (!folderOnly) InitializeFile(path);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -64,6 +66,26 @@ namespace CarManagerV3
} }
} }
/// <summary>
/// Ensures the directory exists.
/// </summary>
/// <param name="path">The path.</param>
public static void EnsureDirectoryExists(string path)
{
try
{
string directory = Path.GetDirectoryName(path);
if (directory != null && !Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
}
catch (Exception ex)
{
Console.Error.WriteLine($"Error ensuring directory exists: {ex.Message}");
}
}
/// <summary> /// <summary>
/// Reads cars from a specified file path. /// Reads cars from a specified file path.
/// </summary> /// </summary>
@@ -75,6 +97,7 @@ namespace CarManagerV3
{ {
List<Car> cars = new List<Car>(); List<Car> cars = new List<Car>();
List<string> failedLines = new List<string>(); List<string> failedLines = new List<string>();
FileMeta meta = null;
bool isLegacy = false; bool isLegacy = false;
try try
{ {
@@ -83,6 +106,27 @@ namespace CarManagerV3
string line; string line;
while ((line = reader.ReadLine()) != null) while ((line = reader.ReadLine()) != null)
{ {
if (FileMeta.IsFileMeta(line))
{
meta = FileMeta.FromCSV(line);
if (meta != null)
{
if (FileMeta.NeedsUpdate(meta))
{
if (!StateManager.askForMigration(meta))
{
MessageBox.Show($"The file you are trying to open is from an older version that is no longer supported. Please select a different file.\nRunning:{Updater.GetCurrentVersion()}, File:{meta.Version}", "Unsupported Version", MessageBoxButtons.OK, MessageBoxIcon.Error);
throw new LegacyException();
//Environment.Exit(0);
}
else
{
isLegacy = true;
}
}
}
continue;
}
// Process the line // Process the line
if (line == "") continue; if (line == "") continue;
if (Car.isLegacyCsvString(line)) if (Car.isLegacyCsvString(line))
@@ -96,8 +140,10 @@ namespace CarManagerV3
else else
{ {
isLegacy = true; isLegacy = true;
line = FileUpdate.PerformOldLegacyUpdate(line);
} }
} }
if (isLegacy && meta != null) line = FileUpdate.ApplyUpdates(line, meta.Version);
Car tmp = Car.FromCsvString(line); Car tmp = Car.FromCsvString(line);
if (tmp == null) if (tmp == null)
{ {
@@ -146,6 +192,8 @@ namespace CarManagerV3
{ {
using (StreamWriter writer = new StreamWriter(@path)) using (StreamWriter writer = new StreamWriter(@path))
{ {
FileMeta meta = FileMeta.Generate();
writer.WriteLine(meta.ToCSV());
foreach (Car car in cars) foreach (Car car in cars)
{ {
writer.WriteLine(car.ToCsvString()); writer.WriteLine(car.ToCsvString());
@@ -265,5 +313,31 @@ namespace CarManagerV3
} }
} }
public static FileMeta GetFileMeta(string path)
{
try
{
using (StreamReader reader = new StreamReader(@path))
{
string line;
while ((line = reader.ReadLine()) != null)
{
if (FileMeta.IsFileMeta(line))
{
reader.Close();
return FileMeta.FromCSV(line);
}
}
reader.Close();
}
}
catch (Exception ex)
{
Console.Error.WriteLine($"Error getting file meta: {ex.Message}");
}
return null;
}
} }
} }

View File

@@ -2,6 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using CarManagerV3.Classes;
using CarManagerV3.Manager;
namespace CarManagerV3 namespace CarManagerV3
{ {
@@ -139,13 +141,19 @@ namespace CarManagerV3
/// This is to prevent multiple annoying popups if the user tries to open multiple files that require migration. /// This is to prevent multiple annoying popups if the user tries to open multiple files that require migration.
/// </summary> /// </summary>
/// <returns>True if the user has accepted to migrate the file, otherwise False</returns> /// <returns>True if the user has accepted to migrate the file, otherwise False</returns>
public static bool askForMigration() public static bool askForMigration(FileMeta meta = null)
{ {
if (hasConfirmedMigration) if (hasConfirmedMigration)
{ {
return true; return true;
} }
DialogResult result = MessageBox.Show("The file you are trying to open is in an older format. Do you want to attempt to migrate it to the new format? If you choose not to migrate, the file will not be opened.", "Migration Needed", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); string promptMessage = "The file you are trying to open is in an older format. Do you want to attempt to migrate it to the new format? If you choose not to migrate, the file will not be opened.";
if(meta != null)
{
int nUpdatesNeeded = FileUpdate.GetRequiredUpdates(meta.Version).Count;
promptMessage = $"The file you are trying to open is in an older format ({meta.Version}). It requires {nUpdatesNeeded} update(s) to be migrated to your Version ({Updater.GetCurrentVersion(true)}).\nDo you want to attempt to migrate it? If you choose not to migrate, the file will not be opened.";
}
DialogResult result = MessageBox.Show(promptMessage, "Migration Needed", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
hasConfirmedMigration = result == DialogResult.Yes; hasConfirmedMigration = result == DialogResult.Yes;
return hasConfirmedMigration; return hasConfirmedMigration;
} }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@@ -22,18 +23,29 @@ namespace CarManagerV3.Manager
private static readonly int CacheDurationMinutes = 60; private static readonly int CacheDurationMinutes = 60;
private static bool cacheIncludesPrerelease = false; private static bool cacheIncludesPrerelease = false;
private static readonly string debugVersion = null;//"1.2.0"; private static readonly string debugVersion = null;//"1.2.0";
private static bool isLatestVersionPrerelease = false;
public static string GetCurrentVersion() public static string GetCurrentVersion(bool cutTrailingZeros = false)
{ {
//DEBUG:: //DEBUG::
if(debugVersion != null) if (debugVersion != null)
{ {
return debugVersion; return debugVersion;
} }
var asm = Assembly.GetEntryAssembly()!; var asm = Assembly.GetEntryAssembly()!;
Version v = asm.GetName().Version ?? new Version(0, 0, 0, 0); Version v = asm.GetName().Version ?? new Version(0, 0, 0, 0);
return v.ToString(); string VersionString = v.ToString();
if(cutTrailingZeros)
{
// Remove trailing .0 parts
while (VersionString.EndsWith(".0"))
{
VersionString = VersionString.Substring(0, VersionString.Length - 2);
}
return VersionString;
}
return VersionString;
} }
private static bool IsCacheValid(bool includePreRelease = false) private static bool IsCacheValid(bool includePreRelease = false)
@@ -72,6 +84,7 @@ namespace CarManagerV3.Manager
var content = response.Content.ReadAsStringAsync().Result; var content = response.Content.ReadAsStringAsync().Result;
dynamic release = Newtonsoft.Json.JsonConvert.DeserializeObject(content); dynamic release = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
latestVersion = release.tag_name; latestVersion = release.tag_name;
isLatestVersionPrerelease = false;
} }
} }
// If pre-release is requested, check for the latest pre-release version // If pre-release is requested, check for the latest pre-release version
@@ -79,21 +92,31 @@ namespace CarManagerV3.Manager
{ {
using (var client = new System.Net.Http.HttpClient()) using (var client = new System.Net.Http.HttpClient())
{ {
UrlEncoder encoder = System.Text.Encodings.Web.UrlEncoder.Default;
var response = client.GetAsync(PreReleaseEndpoint).Result; var response = client.GetAsync(PreReleaseEndpoint).Result;
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
var content = response.Content.ReadAsStringAsync().Result; var content = response.Content.ReadAsStringAsync().Result;
dynamic releases = Newtonsoft.Json.JsonConvert.DeserializeObject(content); dynamic releases = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
//System.Diagnostics.Debug.WriteLine("Fetched pre-release versions, count: " + releases.Count);
if (releases.Count > 0) if (releases.Count > 0)
{ {
var preReleaseVersion = releases[0].tag_name; var preReleaseVersion = releases[0].tag_name.ToString();
//System.Diagnostics.Debug.WriteLine("Latest unstable version: " + preReleaseVersion);
// Compare versions and return the newer one // Compare versions and return the newer one
if (IsNewerVersion(preReleaseVersion, latestVersion)) if (IsNewerVersion(preReleaseVersion, latestVersion))
{ {
latestVersion = preReleaseVersion; latestVersion = preReleaseVersion;
isLatestVersionPrerelease = true;
} }
} }
} }
else
{
System.Diagnostics.Debug.WriteLine("Failed to fetch pre-release versions, status code: " + response.StatusCode + " at: " + PreReleaseEndpoint);
}
} }
} }
SetCache(latestVersion, includePreRelease); SetCache(latestVersion, includePreRelease);
@@ -180,9 +203,9 @@ namespace CarManagerV3.Manager
return IsNewerVersion(latestVersion, currentVersion); return IsNewerVersion(latestVersion, currentVersion);
} }
public static void openReleasePage(string version = null) public static void OpenReleasePage(string version = null)
{ {
if(version == null) if (version == null)
{ {
version = GetLatestVersion(true); version = GetLatestVersion(true);
} }
@@ -193,5 +216,11 @@ namespace CarManagerV3.Manager
UseShellExecute = true UseShellExecute = true
}); });
} }
public static bool IsLatestVersionPrerelease()
{
// Ensure we have the latest version info in cache
return isLatestVersionPrerelease;
}
} }
} }

View File

@@ -118,6 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="CarCompleteData" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\merged-cars.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Icon_Add" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Icon_Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Icon_Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Icon_Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>

View File

@@ -46,5 +46,29 @@ namespace CarManagerV3.Properties {
this["AllowPrerelease"] = value; this["AllowPrerelease"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("2026-01-01")]
public global::System.DateTime LastFetchedAutoCompletions {
get {
return ((global::System.DateTime)(this["LastFetchedAutoCompletions"]));
}
set {
this["LastFetchedAutoCompletions"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("24.00:00:00")]
public global::System.TimeSpan FetchAutoCompletionsInterval {
get {
return ((global::System.TimeSpan)(this["FetchAutoCompletionsInterval"]));
}
set {
this["FetchAutoCompletionsInterval"] = value;
}
}
} }
} }

View File

@@ -8,5 +8,11 @@
<Setting Name="AllowPrerelease" Type="System.Boolean" Scope="User"> <Setting Name="AllowPrerelease" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="LastFetchedAutoCompletions" Type="System.DateTime" Scope="User">
<Value Profile="(Default)">2026-01-01</Value>
</Setting>
<Setting Name="FetchAutoCompletionsInterval" Type="System.TimeSpan" Scope="User">
<Value Profile="(Default)">24.00:00:00</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,261 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CarManagerV3.Classes;
namespace CarManagerV3.Util
{
/// <summary>
/// Provides car manufacturer and model autocompletion data for the application.
/// Manages fetching, caching, and retrieval of car brand and model information from remote sources and local storage.
/// </summary>
/// <remarks>
/// This class maintains a static list of car manufacturers and their models, supports fetching updated data from remote URLs,
/// and caches the data locally for offline use. It implements retry logic to prevent excessive network requests.
/// </remarks>
internal class CarCompletions
{
/// <summary>
/// A list of URLs that should be used to fetch the json file with autocompletion data.
/// Multiple URLs are provided to ensure that if one source is unavailable, the others can be used as a fallback. The application should attempt to fetch the data from each URL in order until it successfully retrieves the data or exhausts all options.
/// </summary>
private static readonly string[] carDataFileUrls =
{
"https://static.clsw.app/carmgm/merged-cars.json"
};
/// <summary>
/// The filename for the cached car completion data in the user's data directory.
/// </summary>
private static readonly string carCompletionDataFileName = "car_data.json";
/// <summary>
/// The timestamp of the last fetch attempt for car completion data.
/// Used to implement retry throttling to prevent excessive network requests.
/// </summary>
private static DateTime lastFetchAttempt = Properties.Settings.Default.LastFetchedAutoCompletions;
/// <summary>
/// The minimum time interval that must elapse between fetch attempts.
/// Prevents excessive retry attempts when the remote source is unavailable.
/// </summary>
private static readonly TimeSpan fetchRetryInterval = Properties.Settings.Default.FetchAutoCompletionsInterval; // Minimum interval between fetch attempts
/// <summary>
/// Gets the full file path for the car completion data file.
/// Ensures that the user data directory exists before returning the path.
/// </summary>
/// <returns>The full file path to the car completion data file in the user's data directory.</returns>
private static string getCarCompletionDataFilePath()
{
var userDataDir = Properties.Settings.Default.DataLocation;
SafeManager.EnsureDirectoryExists(userDataDir);
return Path.Combine(userDataDir, carCompletionDataFileName);
}
/// <summary>
/// The static list of car manufacturers and their available models.
/// This list serves as the default data and is updated when fetching from remote sources or local cache.
/// </summary>
public static List<CarManufacturer> carBrands = new List<CarManufacturer>
{
new CarManufacturer("Toyota") { Models = new List<string> { "Camry", "Corolla", "RAV4" } },
new CarManufacturer("Honda") { Models = new List<string> { "Civic", "Accord", "CR-V" } },
new CarManufacturer("Ford") { Models = new List<string> { "F-150", "Mustang", "Escape" } },
new CarManufacturer("Chevrolet") { Models = new List<string> { "Silverado", "Malibu", "Equinox" } },
new CarManufacturer("BMW") { Models = new List<string> { "3 Series", "5 Series", "X5" } },
new CarManufacturer("Mercedes-Benz") { Models = new List<string> { "C-Class", "E-Class", "GLC" } },
new CarManufacturer("Audi") { Models = new List<string> { "A4", "A6", "Q5" } },
new CarManufacturer("Volkswagen") { Models = new List<string> { "Golf", "Passat", "Tiguan" } },
new CarManufacturer("Nissan") { Models = new List<string> { "Altima", "Sentra", "Rogue" } },
new CarManufacturer("Hyundai") { Models = new List<string> { "Elantra", "Sonata", "Tucson" } },
new CarManufacturer("SEAT") { Models = new List<string> { "Ibiza", "Leon", "Ateca", "Alhambra" } },
new CarManufacturer("Skoda") { Models = new List<string> { "Octavia", "Fabia", "Kodiaq" } },
};
/// <summary>
/// Gets the full list of car brands.
/// </summary>
/// <returns>A list of strings containing all available car manufacturer names.</returns>
public static List<string> GetCarBrands()
{
return carBrands.Select(c => c.Name).ToList();
}
/// <summary>
/// Retrieves the list of car models for a specified brand.
/// The search is case-insensitive.
/// </summary>
/// <param name="brand">The name of the car brand to search for.</param>
/// <returns>A list of car models for the specified brand, or an empty list if the brand is not found.</returns>
public static List<string> GetCarModels(string brand)
{
var manufacturer = carBrands.FirstOrDefault(c => c.Name.Equals(brand, StringComparison.OrdinalIgnoreCase));
return manufacturer != null ? manufacturer.Models : new List<string>();
}
/// <summary>
/// A predefined list of common car colors for autocompletion purposes.
/// Provides standard color options that are frequently used in vehicle descriptions.
/// </summary>
public static List<string> CommonColors = new List<string>
{
"Black", "White", "Gray", "Silver", "Red", "Blue", "Green", "Yellow", "Brown", "Orange"
};
/// <summary>
/// Reads car completion data from an embedded resource file.
/// This method is intended to populate the carBrands list from a JSON resource embedded in the project.
/// </summary>
/// <remarks>
/// The expected resource format is a JSON object where keys are car brand names and values are lists of model names.
/// Resource name: CarCompleteData (JSON file format).
/// Currently not implemented.
/// </remarks>
public static void ReadFromResourceFile()
{
// Read the json file from the projects resources and populate the carBrands list
// Format is a json object with the key being the car brand and the value being a list of models
// Get the json string from the resources, Resource name is CarCompleteData, it is a .json file
}
/// <summary>
/// Fetches the car data from urls asynchronous and saves it in the users data directory for offline use.
/// </summary>
/// <returns>A task representing the asynchronous operation.</returns>
/// <remarks>
/// This method implements retry throttling using the <see cref="fetchRetryInterval"/> to prevent excessive network requests.
/// It attempts to fetch data from each URL in <see cref="carDataFileUrls"/> in order until successful or all URLs are exhausted.
/// The fetched data is saved to the local file system for offline access.
/// </remarks>
public static async Task FetchCarCompletionDataFromUrlsAsync()
{
if(DateTime.Now - lastFetchAttempt < fetchRetryInterval)
{
System.Diagnostics.Debug.WriteLine("Fetch attempt skipped to avoid excessive retries. Last attempt was at " + lastFetchAttempt);
Console.WriteLine("Fetch attempt skipped to avoid excessive retries. Last attempt was at " + lastFetchAttempt);
return;
}
foreach (var url in carDataFileUrls)
{
try
{
lastFetchAttempt = DateTime.Now;
Properties.Settings.Default.LastFetchedAutoCompletions = lastFetchAttempt;
Properties.Settings.Default.Save();
using var httpClient = new HttpClient();
var response = await httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
var jsonData = await response.Content.ReadAsStringAsync();
// Saves the json data to a file in the user's data directory for offline use
var filePath = getCarCompletionDataFilePath();
await File.WriteAllTextAsync(filePath, jsonData);
System.Diagnostics.Debug.WriteLine($"Successfully fetched car data from {url} and saved to {filePath}");
break; // Exit the loop if data is successfully fetched
}
catch (Exception ex)
{
// Log the error and try the next URL
System.Diagnostics.Debug.WriteLine($"Failed to fetch car data from {url}: {ex.Message}");
Console.WriteLine($"Failed to fetch car data from {url}: {ex.Message}");
}
}
}
/// <summary>
/// Fetches the car data from urls and saves it in the users data directory for offline use.
/// This is a synchronous wrapper that blocks until the asynchronous fetch operation completes.
/// </summary>
/// <returns>A task representing the synchronous operation.</returns>
/// <remarks>
/// This method wraps <see cref="FetchCarCompletionDataFromUrlsAsync"/> and runs it synchronously.
/// Consider using the async version directly when possible to avoid blocking the thread.
/// </remarks>
public static Task FetchCarCompletionDataFromUrls()
{
// Run synchronously
return Task.Run(() => FetchCarCompletionDataFromUrlsAsync().Wait());
}
/// <summary>
/// Loads car manufacturer data from the locally cached file.
/// Optionally fetches updated data from remote sources before loading from file.
/// </summary>
/// <param name="skipOnlineUpdate">If true, skips fetching data from remote sources and only reads from the local cache. Default is false.</param>
/// <returns>A list of <see cref="CarManufacturer"/> objects populated from the cached file, or an empty list if the file doesn't exist or an error occurs.</returns>
/// <remarks>
/// The expected file format is a JSON object where keys are car brand names and values are lists of model names.
/// If the file doesn't exist or cannot be read, an error message is logged and an empty list is returned.
/// </remarks>
public static List<CarManufacturer> GetFromFile(bool skipOnlineUpdate = false)
{
if (!skipOnlineUpdate) FetchCarCompletionDataFromUrls();
var filePath = getCarCompletionDataFilePath();
if (File.Exists(filePath))
{
try
{
var jsonData = File.ReadAllText(filePath);
// Parse the json data and populate the carBrands list
// Format is a json object with the key being the car brand and the value being a list of models
var carData = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(jsonData);
List<CarManufacturer> _carBrands = carData.Select(kvp => new CarManufacturer(kvp.Key) { Models = kvp.Value }).ToList();
return _carBrands;
}
catch (Exception ex)
{
// Silent error.
Console.WriteLine($"Failed to read car data from file: {ex.Message}");
}
}
else
{
Console.Error.WriteLine("Car data file not found. Please ensure that the data has been fetched successfully at least once.");
}
return new List<CarManufacturer>();
}
/// <summary>
/// Updates the static <see cref="carBrands"/> list with data from the local cache file.
/// Only updates the list if the cached file contains valid data.
/// </summary>
/// <param name="skipOnlineUpdate">If true, skips fetching data from remote sources before updating. Default is false.</param>
/// <remarks>
/// This method calls <see cref="GetFromFile"/> and updates <see cref="carBrands"/> only if the returned list is not empty.
/// If no data is retrieved, the existing <see cref="carBrands"/> list remains unchanged.
/// </remarks>
public static void UpdateCarCompletionData(bool skipOnlineUpdate = false)
{
var updatedCarBrands = GetFromFile(skipOnlineUpdate);
if (updatedCarBrands.Count > 0)
{
carBrands = updatedCarBrands;
}
}
/// <summary>
/// Asynchronously updates the car completion data by fetching from remote sources and updating the local cache.
/// This is the recommended method for refreshing car data in the application.
/// </summary>
/// <returns>A task representing the asynchronous update operation.</returns>
/// <remarks>
/// This method first attempts to fetch updated data from remote URLs using <see cref="FetchCarCompletionDataFromUrlsAsync"/>,
/// then updates the static <see cref="carBrands"/> list from the local cache using <see cref="UpdateCarCompletionData"/>.
/// </remarks>
public static async Task UpdateCarCompletionDataAsync()
{
await FetchCarCompletionDataFromUrlsAsync();
System.Diagnostics.Debug.WriteLine("Car completion data fetch attempt completed. Now updating local data.");
UpdateCarCompletionData(true);
}
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;
namespace CarManagerV3.Util
{
public static class InstallModeDetector
{
private const string _keyPath = @"Software\Jaro Digital\CarManager3";
private const string KeyPath = _keyPath;
private const string ValueName = "InstallType";
public static bool IsInstalledViaMsi()
{
// Prefer HKLM if your MSI is per-machine; fallback to HKCU if per-user.
System.Diagnostics.Debug.WriteLine($"Checking registry for install type at HKLM\\{KeyPath} and HKCU\\{KeyPath}");
object? val =
Registry.GetValue($@"HKEY_LOCAL_MACHINE\{KeyPath}", ValueName, null)
?? Registry.GetValue($@"HKEY_CURRENT_USER\{KeyPath}", ValueName, null);
return val is string s && string.Equals(s, "MSI", StringComparison.OrdinalIgnoreCase);
}
public static bool IsPortable() => !IsInstalledViaMsi();
public static string GetInstallType()
{
object? val =
Registry.GetValue($@"HKEY_LOCAL_MACHINE\{KeyPath}", ValueName, null)
?? Registry.GetValue($@"HKEY_CURRENT_USER\{KeyPath}", ValueName, null);
return val as string ?? "Unknown";
}
}
}