2023-01-04 19:23:32 -06:00
|
|
|
|
using Playnite.SDK;
|
|
|
|
|
using Playnite.SDK.Data;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace LANCommander.Playnite.Extension
|
|
|
|
|
{
|
2023-01-05 01:07:17 -06:00
|
|
|
|
public class PlayniteSettingsViewModel : ObservableObject, ISettings
|
2023-01-04 19:23:32 -06:00
|
|
|
|
{
|
|
|
|
|
private readonly PlayniteLibraryPlugin Plugin;
|
|
|
|
|
|
2023-01-05 01:07:17 -06:00
|
|
|
|
public string ServerUrl { get; set; } = String.Empty;
|
|
|
|
|
public string AccessToken { get; set; } = String.Empty;
|
|
|
|
|
public string RefreshToken { get; set; } = String.Empty;
|
|
|
|
|
|
|
|
|
|
public PlayniteSettingsViewModel()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PlayniteSettingsViewModel(PlayniteLibraryPlugin plugin)
|
2023-01-04 19:23:32 -06:00
|
|
|
|
{
|
|
|
|
|
Plugin = plugin;
|
|
|
|
|
|
2023-01-05 01:07:17 -06:00
|
|
|
|
var savedSettings = Plugin.LoadPluginSettings<PlayniteSettingsViewModel>();
|
2023-01-04 19:23:32 -06:00
|
|
|
|
|
|
|
|
|
if (savedSettings != null)
|
2023-01-05 01:07:17 -06:00
|
|
|
|
{
|
|
|
|
|
ServerUrl = savedSettings.ServerUrl;
|
2023-01-06 02:39:00 -06:00
|
|
|
|
AccessToken = savedSettings.AccessToken;
|
|
|
|
|
RefreshToken = savedSettings.RefreshToken;
|
2023-01-05 01:07:17 -06:00
|
|
|
|
}
|
2023-01-04 19:23:32 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void BeginEdit()
|
|
|
|
|
{
|
2023-01-05 01:07:17 -06:00
|
|
|
|
|
2023-01-04 19:23:32 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CancelEdit()
|
|
|
|
|
{
|
2023-01-05 01:07:17 -06:00
|
|
|
|
|
2023-01-04 19:23:32 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void EndEdit()
|
|
|
|
|
{
|
2023-01-05 01:07:17 -06:00
|
|
|
|
Plugin.SavePluginSettings(this);
|
2023-01-04 19:23:32 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool VerifySettings(out List<string> errors)
|
|
|
|
|
{
|
|
|
|
|
errors = new List<string>();
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|