mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-04-09 18:01:37 +00:00
Fixed issues (#723)
Some checks are pending
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,deb,updater, appimage,deb) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,deb,updater, appimage,deb) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Some checks are pending
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,deb,updater, appimage,deb) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,deb,updater, appimage,deb) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
This commit is contained in:
parent
f6a128f2e4
commit
3cef689c83
@ -24,7 +24,7 @@ else
|
|||||||
case TreeItemData treeItem:
|
case TreeItemData treeItem:
|
||||||
@if (treeItem.Type is TreeItemType.LOADING)
|
@if (treeItem.Type is TreeItemType.LOADING)
|
||||||
{
|
{
|
||||||
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@false" Items="@treeItem.Children!">
|
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@false" Items="@(treeItem.Children!)">
|
||||||
<BodyContent>
|
<BodyContent>
|
||||||
<MudSkeleton Width="85%" Height="22px"/>
|
<MudSkeleton Width="85%" Height="22px"/>
|
||||||
</BodyContent>
|
</BodyContent>
|
||||||
@ -32,7 +32,7 @@ else
|
|||||||
}
|
}
|
||||||
else if (treeItem.Type is TreeItemType.CHAT)
|
else if (treeItem.Type is TreeItemType.CHAT)
|
||||||
{
|
{
|
||||||
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@treeItem.Children!" OnClick="@(() => this.LoadChatAsync(treeItem.Path, true))">
|
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@(treeItem.Children!)" OnClick="@(() => this.LoadChatAsync(treeItem.Path, true))">
|
||||||
<BodyContent>
|
<BodyContent>
|
||||||
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
|
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
|
||||||
<MudText Style="justify-self: start;">
|
<MudText Style="justify-self: start;">
|
||||||
@ -65,7 +65,7 @@ else
|
|||||||
}
|
}
|
||||||
else if (treeItem.Type is TreeItemType.WORKSPACE)
|
else if (treeItem.Type is TreeItemType.WORKSPACE)
|
||||||
{
|
{
|
||||||
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@treeItem.Children!" OnClick="@(() => this.OnWorkspaceClicked(treeItem))">
|
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@(treeItem.Children!)" OnClick="@(() => this.OnWorkspaceClicked(treeItem))">
|
||||||
<BodyContent>
|
<BodyContent>
|
||||||
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
|
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
|
||||||
<MudText Style="justify-self: start;">
|
<MudText Style="justify-self: start;">
|
||||||
@ -86,7 +86,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@treeItem.Children!">
|
<MudTreeViewItem T="ITreeItem" Icon="@treeItem.Icon" Value="@item.Value" Expanded="@item.Expanded" CanExpand="@treeItem.Expandable" Items="@(treeItem.Children!)">
|
||||||
<BodyContent>
|
<BodyContent>
|
||||||
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
|
<div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
|
||||||
<MudText Style="justify-self: start;">
|
<MudText Style="justify-self: start;">
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
public void TryLoad()
|
public void TryLoad()
|
||||||
{
|
{
|
||||||
if(!this.TryProcessAssistant(out var issue))
|
if(!this.TryProcessAssistant(out var issue))
|
||||||
this.pluginIssues.Add(issue);
|
this.PluginIssues.Add(issue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -65,7 +65,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
this.RegisterLuaHelpers();
|
this.RegisterLuaHelpers();
|
||||||
|
|
||||||
// Ensure that the main ASSISTANT table exists and is a valid Lua table:
|
// Ensure that the main ASSISTANT table exists and is a valid Lua table:
|
||||||
if (!this.state.Environment["ASSISTANT"].TryRead<LuaTable>(out var assistantTable))
|
if (!this.State.Environment["ASSISTANT"].TryRead<LuaTable>(out var assistantTable))
|
||||||
{
|
{
|
||||||
message = TB("The ASSISTANT lua table does not exist or is not a valid table.");
|
message = TB("The ASSISTANT lua table does not exist or is not a valid table.");
|
||||||
return false;
|
return false;
|
||||||
@ -148,7 +148,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
var results = await this.state.CallAsync(this.buildPromptFunction, [input], cancellationToken);
|
var results = await this.State.CallAsync(this.buildPromptFunction, [input], cancellationToken);
|
||||||
if (results.Length == 0)
|
if (results.Length == 0)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
var results = await this.state.CallAsync(callback, [input], cancellationToken);
|
var results = await this.State.CallAsync(callback, [input], cancellationToken);
|
||||||
if (results.Length == 0)
|
if (results.Length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -498,7 +498,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
private void RegisterLuaHelpers()
|
private void RegisterLuaHelpers()
|
||||||
{
|
{
|
||||||
|
|
||||||
this.state.Environment["LogInfo"] = new LuaFunction((context, _) =>
|
this.State.Environment["LogInfo"] = new LuaFunction((context, _) =>
|
||||||
{
|
{
|
||||||
if (context.ArgumentCount == 0) return new(0);
|
if (context.ArgumentCount == 0) return new(0);
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
return new(0);
|
return new(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.state.Environment["LogDebug"] = new LuaFunction((context, _) =>
|
this.State.Environment["LogDebug"] = new LuaFunction((context, _) =>
|
||||||
{
|
{
|
||||||
if (context.ArgumentCount == 0) return new(0);
|
if (context.ArgumentCount == 0) return new(0);
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
return new(0);
|
return new(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.state.Environment["LogWarning"] = new LuaFunction((context, _) =>
|
this.State.Environment["LogWarning"] = new LuaFunction((context, _) =>
|
||||||
{
|
{
|
||||||
if (context.ArgumentCount == 0) return new(0);
|
if (context.ArgumentCount == 0) return new(0);
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
return new(0);
|
return new(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.state.Environment["LogError"] = new LuaFunction((context, _) =>
|
this.State.Environment["LogError"] = new LuaFunction((context, _) =>
|
||||||
{
|
{
|
||||||
if (context.ArgumentCount == 0) return new(0);
|
if (context.ArgumentCount == 0) return new(0);
|
||||||
|
|
||||||
@ -534,7 +534,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
return new(0);
|
return new(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.state.Environment["DateTime"] = new LuaFunction((context, _) =>
|
this.State.Environment["DateTime"] = new LuaFunction((context, _) =>
|
||||||
{
|
{
|
||||||
var format = context.ArgumentCount > 0 ? context.GetArgument<string>(0) : "yyyy-MM-dd HH:mm:ss";
|
var format = context.ArgumentCount > 0 ? context.GetArgument<string>(0) : "yyyy-MM-dd HH:mm:ss";
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
@ -554,7 +554,7 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType
|
|||||||
return new(context.Return(table));
|
return new(context.Return(table));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.state.Environment["Timestamp"] = new LuaFunction((context, _) =>
|
this.State.Environment["Timestamp"] = new LuaFunction((context, _) =>
|
||||||
{
|
{
|
||||||
var timestamp = DateTime.UtcNow.ToString("o");
|
var timestamp = DateTime.UtcNow.ToString("o");
|
||||||
return new(context.Return(timestamp));
|
return new(context.Return(timestamp));
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public abstract partial class PluginBase
|
|||||||
// ReSharper disable once UnusedMethodReturnValue.Local
|
// ReSharper disable once UnusedMethodReturnValue.Local
|
||||||
private bool TryInitIconSVG(out string message, out string iconSVG)
|
private bool TryInitIconSVG(out string message, out string iconSVG)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["ICON_SVG"].TryRead(out iconSVG))
|
if (!this.State.Environment["ICON_SVG"].TryRead(out iconSVG))
|
||||||
{
|
{
|
||||||
iconSVG = DEFAULT_ICON_SVG;
|
iconSVG = DEFAULT_ICON_SVG;
|
||||||
message = "The field ICON_SVG does not exist or is not a valid string.";
|
message = "The field ICON_SVG does not exist or is not a valid string.";
|
||||||
|
|||||||
@ -11,9 +11,9 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(PluginBase).Namespace, nameof(PluginBase));
|
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(PluginBase).Namespace, nameof(PluginBase));
|
||||||
|
|
||||||
private readonly IReadOnlyCollection<string> baseIssues;
|
private readonly IReadOnlyCollection<string> baseIssues;
|
||||||
protected readonly LuaState state;
|
protected readonly LuaState State;
|
||||||
|
|
||||||
protected readonly List<string> pluginIssues = [];
|
protected readonly List<string> PluginIssues = [];
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string IconSVG { get; }
|
public string IconSVG { get; }
|
||||||
@ -65,7 +65,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The issues that occurred during the initialization of this plugin.
|
/// The issues that occurred during the initialization of this plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<string> Issues => this.baseIssues.Concat(this.pluginIssues);
|
public IEnumerable<string> Issues => this.baseIssues.Concat(this.PluginIssues);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// True, when the plugin is valid.
|
/// True, when the plugin is valid.
|
||||||
@ -74,11 +74,11 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// False means that there were issues during the initialization of the plugin.
|
/// False means that there were issues during the initialization of the plugin.
|
||||||
/// Please check the Issues property for more information.
|
/// Please check the Issues property for more information.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public bool IsValid => this is not NoPlugin && this.baseIssues.Count == 0 && this.pluginIssues.Count == 0;
|
public bool IsValid => this is not NoPlugin && this.baseIssues.Count == 0 && this.PluginIssues.Count == 0;
|
||||||
|
|
||||||
protected PluginBase(bool isInternal, LuaState state, PluginType type, string parseError = "")
|
protected PluginBase(bool isInternal, LuaState state, PluginType type, string parseError = "")
|
||||||
{
|
{
|
||||||
this.state = state;
|
this.State = state;
|
||||||
this.Type = type;
|
this.Type = type;
|
||||||
|
|
||||||
var issues = new List<string>();
|
var issues = new List<string>();
|
||||||
@ -160,7 +160,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the ID could be read successfully.</returns>
|
/// <returns>True, when the ID could be read successfully.</returns>
|
||||||
private bool TryInitId(out string message, out Guid id)
|
private bool TryInitId(out string message, out Guid id)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["ID"].TryRead<string>(out var idText))
|
if (!this.State.Environment["ID"].TryRead<string>(out var idText))
|
||||||
{
|
{
|
||||||
message = TB("The field ID does not exist or is not a valid string.");
|
message = TB("The field ID does not exist or is not a valid string.");
|
||||||
id = Guid.Empty;
|
id = Guid.Empty;
|
||||||
@ -192,7 +192,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the name could be read successfully.</returns>
|
/// <returns>True, when the name could be read successfully.</returns>
|
||||||
private bool TryInitName(out string message, out string name)
|
private bool TryInitName(out string message, out string name)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["NAME"].TryRead(out name))
|
if (!this.State.Environment["NAME"].TryRead(out name))
|
||||||
{
|
{
|
||||||
message = TB("The field NAME does not exist or is not a valid string.");
|
message = TB("The field NAME does not exist or is not a valid string.");
|
||||||
name = string.Empty;
|
name = string.Empty;
|
||||||
@ -217,7 +217,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the description could be read successfully.</returns>
|
/// <returns>True, when the description could be read successfully.</returns>
|
||||||
private bool TryInitDescription(out string message, out string description)
|
private bool TryInitDescription(out string message, out string description)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["DESCRIPTION"].TryRead(out description))
|
if (!this.State.Environment["DESCRIPTION"].TryRead(out description))
|
||||||
{
|
{
|
||||||
message = TB("The field DESCRIPTION does not exist or is not a valid string.");
|
message = TB("The field DESCRIPTION does not exist or is not a valid string.");
|
||||||
description = string.Empty;
|
description = string.Empty;
|
||||||
@ -242,7 +242,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the version could be read successfully.</returns>
|
/// <returns>True, when the version could be read successfully.</returns>
|
||||||
private bool TryInitVersion(out string message, out PluginVersion version)
|
private bool TryInitVersion(out string message, out PluginVersion version)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["VERSION"].TryRead<string>(out var versionText))
|
if (!this.State.Environment["VERSION"].TryRead<string>(out var versionText))
|
||||||
{
|
{
|
||||||
message = TB("The field VERSION does not exist or is not a valid string.");
|
message = TB("The field VERSION does not exist or is not a valid string.");
|
||||||
version = PluginVersion.NONE;
|
version = PluginVersion.NONE;
|
||||||
@ -274,7 +274,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the authors could be read successfully.</returns>
|
/// <returns>True, when the authors could be read successfully.</returns>
|
||||||
private bool TryInitAuthors(out string message, out string[] authors)
|
private bool TryInitAuthors(out string message, out string[] authors)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["AUTHORS"].TryRead<LuaTable>(out var authorsTable))
|
if (!this.State.Environment["AUTHORS"].TryRead<LuaTable>(out var authorsTable))
|
||||||
{
|
{
|
||||||
authors = [];
|
authors = [];
|
||||||
message = TB("The table AUTHORS does not exist or is using an invalid syntax.");
|
message = TB("The table AUTHORS does not exist or is using an invalid syntax.");
|
||||||
@ -305,7 +305,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the support contact could be read successfully.</returns>
|
/// <returns>True, when the support contact could be read successfully.</returns>
|
||||||
private bool TryInitSupportContact(out string message, out string contact)
|
private bool TryInitSupportContact(out string message, out string contact)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["SUPPORT_CONTACT"].TryRead(out contact))
|
if (!this.State.Environment["SUPPORT_CONTACT"].TryRead(out contact))
|
||||||
{
|
{
|
||||||
contact = string.Empty;
|
contact = string.Empty;
|
||||||
message = TB("The field SUPPORT_CONTACT does not exist or is not a valid string.");
|
message = TB("The field SUPPORT_CONTACT does not exist or is not a valid string.");
|
||||||
@ -330,7 +330,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the source URL could be read successfully.</returns>
|
/// <returns>True, when the source URL could be read successfully.</returns>
|
||||||
private bool TryInitSourceURL(out string message, out string url)
|
private bool TryInitSourceURL(out string message, out string url)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["SOURCE_URL"].TryRead(out url))
|
if (!this.State.Environment["SOURCE_URL"].TryRead(out url))
|
||||||
{
|
{
|
||||||
url = string.Empty;
|
url = string.Empty;
|
||||||
message = TB("The field SOURCE_URL does not exist or is not a valid string.");
|
message = TB("The field SOURCE_URL does not exist or is not a valid string.");
|
||||||
@ -395,7 +395,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the categories could be read successfully.</returns>
|
/// <returns>True, when the categories could be read successfully.</returns>
|
||||||
private bool TryInitCategories(out string message, out PluginCategory[] categories)
|
private bool TryInitCategories(out string message, out PluginCategory[] categories)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["CATEGORIES"].TryRead<LuaTable>(out var categoriesTable))
|
if (!this.State.Environment["CATEGORIES"].TryRead<LuaTable>(out var categoriesTable))
|
||||||
{
|
{
|
||||||
categories = [];
|
categories = [];
|
||||||
message = TB("The table CATEGORIES does not exist or is using an invalid syntax.");
|
message = TB("The table CATEGORIES does not exist or is using an invalid syntax.");
|
||||||
@ -427,7 +427,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the target groups could be read successfully.</returns>
|
/// <returns>True, when the target groups could be read successfully.</returns>
|
||||||
private bool TryInitTargetGroups(out string message, out PluginTargetGroup[] targetGroups)
|
private bool TryInitTargetGroups(out string message, out PluginTargetGroup[] targetGroups)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["TARGET_GROUPS"].TryRead<LuaTable>(out var targetGroupsTable))
|
if (!this.State.Environment["TARGET_GROUPS"].TryRead<LuaTable>(out var targetGroupsTable))
|
||||||
{
|
{
|
||||||
targetGroups = [];
|
targetGroups = [];
|
||||||
message = TB("The table TARGET_GROUPS does not exist or is using an invalid syntax.");
|
message = TB("The table TARGET_GROUPS does not exist or is using an invalid syntax.");
|
||||||
@ -459,7 +459,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the maintenance status could be read successfully.</returns>
|
/// <returns>True, when the maintenance status could be read successfully.</returns>
|
||||||
private bool TryInitIsMaintained(out string message, out bool isMaintained)
|
private bool TryInitIsMaintained(out string message, out bool isMaintained)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["IS_MAINTAINED"].TryRead(out isMaintained))
|
if (!this.State.Environment["IS_MAINTAINED"].TryRead(out isMaintained))
|
||||||
{
|
{
|
||||||
isMaintained = false;
|
isMaintained = false;
|
||||||
message = TB("The field IS_MAINTAINED does not exist or is not a valid boolean.");
|
message = TB("The field IS_MAINTAINED does not exist or is not a valid boolean.");
|
||||||
@ -478,7 +478,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the deprecation message could be read successfully.</returns>
|
/// <returns>True, when the deprecation message could be read successfully.</returns>
|
||||||
private bool TryInitDeprecationMessage(out string message, out string deprecationMessage)
|
private bool TryInitDeprecationMessage(out string message, out string deprecationMessage)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["DEPRECATION_MESSAGE"].TryRead(out deprecationMessage))
|
if (!this.State.Environment["DEPRECATION_MESSAGE"].TryRead(out deprecationMessage))
|
||||||
{
|
{
|
||||||
deprecationMessage = string.Empty;
|
deprecationMessage = string.Empty;
|
||||||
message = TB("The field DEPRECATION_MESSAGE does not exist, is not a valid string. This message is optional: use an empty string to indicate that the plugin is not deprecated.");
|
message = TB("The field DEPRECATION_MESSAGE does not exist, is not a valid string. This message is optional: use an empty string to indicate that the plugin is not deprecated.");
|
||||||
@ -497,7 +497,7 @@ public abstract partial class PluginBase : IPluginMetadata
|
|||||||
/// <returns>True, when the UI text content could be read successfully.</returns>
|
/// <returns>True, when the UI text content could be read successfully.</returns>
|
||||||
protected bool TryInitUITextContent(out string message, out Dictionary<string, string> pluginContent)
|
protected bool TryInitUITextContent(out string message, out Dictionary<string, string> pluginContent)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["UI_TEXT_CONTENT"].TryRead<LuaTable>(out var textTable))
|
if (!this.State.Environment["UI_TEXT_CONTENT"].TryRead<LuaTable>(out var textTable))
|
||||||
{
|
{
|
||||||
message = TB("The UI_TEXT_CONTENT table does not exist or is not a valid table.");
|
message = TB("The UI_TEXT_CONTENT table does not exist or is not a valid table.");
|
||||||
pluginContent = [];
|
pluginContent = [];
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
|
|||||||
public async Task InitializeAsync(bool dryRun)
|
public async Task InitializeAsync(bool dryRun)
|
||||||
{
|
{
|
||||||
if(!this.TryProcessConfiguration(dryRun, out var issue))
|
if(!this.TryProcessConfiguration(dryRun, out var issue))
|
||||||
this.pluginIssues.Add(issue);
|
this.PluginIssues.Add(issue);
|
||||||
|
|
||||||
if (!dryRun)
|
if (!dryRun)
|
||||||
{
|
{
|
||||||
@ -93,7 +93,7 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
|
|||||||
this.configObjects.Clear();
|
this.configObjects.Clear();
|
||||||
|
|
||||||
// Ensure that the main CONFIG table exists and is a valid Lua table:
|
// Ensure that the main CONFIG table exists and is a valid Lua table:
|
||||||
if (!this.state.Environment["CONFIG"].TryRead<LuaTable>(out var mainTable))
|
if (!this.State.Environment["CONFIG"].TryRead<LuaTable>(out var mainTable))
|
||||||
{
|
{
|
||||||
message = TB("The CONFIG table does not exist or is not a valid table.");
|
message = TB("The CONFIG table does not exist or is not a valid table.");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -17,15 +17,15 @@ public sealed class PluginLanguage : PluginBase, ILanguagePlugin
|
|||||||
public PluginLanguage(bool isInternal, LuaState state, PluginType type) : base(isInternal, state, type)
|
public PluginLanguage(bool isInternal, LuaState state, PluginType type) : base(isInternal, state, type)
|
||||||
{
|
{
|
||||||
if(!this.TryInitIETFTag(out var issue, out this.langCultureTag))
|
if(!this.TryInitIETFTag(out var issue, out this.langCultureTag))
|
||||||
this.pluginIssues.Add(issue);
|
this.PluginIssues.Add(issue);
|
||||||
|
|
||||||
if(!this.TryInitLangName(out issue, out this.langName))
|
if(!this.TryInitLangName(out issue, out this.langName))
|
||||||
this.pluginIssues.Add(issue);
|
this.PluginIssues.Add(issue);
|
||||||
|
|
||||||
if (this.TryInitUITextContent(out issue, out var readContent))
|
if (this.TryInitUITextContent(out issue, out var readContent))
|
||||||
this.content = readContent;
|
this.content = readContent;
|
||||||
else
|
else
|
||||||
this.pluginIssues.Add(issue);
|
this.PluginIssues.Add(issue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -52,7 +52,7 @@ public sealed class PluginLanguage : PluginBase, ILanguagePlugin
|
|||||||
/// <returns>True, when the IETF tag could be read, false otherwise.</returns>
|
/// <returns>True, when the IETF tag could be read, false otherwise.</returns>
|
||||||
private bool TryInitIETFTag(out string message, out string readLangCultureTag)
|
private bool TryInitIETFTag(out string message, out string readLangCultureTag)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["IETF_TAG"].TryRead(out readLangCultureTag))
|
if (!this.State.Environment["IETF_TAG"].TryRead(out readLangCultureTag))
|
||||||
{
|
{
|
||||||
message = TB("The field IETF_TAG does not exist or is not a valid string.");
|
message = TB("The field IETF_TAG does not exist or is not a valid string.");
|
||||||
readLangCultureTag = string.Empty;
|
readLangCultureTag = string.Empty;
|
||||||
@ -104,7 +104,7 @@ public sealed class PluginLanguage : PluginBase, ILanguagePlugin
|
|||||||
|
|
||||||
private bool TryInitLangName(out string message, out string readLangName)
|
private bool TryInitLangName(out string message, out string readLangName)
|
||||||
{
|
{
|
||||||
if (!this.state.Environment["LANG_NAME"].TryRead(out readLangName))
|
if (!this.State.Environment["LANG_NAME"].TryRead(out readLangName))
|
||||||
{
|
{
|
||||||
message = TB("The field LANG_NAME does not exist or is not a valid string.");
|
message = TB("The field LANG_NAME does not exist or is not a valid string.");
|
||||||
readLangName = string.Empty;
|
readLangName = string.Empty;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user