diff --git a/Bloxstrap/Extensions/CustomThemeTemplateEx.cs b/Bloxstrap/Extensions/CustomThemeTemplateEx.cs index 4088f02..ed9dcea 100644 --- a/Bloxstrap/Extensions/CustomThemeTemplateEx.cs +++ b/Bloxstrap/Extensions/CustomThemeTemplateEx.cs @@ -1,10 +1,36 @@ -namespace Bloxstrap.Extensions +using System.Text; + +namespace Bloxstrap.Extensions { static class CustomThemeTemplateEx { + const string EXAMPLES_URL = "https://github.com/bloxstraplabs/custom-bootstrapper-examples"; + public static string GetFileName(this CustomThemeTemplate template) { return $"CustomBootstrapperTemplate_{template}.xml"; } + + public static string GetFileContents(this CustomThemeTemplate template) + { + string contents = Encoding.UTF8.GetString(Resource.Get(template.GetFileName()).Result); + + switch (template) + { + case CustomThemeTemplate.Blank: + { + string moreText = string.Format(Strings.CustomTheme_Templates_Blank_MoreExamples, EXAMPLES_URL); + return string.Format(contents, Strings.CustomTheme_Templates_Blank_UIElements, moreText); + } + case CustomThemeTemplate.Simple: + { + string moreText = string.Format(Strings.CustomTheme_Templates_Simple_MoreExamples, EXAMPLES_URL); + return string.Format(contents, moreText); + } + default: + Debug.Assert(false); + return contents; + } + } } } diff --git a/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml b/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml index 99efce9..3945086 100644 --- a/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml +++ b/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml @@ -1,4 +1,4 @@  - - + + \ No newline at end of file diff --git a/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml b/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml index 7664806..abe586d 100644 --- a/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml +++ b/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml @@ -1,5 +1,5 @@  - + diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index 5395778..e3cc12c 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -1271,6 +1271,33 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Examples of custom bootstrappers can be found at {0}. + /// + public static string CustomTheme_Templates_Blank_MoreExamples { + get { + return ResourceManager.GetString("CustomTheme.Templates.Blank.MoreExamples", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Put UI elements here. + /// + public static string CustomTheme_Templates_Blank_UIElements { + get { + return ResourceManager.GetString("CustomTheme.Templates.Blank.UIElements", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Find more custom bootstrapper examples at {0}. + /// + public static string CustomTheme_Templates_Simple_MoreExamples { + get { + return ResourceManager.GetString("CustomTheme.Templates.Simple.MoreExamples", resourceCulture); + } + } + /// /// Looks up a localized string similar to Add Fast Flag. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index 7c42f6a..db2bd75 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -1474,4 +1474,13 @@ Defaulting to {1}. Update Roblox in the background instead of waiting. Not recommended for slow networks. At least 3GB of free storage space is required for this feature to work. + + Put UI elements here + + + Examples of custom bootstrappers can be found at {0} + + + Find more custom bootstrapper examples at {0} + \ No newline at end of file diff --git a/Bloxstrap/UI/Elements/Dialogs/AddCustomThemeDialog.xaml.cs b/Bloxstrap/UI/Elements/Dialogs/AddCustomThemeDialog.xaml.cs index 94ce4a8..d9f9bc4 100644 --- a/Bloxstrap/UI/Elements/Dialogs/AddCustomThemeDialog.xaml.cs +++ b/Bloxstrap/UI/Elements/Dialogs/AddCustomThemeDialog.xaml.cs @@ -76,7 +76,7 @@ namespace Bloxstrap.UI.Elements.Dialogs string themeFilePath = Path.Combine(dir, "Theme.xml"); - string templateContent = Encoding.UTF8.GetString(Resource.Get(template.GetFileName()).Result); + string templateContent = template.GetFileContents(); File.WriteAllText(themeFilePath, templateContent); }