mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-06-23 23:00:23 -07:00
Compare commits
6 Commits
5ad295f705
...
086e82ec13
Author | SHA1 | Date | |
---|---|---|---|
|
086e82ec13 | ||
|
f0eb2eb745 | ||
|
338ebba191 | ||
|
9ef6579a41 | ||
|
bfcd493a96 | ||
|
7afffd8172 |
2
.github/workflows/ci-debug.yml
vendored
2
.github/workflows/ci-debug.yml
vendored
@ -27,4 +27,4 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Bloxstrap (Debug) (${{ github.sha }})
|
||||
path: .\Bloxstrap\bin\Debug\net6.0-windows\win-x64\publish\*
|
||||
path: .\Bloxstrap\bin\Debug\net6.0-windows10.0.17763.0\win-x64\publish\*
|
2
.github/workflows/ci-release.yml
vendored
2
.github/workflows/ci-release.yml
vendored
@ -31,7 +31,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Bloxstrap (Release) (${{ github.sha }})
|
||||
path: .\Bloxstrap\bin\Release\net6.0-windows\win-x64\publish\*
|
||||
path: .\Bloxstrap\bin\Release\net6.0-windows10.0.17763.0\win-x64\publish\*
|
||||
|
||||
release:
|
||||
needs: build
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>True</UseWindowsForms>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<BloxstrapCustomBootstrapper Version="1" Height="320" Width="500">
|
||||
<!-- Put UI elements here -->
|
||||
<!-- Examples of custom bootstrappers can be found at https://github.com/bloxstraplabs/custom-bootstrapper-examples -->
|
||||
<!-- {0} -->
|
||||
<!-- {1} -->
|
||||
</BloxstrapCustomBootstrapper>
|
@ -1,5 +1,5 @@
|
||||
<BloxstrapCustomBootstrapper Version="1" Height="320" Width="520" IgnoreTitleBarInset="True" Theme="Default" Margin="30">
|
||||
<!-- Find more custom bootstrapper examples at https://github.com/bloxstraplabs/custom-bootstrapper-examples -->
|
||||
<!-- {0} -->
|
||||
<TitleBar Title="" ShowMinimize="False" ShowClose="False" />
|
||||
|
||||
<Image Source="{Icon}" Height="100" Width="100" HorizontalAlignment="Center" Margin="0,15,0,0" />
|
||||
|
38
Bloxstrap/Resources/Strings.Designer.cs
generated
38
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -973,6 +973,15 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Custom Theme {0}.
|
||||
/// </summary>
|
||||
public static string CustomTheme_DefaultName {
|
||||
get {
|
||||
return ResourceManager.GetString("CustomTheme.DefaultName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Save changes to {0}?.
|
||||
/// </summary>
|
||||
@ -1082,7 +1091,7 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0}.{1} is missing it's child.
|
||||
/// Looks up a localized string similar to {0}.{1} is missing its child.
|
||||
/// </summary>
|
||||
public static string CustomTheme_Errors_ElementAttributeMissingChild {
|
||||
get {
|
||||
@ -1271,6 +1280,33 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Examples of custom bootstrappers can be found at {0}.
|
||||
/// </summary>
|
||||
public static string CustomTheme_Templates_Blank_MoreExamples {
|
||||
get {
|
||||
return ResourceManager.GetString("CustomTheme.Templates.Blank.MoreExamples", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Put UI elements here.
|
||||
/// </summary>
|
||||
public static string CustomTheme_Templates_Blank_UIElements {
|
||||
get {
|
||||
return ResourceManager.GetString("CustomTheme.Templates.Blank.UIElements", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Find more custom bootstrapper examples at {0}.
|
||||
/// </summary>
|
||||
public static string CustomTheme_Templates_Simple_MoreExamples {
|
||||
get {
|
||||
return ResourceManager.GetString("CustomTheme.Templates.Simple.MoreExamples", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add Fast Flag.
|
||||
/// </summary>
|
||||
|
@ -1369,7 +1369,7 @@ Please close any applications that may be using Roblox's files, and relaunch.</v
|
||||
<comment>{0} is the element name (e.g. Button)</comment>
|
||||
</data>
|
||||
<data name="CustomTheme.Errors.ElementAttributeMissingChild" xml:space="preserve">
|
||||
<value>{0}.{1} is missing it's child</value>
|
||||
<value>{0}.{1} is missing its child</value>
|
||||
<comment>{0}.{1} is the element & attribute name (e.g. Button.Text)</comment>
|
||||
</data>
|
||||
<data name="CustomTheme.Errors.ElementAttributeParseError" xml:space="preserve">
|
||||
@ -1474,4 +1474,17 @@ Defaulting to {1}.</value>
|
||||
<data name="Menu.Behaviour.BackgroundUpdates.Description" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
</data>
|
||||
<data name="CustomTheme.Templates.Blank.UIElements" xml:space="preserve">
|
||||
<value>Put UI elements here</value>
|
||||
</data>
|
||||
<data name="CustomTheme.Templates.Blank.MoreExamples" xml:space="preserve">
|
||||
<value>Examples of custom bootstrappers can be found at {0}</value>
|
||||
</data>
|
||||
<data name="CustomTheme.Templates.Simple.MoreExamples" xml:space="preserve">
|
||||
<value>Find more custom bootstrapper examples at {0}</value>
|
||||
</data>
|
||||
<data name="CustomTheme.DefaultName" xml:space="preserve">
|
||||
<value>Custom Theme {0}</value>
|
||||
<comment>{0} is a string (e.g. '1', '1-1234')</comment>
|
||||
</data>
|
||||
</root>
|
@ -39,11 +39,12 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
||||
{
|
||||
int count = Directory.GetDirectories(Paths.CustomThemes).Count();
|
||||
|
||||
string name = $"Custom Theme {count + 1}";
|
||||
int i = count + 1;
|
||||
string name = string.Format(Strings.CustomTheme_DefaultName, i);
|
||||
|
||||
// TODO: this sucks
|
||||
if (File.Exists(GetThemePath(name)))
|
||||
name += " " + Random.Shared.Next(1, 100000).ToString(); // easy
|
||||
name = string.Format(Strings.CustomTheme_DefaultName, $"{i}-{Random.Shared.Next(1, 100000)}"); // easy
|
||||
|
||||
return name;
|
||||
}
|
||||
@ -76,7 +77,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);
|
||||
}
|
||||
|
@ -194,11 +194,47 @@ namespace Bloxstrap.UI.ViewModels.Settings
|
||||
|
||||
private void RenameCustomTheme()
|
||||
{
|
||||
if (SelectedCustomTheme is null)
|
||||
const string LOG_IDENT = "AppearanceViewModel::RenameCustomTheme";
|
||||
|
||||
if (SelectedCustomTheme is null || SelectedCustomTheme == SelectedCustomThemeName)
|
||||
return;
|
||||
|
||||
if (SelectedCustomTheme == SelectedCustomThemeName)
|
||||
if (string.IsNullOrEmpty(SelectedCustomThemeName))
|
||||
{
|
||||
Frontend.ShowMessageBox(Strings.CustomTheme_Add_Errors_NameEmpty, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var validationResult = PathValidator.IsFileNameValid(SelectedCustomThemeName);
|
||||
|
||||
if (validationResult != PathValidator.ValidationResult.Ok)
|
||||
{
|
||||
switch (validationResult)
|
||||
{
|
||||
case PathValidator.ValidationResult.IllegalCharacter:
|
||||
Frontend.ShowMessageBox(Strings.CustomTheme_Add_Errors_NameIllegalCharacters, MessageBoxImage.Error);
|
||||
break;
|
||||
case PathValidator.ValidationResult.ReservedFileName:
|
||||
Frontend.ShowMessageBox(Strings.CustomTheme_Add_Errors_NameReserved, MessageBoxImage.Error);
|
||||
break;
|
||||
default:
|
||||
App.Logger.WriteLine(LOG_IDENT, $"Got unhandled PathValidator::ValidationResult {validationResult}");
|
||||
Debug.Assert(false);
|
||||
|
||||
Frontend.ShowMessageBox(Strings.CustomTheme_Add_Errors_Unknown, MessageBoxImage.Error);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// better to check for the file instead of the directory so broken themes can be overwritten
|
||||
string path = Path.Combine(Paths.CustomThemes, SelectedCustomThemeName, "Theme.xml");
|
||||
if (File.Exists(path))
|
||||
{
|
||||
Frontend.ShowMessageBox(Strings.CustomTheme_Add_Errors_NameTaken, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@ -206,7 +242,7 @@ namespace Bloxstrap.UI.ViewModels.Settings
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.Logger.WriteException("AppearanceViewModel::RenameCustomTheme", ex);
|
||||
App.Logger.WriteException(LOG_IDENT, ex);
|
||||
Frontend.ShowMessageBox(string.Format(Strings.Menu_Appearance_CustomThemes_RenameFailed, SelectedCustomTheme, ex.Message), MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user