mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 15:14:41 +00:00
Closes #2260
This commit is contained in:
parent
9d7e2482f2
commit
7a5a2537a3
3 changed files with 31 additions and 4 deletions
|
@ -705,7 +705,11 @@ namespace ArchiSteamFarm {
|
|||
return response.Result;
|
||||
}
|
||||
|
||||
internal void SetCurrentMode(uint chatMode) {
|
||||
internal void SetCurrentMode(EUserInterfaceMode userInterfaceMode, byte chatMode = 2) {
|
||||
if (!Enum.IsDefined(typeof(EUserInterfaceMode), userInterfaceMode)) {
|
||||
throw new InvalidEnumArgumentException(nameof(userInterfaceMode), (int) userInterfaceMode, typeof(EUserInterfaceMode));
|
||||
}
|
||||
|
||||
if (chatMode == 0) {
|
||||
throw new ArgumentOutOfRangeException(nameof(chatMode));
|
||||
}
|
||||
|
@ -718,7 +722,13 @@ namespace ArchiSteamFarm {
|
|||
return;
|
||||
}
|
||||
|
||||
ClientMsgProtobuf<CMsgClientUIMode> request = new(EMsg.ClientCurrentUIMode) { Body = { chat_mode = chatMode } };
|
||||
ClientMsgProtobuf<CMsgClientUIMode> request = new(EMsg.ClientCurrentUIMode) {
|
||||
Body = {
|
||||
uimode = (uint) userInterfaceMode,
|
||||
chat_mode = chatMode
|
||||
}
|
||||
};
|
||||
|
||||
Client.Send(request);
|
||||
}
|
||||
|
||||
|
@ -898,6 +908,12 @@ namespace ArchiSteamFarm {
|
|||
}
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public enum EUserInterfaceMode : byte {
|
||||
Default = 0,
|
||||
BigPicture = 1
|
||||
}
|
||||
|
||||
internal sealed class PlayingSessionStateCallback : CallbackMsg {
|
||||
internal readonly bool PlayingBlocked;
|
||||
|
||||
|
|
|
@ -2831,7 +2831,7 @@ namespace ArchiSteamFarm {
|
|||
Utilities.InBackground(() => RedeemGamesInBackground(this));
|
||||
}
|
||||
|
||||
ArchiHandler.SetCurrentMode(2);
|
||||
ArchiHandler.SetCurrentMode(BotConfig.UserInterfaceMode);
|
||||
ArchiHandler.RequestItemAnnouncements();
|
||||
|
||||
// Sometimes Steam won't send us our own PersonaStateCallback, so request it explicitly
|
||||
|
|
|
@ -107,6 +107,9 @@ namespace ArchiSteamFarm {
|
|||
[PublicAPI]
|
||||
public const bool DefaultUseLoginKeys = true;
|
||||
|
||||
[PublicAPI]
|
||||
public const ArchiHandler.EUserInterfaceMode DefaultUserInterfaceMode = ArchiHandler.EUserInterfaceMode.Default;
|
||||
|
||||
internal const byte SteamParentalCodeLength = 4;
|
||||
|
||||
private const byte SteamTradeTokenLength = 8;
|
||||
|
@ -248,6 +251,9 @@ namespace ArchiSteamFarm {
|
|||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
public bool UseLoginKeys { get; private set; } = DefaultUseLoginKeys;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
public ArchiHandler.EUserInterfaceMode UserInterfaceMode { get; private set; } = DefaultUserInterfaceMode;
|
||||
|
||||
[JsonExtensionData]
|
||||
internal Dictionary<string, JToken>? AdditionalProperties {
|
||||
get;
|
||||
|
@ -407,7 +413,11 @@ namespace ArchiSteamFarm {
|
|||
}
|
||||
}
|
||||
|
||||
return TradingPreferences <= ETradingPreferences.All ? (true, null) : (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(TradingPreferences), TradingPreferences));
|
||||
if (TradingPreferences > ETradingPreferences.All) {
|
||||
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(TradingPreferences), TradingPreferences));
|
||||
}
|
||||
|
||||
return !Enum.IsDefined(typeof(ArchiHandler.EUserInterfaceMode), UserInterfaceMode) ? (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(UserInterfaceMode), UserInterfaceMode)) : (true, null);
|
||||
}
|
||||
|
||||
internal static async Task<BotConfig?> Load(string filePath) {
|
||||
|
@ -547,6 +557,7 @@ namespace ArchiSteamFarm {
|
|||
public bool ShouldSerializeTradingPreferences() => ShouldSerializeDefaultValues || (TradingPreferences != DefaultTradingPreferences);
|
||||
public bool ShouldSerializeTransferableTypes() => ShouldSerializeDefaultValues || ((TransferableTypes != DefaultTransferableTypes) && !TransferableTypes.SetEquals(DefaultTransferableTypes));
|
||||
public bool ShouldSerializeUseLoginKeys() => ShouldSerializeDefaultValues || (UseLoginKeys != DefaultUseLoginKeys);
|
||||
public bool ShouldSerializeUserInterfaceMode() => ShouldSerializeDefaultValues || (UserInterfaceMode != DefaultUserInterfaceMode);
|
||||
|
||||
// ReSharper restore UnusedMember.Global
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue