mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-15 11:01:37 +00:00
Fixed more bugs
This commit is contained in:
parent
895e2c73d7
commit
5527a18c5c
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
@ -178,6 +179,63 @@ public static partial class ManagedConfiguration
|
|||||||
|
|
||||||
return HandleParsedValue(configPluginId, dryRun, successful, configMeta, configuredValue);
|
return HandleParsedValue(configPluginId, dryRun, successful, configMeta, configuredValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to process the configuration settings from a Lua table for string values.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// When the configuration is successfully processed, it updates the configuration metadata with the configured value.
|
||||||
|
/// Furthermore, it locks the managed state of the configuration metadata to the provided configuration plugin ID.
|
||||||
|
/// The setting's value is set to the configured value.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="configPluginId">The ID of the related configuration plugin.</param>
|
||||||
|
/// <param name="settings">The Lua table containing the settings to process.</param>
|
||||||
|
/// <param name="configSelection">The expression to select the configuration class.</param>
|
||||||
|
/// <param name="propertyExpression">The expression to select the property within the configuration class.</param>
|
||||||
|
/// <param name="dryRun">When true, the method will not apply any changes, but only check if the configuration can be read.</param>
|
||||||
|
/// <typeparam name="TClass">The type of the configuration class.</typeparam>
|
||||||
|
/// <returns>True when the configuration was successfully processed, otherwise false.</returns>
|
||||||
|
public static bool TryProcessConfiguration<TClass, TDataType>(
|
||||||
|
Expression<Func<Data, TClass>> configSelection,
|
||||||
|
Expression<Func<TClass, string>> propertyExpression,
|
||||||
|
TDataType type,
|
||||||
|
Guid configPluginId,
|
||||||
|
LuaTable settings,
|
||||||
|
bool dryRun)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Handle configured string values
|
||||||
|
//
|
||||||
|
|
||||||
|
// Check if that configuration was registered:
|
||||||
|
if(!TryGet(configSelection, propertyExpression, out var configMeta))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var successful = false;
|
||||||
|
var configuredValue = configMeta.Default;
|
||||||
|
|
||||||
|
// Step 1 -- try to read the Lua value out of the Lua table:
|
||||||
|
if(settings.TryGetValue(SettingsManager.ToSettingName(propertyExpression), out var configuredTextValue))
|
||||||
|
{
|
||||||
|
// Step 2 -- try to read the Lua value as a string:
|
||||||
|
if(configuredTextValue.TryRead<string>(out var configuredText))
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case Guid:
|
||||||
|
successful = Guid.TryParse(configuredText, out var id);
|
||||||
|
configuredValue = successful ? id.ToString().ToLowerInvariant(): configuredText;
|
||||||
|
break;
|
||||||
|
case string:
|
||||||
|
configuredValue = configuredText;
|
||||||
|
successful = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return HandleParsedValue(configPluginId, dryRun, successful, configMeta, configuredValue);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to process the configuration settings from a Lua table for ISpanParsable list types.
|
/// Attempts to process the configuration settings from a Lua table for ISpanParsable list types.
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT
|
|||||||
PluginConfigurationObject.TryParse(PluginConfigurationObjectType.PROFILE, x => x.Profiles, x => x.NextProfileNum, mainTable, this.Id, ref this.configObjects, dryRun);
|
PluginConfigurationObject.TryParse(PluginConfigurationObjectType.PROFILE, x => x.Profiles, x => x.NextProfileNum, mainTable, this.Id, ref this.configObjects, dryRun);
|
||||||
|
|
||||||
// Config: preselected profile?
|
// Config: preselected profile?
|
||||||
ManagedConfiguration.TryProcessConfiguration(x => x.App, x => x.PreselectedProfile, this.Id, settingsTable, dryRun);
|
ManagedConfiguration.TryProcessConfiguration(x => x.App, x => x.PreselectedProfile, Guid.Empty, this.Id, settingsTable, dryRun);
|
||||||
|
|
||||||
message = string.Empty;
|
message = string.Empty;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
# v0.9.55, build 230 (2025-12-xx xx:xx UTC)
|
# v0.9.55, build 230 (2025-12-xx xx:xx UTC)
|
||||||
- Fixed a bug in the comparison of GUIDs in the enterprise plugin.
|
- Improved the ID handling in the enterprise plugin.
|
||||||
Loading…
Reference in New Issue
Block a user