feat: settings, installer banner
This commit is contained in:
@@ -12,7 +12,7 @@ namespace CarManagerV3
|
||||
internal class ImageManager
|
||||
{
|
||||
|
||||
private static string _imagePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\CarManagerV3\\images";
|
||||
private static string _imagePath = Properties.Settings.Default.DataLocation + "\\images";
|
||||
private static NetworkCredential myNetCred = null;
|
||||
private static bool disableImageFetch = false;
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace CarManagerV3
|
||||
/// </summary>
|
||||
public static void InitializeImageFolder()
|
||||
{
|
||||
_imagePath = Properties.Settings.Default.DataLocation + "\\images";
|
||||
string path = _imagePath;
|
||||
|
||||
if (!System.IO.Directory.Exists(path))
|
||||
@@ -39,6 +40,7 @@ namespace CarManagerV3
|
||||
/// <returns>The image path for this Car.</returns>
|
||||
public static string GetImagePath(Car car)
|
||||
{
|
||||
_imagePath = Properties.Settings.Default.DataLocation + "\\images";
|
||||
string basePath = $"{_imagePath}/";
|
||||
string fileName = $"{car.Make}_{car.Model}_{car.Year}_{car.Color}.png";
|
||||
return basePath + fileName;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace CarManagerV3
|
||||
/// <summary>
|
||||
/// The path of the txt file that contains recently opened file paths.
|
||||
/// </summary>
|
||||
private static readonly string recentPathsFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\CarManagerV3\\recent_paths.txt";
|
||||
private static string recentPathsFile = Properties.Settings.Default.DataLocation + "\\recent_paths.txt";
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -46,16 +46,17 @@ namespace CarManagerV3
|
||||
/// Initializes a file and its parent folders at a specified path if they do not already exist.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the file.</param>
|
||||
public static void initializeFileAndFolders(string path)
|
||||
public static void initializeFileAndFolders(string path, bool folderOnly = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
string directory = Path.GetDirectoryName(path);
|
||||
if (!Directory.Exists(directory))
|
||||
//string directory = Path.GetDirectoryName(path);
|
||||
Console.WriteLine($"Initializing file and folders for path: {path}");
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
InitializeFile(path);
|
||||
if(!folderOnly) InitializeFile(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -204,6 +205,7 @@ namespace CarManagerV3
|
||||
List<string> paths = new List<string>();
|
||||
try
|
||||
{
|
||||
recentPathsFile = Properties.Settings.Default.DataLocation + "\\recent_paths.txt";
|
||||
initializeFileAndFolders(recentPathsFile);
|
||||
if (File.Exists(recentPathsFile)) //TODO: Remove
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user