diff --git a/Assets/vinyl.png b/Assets/vinyl.png new file mode 100644 index 0000000..4e05b48 Binary files /dev/null and b/Assets/vinyl.png differ diff --git a/Tools/Cli.cs b/Tools/Cli.cs index d323e2b..1f56141 100644 --- a/Tools/Cli.cs +++ b/Tools/Cli.cs @@ -154,7 +154,8 @@ public class Cli { Name = username!, NormalizedName = username!.ToLower(), - Password = password + Password = password, + Role = isUserAdmin ? 0 : 1 // 0 = admin }; db.Users.Add(newUser); @@ -218,9 +219,9 @@ public class Cli Console.WriteLine($"[Shadow] Remove user"); if (args.Length == 2) - Console.WriteLine($" You will be promped to enter the password."); + Console.WriteLine($" You will be prompted to enter the password."); else - Console.WriteLine($" You will be promped to enter the username and password."); + Console.WriteLine($" You will be prompted to enter the username and password."); string? username = null; if (args.Length != 2) @@ -339,6 +340,28 @@ public class Cli System.IO.Directory.CreateDirectory(newMusicLibraryPath); System.IO.Directory.CreateDirectory(newMusicThumbnailPath); + // Try to find the Assets directory automatically + string currentPath = AppContext.BaseDirectory; + for (int i = 0; i < 5; i++) + { + if (Directory.GetFiles(currentPath, "Shadow.slnx") + .FirstOrDefault() != null) + { + File.Copy( + Path.Combine(currentPath, "Assets", "vinyl.png"), + Path.Combine(newMusicThumbnailPath, "default.png") + ); + break; + } + + currentPath = Path.Combine(currentPath, ".."); + + if (i == 5) Console.WriteLine("\n" + + "Error: Could not determine content root path. \n" + + "Please place Assets/vinyl.png in your thumbnail path directory manually\n" + + "and rename it to default.png."); + } + // UpdateRange can both Add and Update rows. db.Globals.UpdateRange(musicLibraryPath, musicThumbnailPath); db.SaveChanges();