Localize name of icons folder

This commit is contained in:
pizzaboxer 2024-10-10 23:56:34 +01:00
parent d9c9a4cc28
commit 5c117423d0
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
5 changed files with 20 additions and 9 deletions

View File

@ -285,7 +285,6 @@ namespace Bloxstrap
() => Directory.Delete(Paths.Downloads, true), () => Directory.Delete(Paths.Downloads, true),
() => Directory.Delete(Paths.Roblox, true), () => Directory.Delete(Paths.Roblox, true),
() => Directory.Delete(Paths.Icons, true),
() => File.Delete(App.State.FileLocation) () => File.Delete(App.State.FileLocation)
}; };

View File

@ -1,27 +1,28 @@
using System.Reflection; using System.Reflection;
using System.Windows.Markup;
namespace Bloxstrap.Models.SettingTasks namespace Bloxstrap.Models.SettingTasks
{ {
public class ExtractIconsTask : BoolBaseTask public class ExtractIconsTask : BoolBaseTask
{ {
private string _path => Path.Combine(Paths.Base, Strings.Paths_Icons);
public ExtractIconsTask() : base("ExtractIcons") public ExtractIconsTask() : base("ExtractIcons")
{ {
OriginalState = Directory.Exists(Paths.Icons); OriginalState = Directory.Exists(_path);
} }
public override void Execute() public override void Execute()
{ {
if (NewState) if (NewState)
{ {
Directory.CreateDirectory(Paths.Icons); Directory.CreateDirectory(_path);
var assembly = Assembly.GetExecutingAssembly(); var assembly = Assembly.GetExecutingAssembly();
var resourceNames = assembly.GetManifestResourceNames().Where(x => x.EndsWith(".ico")); var resourceNames = assembly.GetManifestResourceNames().Where(x => x.EndsWith(".ico"));
foreach (string name in resourceNames) foreach (string name in resourceNames)
{ {
string path = Path.Combine(Paths.Icons, name.Replace("Bloxstrap.Resources.", "")); string path = Path.Combine(_path, name.Replace("Bloxstrap.Resources.", ""));
var stream = assembly.GetManifestResourceStream(name)!; var stream = assembly.GetManifestResourceStream(name)!;
using var memoryStream = new MemoryStream(); using var memoryStream = new MemoryStream();
@ -31,9 +32,9 @@ namespace Bloxstrap.Models.SettingTasks
File.WriteAllBytes(path, memoryStream.ToArray()); File.WriteAllBytes(path, memoryStream.ToArray());
} }
} }
else if (Directory.Exists(Paths.Icons)) else if (Directory.Exists(_path))
{ {
Directory.Delete(Paths.Icons, true); Directory.Delete(_path, true);
} }
OriginalState = NewState; OriginalState = NewState;

View File

@ -22,7 +22,6 @@
public static string Integrations { get; private set; } = ""; public static string Integrations { get; private set; } = "";
public static string Modifications { get; private set; } = ""; public static string Modifications { get; private set; } = "";
public static string Roblox { get; private set; } = ""; public static string Roblox { get; private set; } = "";
public static string Icons { get; private set; } = "";
public static string Application { get; private set; } = ""; public static string Application { get; private set; } = "";
@ -38,7 +37,6 @@
Integrations = Path.Combine(Base, "Integrations"); Integrations = Path.Combine(Base, "Integrations");
Modifications = Path.Combine(Base, "Modifications"); Modifications = Path.Combine(Base, "Modifications");
Roblox = Path.Combine(Base, "Roblox"); Roblox = Path.Combine(Base, "Roblox");
Icons = Path.Combine(Base, "Icons");
Application = Path.Combine(Base, $"{App.ProjectName}.exe"); Application = Path.Combine(Base, $"{App.ProjectName}.exe");
} }

View File

@ -3189,6 +3189,15 @@ namespace Bloxstrap.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Icons.
/// </summary>
public static string Paths_Icons {
get {
return ResourceManager.GetString("Paths.Icons", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to They&apos;ll be kept where Bloxstrap was installed, and will automatically be restored on a reinstall.. /// Looks up a localized string similar to They&apos;ll be kept where Bloxstrap was installed, and will automatically be restored on a reinstall..
/// </summary> /// </summary>

View File

@ -1230,4 +1230,8 @@ Would you like to enable test mode?</value>
<value>Support us on Ko-fi!</value> <value>Support us on Ko-fi!</value>
<comment>Call-to-action button</comment> <comment>Call-to-action button</comment>
</data> </data>
<data name="Paths.Icons" xml:space="preserve">
<value>Icons</value>
<comment>Name of the folder that gets created according to the "create shortcut icons" option. Ensure that it is a valid folder name.</comment>
</data>
</root> </root>