mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-27 04:41:15 +08:00
🐛 fix
This commit is contained in:
@@ -36,7 +36,7 @@ sealed class SteamServiceImpl2 : SteamServiceBaseImpl, ISteamConnectService
|
||||
|
||||
public override ISteamConnectService Conn => this;
|
||||
|
||||
protected override string? StratSteamDefaultParameter => SteamSettings.SteamStratParameter.ActualValue;
|
||||
protected override string? StratSteamDefaultParameter => SteamSettings.SteamStratParameter.Value;
|
||||
|
||||
protected override bool IsRunSteamAdministrator => SteamSettings.IsRunSteamAdministrator.Value;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public abstract class SettingsPropertyBase
|
||||
public abstract void Reset();
|
||||
}
|
||||
|
||||
[DebuggerDisplay("Value={Value}, PropertyName={PropertyName}, AutoSave={AutoSave}")]
|
||||
[DebuggerDisplay("Value={ActualValue}, PropertyName={PropertyName}, AutoSave={AutoSave}")]
|
||||
public abstract class SettingsPropertyBase<TValue> : SettingsPropertyBase, INotifyPropertyChanged
|
||||
{
|
||||
/// <summary>
|
||||
@@ -84,7 +84,7 @@ public abstract class SettingsPropertyBase<TValue> : SettingsPropertyBase, INoti
|
||||
add
|
||||
{
|
||||
if (value == null) return;
|
||||
ValueChanged += _handlers[value] = (sender, args) => value(sender, new PropertyChangedEventArgs(nameof(ActualValue)));
|
||||
ValueChanged += _handlers[value] = (sender, args) => value(sender, new PropertyChangedEventArgs("Value"));
|
||||
}
|
||||
|
||||
remove
|
||||
|
||||
@@ -14,6 +14,7 @@ public class SettingsStructPropertyBase<TValue, [DynamicallyAccessedMembers(Dyna
|
||||
public SettingsStructPropertyBase(TValue? @default = default, bool autoSave = true, [CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
PropertyName = propertyName.ThrowIsNull();
|
||||
|
||||
AutoSave = autoSave;
|
||||
Default = @default;
|
||||
ParameterExpression parameter = Expression.Parameter(typeof(TSettings), "obj");
|
||||
|
||||
@@ -88,7 +88,12 @@ public class SettingsProperty<TValue, [DynamicallyAccessedMembers(DynamicallyAcc
|
||||
|
||||
public override void RaiseValueChanged(bool notSave = false)
|
||||
{
|
||||
setter(monitor.CurrentValue, value); // 赋值模型类属性
|
||||
var setter_value = value;
|
||||
if (EqualityComparer<TValue?>.Default.Equals(value, Default))
|
||||
{
|
||||
setter_value = default;
|
||||
}
|
||||
setter(monitor.CurrentValue, setter_value); // 赋值模型类属性
|
||||
OnValueChanged(value, value); // 调用变更事件
|
||||
if (!notSave && AutoSave) // 自动保存
|
||||
{
|
||||
|
||||
@@ -69,40 +69,38 @@ public static class SteamSettings
|
||||
|
||||
static SteamSettings()
|
||||
{
|
||||
if (!IApplication.IsDesktop()) return;
|
||||
#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID)
|
||||
IsRunSteamMinimized.ValueChanged += IsRunSteamMinimized_ValueChanged;
|
||||
IsRunSteamNoCheckUpdate.ValueChanged += IsRunSteamNoCheckUpdate_ValueChanged;
|
||||
IsRunSteamChina.ValueChanged += IsRunSteamChina_ValueChanged;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void IsRunSteamNoCheckUpdate_ValueChanged(object? sender, SettingsPropertyValueChangedEventArgs<bool?> e)
|
||||
{
|
||||
if (!e.NewValue.HasValue)
|
||||
return;
|
||||
if (!e.NewValue.HasValue) return;
|
||||
if (e.NewValue.Value)
|
||||
SteamStratParameter.ActualValue += " -noverifyfiles";
|
||||
else if (SteamStratParameter.ActualValue != null)
|
||||
SteamStratParameter.ActualValue = SteamStratParameter.ActualValue.Replace("-noverifyfiles", "").Trim();
|
||||
SteamStratParameter.Value += " -noverifyfiles";
|
||||
else if (SteamStratParameter.Value != null)
|
||||
SteamStratParameter.Value = SteamStratParameter.Value.Replace("-noverifyfiles", "").Trim();
|
||||
}
|
||||
|
||||
static void IsRunSteamMinimized_ValueChanged(object? sender, SettingsPropertyValueChangedEventArgs<bool?> e)
|
||||
{
|
||||
if (!e.NewValue.HasValue)
|
||||
return;
|
||||
if (!e.NewValue.HasValue) return;
|
||||
if (e.NewValue.Value)
|
||||
SteamStratParameter.ActualValue += " -silent";
|
||||
else if (SteamStratParameter.ActualValue != null)
|
||||
SteamStratParameter.ActualValue = SteamStratParameter.ActualValue.Replace("-silent", "").Trim();
|
||||
SteamStratParameter.Value += " -silent";
|
||||
else if (SteamStratParameter.Value != null)
|
||||
SteamStratParameter.Value = SteamStratParameter.Value.Replace("-silent", "").Trim();
|
||||
}
|
||||
|
||||
static void IsRunSteamChina_ValueChanged(object? sender, SettingsPropertyValueChangedEventArgs<bool?> e)
|
||||
{
|
||||
if (!e.NewValue.HasValue)
|
||||
return;
|
||||
if (!e.NewValue.HasValue) return;
|
||||
if (e.NewValue.Value)
|
||||
SteamStratParameter.ActualValue += " -steamchina";
|
||||
else if (SteamStratParameter.ActualValue != null)
|
||||
SteamStratParameter.ActualValue = SteamStratParameter.ActualValue.Replace("-steamchina", "").Trim();
|
||||
SteamStratParameter.Value += " -steamchina";
|
||||
else if (SteamStratParameter.Value != null)
|
||||
SteamStratParameter.Value = SteamStratParameter.Value.Replace("-steamchina", "").Trim();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ISteamSettings.SteamStratParameter"/>
|
||||
@@ -112,12 +110,8 @@ public static class SteamSettings
|
||||
public static SettingsProperty<string, SteamSettings_> SteamSkin { get; } = new();
|
||||
|
||||
/// <inheritdoc cref="ISteamSettings.SteamProgramPath"/>
|
||||
public static SettingsProperty<string, SteamSettings_> SteamProgramPath = new()
|
||||
{
|
||||
#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID)
|
||||
Value = steamService.SteamProgramPath,
|
||||
#endif
|
||||
};
|
||||
public static SettingsProperty<string, SteamSettings_> SteamProgramPath { get; }
|
||||
= new(steamService.SteamProgramPath);
|
||||
|
||||
/// <inheritdoc cref="ISteamSettings.CustomSteamPath"/>
|
||||
public static SettingsProperty<string, SteamSettings_> CustomSteamPath { get; } = new()
|
||||
|
||||
@@ -322,6 +322,7 @@ public abstract partial class Startup
|
||||
{
|
||||
ISettings<GeneralSettings_>.Load(configurationBuilder, directoryExists),
|
||||
ISettings<UISettings_>.Load(configurationBuilder, directoryExists),
|
||||
ISettings<SteamSettings_>.Load(configurationBuilder, directoryExists),
|
||||
};
|
||||
if (TryGetPlugins(out var plugins_cfg))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user