mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #427 from Flow-Launcher/MigrateDirectPluginJsonStorage
Use API call to save instead of direct call
This commit is contained in:
commit
be8bb8bcd1
28 changed files with 130 additions and 202 deletions
|
|
@ -51,6 +51,7 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
var savable = plugin.Plugin as ISavable;
|
var savable = plugin.Plugin as ISavable;
|
||||||
savable?.Save();
|
savable?.Save();
|
||||||
}
|
}
|
||||||
|
API.SavePluginSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task ReloadData()
|
public static async Task ReloadData()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
|
|
||||||
namespace Flow.Launcher.Infrastructure.Storage
|
namespace Flow.Launcher.Infrastructure.Storage
|
||||||
{
|
{
|
||||||
public class FlowLauncherJsonStorage<T> : JsonStrorage<T> where T : new()
|
public class FlowLauncherJsonStorage<T> : JsonStorage<T> where T : new()
|
||||||
{
|
{
|
||||||
public FlowLauncherJsonStorage()
|
public FlowLauncherJsonStorage()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace Flow.Launcher.Infrastructure.Storage
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Serialize object using json format.
|
/// Serialize object using json format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class JsonStrorage<T> where T : new()
|
public class JsonStorage<T> where T : new()
|
||||||
{
|
{
|
||||||
protected T _data;
|
protected T _data;
|
||||||
// need a new directory name
|
// need a new directory name
|
||||||
|
|
@ -23,10 +23,10 @@ namespace Flow.Launcher.Infrastructure.Storage
|
||||||
{
|
{
|
||||||
if (File.Exists(FilePath))
|
if (File.Exists(FilePath))
|
||||||
{
|
{
|
||||||
var searlized = File.ReadAllText(FilePath);
|
var serialized = File.ReadAllText(FilePath);
|
||||||
if (!string.IsNullOrWhiteSpace(searlized))
|
if (!string.IsNullOrWhiteSpace(serialized))
|
||||||
{
|
{
|
||||||
Deserialize(searlized);
|
Deserialize(serialized);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -40,16 +40,16 @@ namespace Flow.Launcher.Infrastructure.Storage
|
||||||
return _data.NonNull();
|
return _data.NonNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Deserialize(string searlized)
|
private void Deserialize(string serialized)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_data = JsonSerializer.Deserialize<T>(searlized);
|
_data = JsonSerializer.Deserialize<T>(serialized);
|
||||||
}
|
}
|
||||||
catch (JsonException e)
|
catch (JsonException e)
|
||||||
{
|
{
|
||||||
LoadDefault();
|
LoadDefault();
|
||||||
Log.Exception($"|JsonStrorage.Deserialize|Deserialize error for json <{FilePath}>", e);
|
Log.Exception($"|JsonStorage.Deserialize|Deserialize error for json <{FilePath}>", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_data == null)
|
if (_data == null)
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
|
|
||||||
namespace Flow.Launcher.Infrastructure.Storage
|
namespace Flow.Launcher.Infrastructure.Storage
|
||||||
{
|
{
|
||||||
public class PluginJsonStorage<T> :JsonStrorage<T> where T : new()
|
public class PluginJsonStorage<T> :JsonStorage<T> where T : new()
|
||||||
{
|
{
|
||||||
public PluginJsonStorage()
|
public PluginJsonStorage()
|
||||||
{
|
{
|
||||||
// C# releated, add python releated below
|
// C# related, add python related below
|
||||||
var dataType = typeof(T);
|
var dataType = typeof(T);
|
||||||
var assemblyName = typeof(T).Assembly.GetName().Name;
|
var assemblyName = dataType.Assembly.GetName().Name;
|
||||||
DirectoryPath = Path.Combine(DataLocation.DataDirectory(), DirectoryName, Constant.Plugins, assemblyName);
|
DirectoryPath = Path.Combine(DataLocation.DataDirectory(), DirectoryName, Constant.Plugins, assemblyName);
|
||||||
Helper.ValidateDirectory(DirectoryPath);
|
Helper.ValidateDirectory(DirectoryPath);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,15 @@ namespace Flow.Launcher.Plugin
|
||||||
void RestartApp();
|
void RestartApp();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save all Flow Launcher settings
|
/// Save everything, all of Flow Launcher and plugins' data and settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void SaveAppAllSettings();
|
void SaveAppAllSettings();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Save all Flow's plugins settings
|
||||||
|
/// </summary>
|
||||||
|
void SavePluginSettings();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reloads any Plugins that have the
|
/// Reloads any Plugins that have the
|
||||||
/// IReloadable implemented. It refeshes
|
/// IReloadable implemented. It refeshes
|
||||||
|
|
@ -165,33 +170,20 @@ namespace Flow.Launcher.Plugin
|
||||||
void LogException(string className, string message, Exception e, [CallerMemberName] string methodName = "");
|
void LogException(string className, string message, Exception e, [CallerMemberName] string methodName = "");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load JsonStorage for current plugin. This is the method used to load settings from json in Flow
|
/// Load JsonStorage for current plugin's setting. This is the method used to load settings from json in Flow.
|
||||||
|
/// When the file is not exist, it will create a new instance for the specific type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">Type for deserialization</typeparam>
|
/// <typeparam name="T">Type for deserialization</typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
T LoadJsonStorage<T>() where T : new();
|
T LoadSettingJsonStorage<T>() where T : new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save JsonStorage for current plugin. This is the method used to save settings to json in Flow.Launcher
|
/// Save JsonStorage for current plugin's setting. This is the method used to save settings to json in Flow.Launcher
|
||||||
/// This method will save the original instance loaded with LoadJsonStorage.
|
/// This method will save the original instance loaded with LoadJsonStorage.
|
||||||
|
/// This API call is for manually Save. Flow will automatically save all setting type that has called LoadSettingJsonStorage or SaveSettingJsonStorage previously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">Type for Serialization</typeparam>
|
/// <typeparam name="T">Type for Serialization</typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
void SaveJsonStorage<T>() where T : new();
|
void SaveSettingJsonStorage<T>() where T : new();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Save JsonStorage for current plugin. This is the method used to save settings to json in Flow.Launcher
|
|
||||||
/// This method will override the original class instance loaded from LoadJsonStorage
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Type for Serialization</typeparam>
|
|
||||||
/// <returns></returns>
|
|
||||||
void SaveJsonStorage<T>(T settings) where T : new();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Backup the JsonStorage you loaded from LoadJsonStorage
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <param name="settings"></param>
|
|
||||||
void BackupJsonStorage<T>() where T : new();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
namespace Flow.Launcher.Plugin
|
namespace Flow.Launcher.Plugin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save plugin settings/cache,
|
/// Save addtional plugin data. Inherit this interface if additional data e.g. cache needs to be saved,
|
||||||
/// todo should be merged into a abstract class intead of seperate interface
|
/// Otherwise if LoadSettingJsonStorage or SaveSettingJsonStorage has been callded,
|
||||||
|
/// plugin settings will be automatically saved (see Flow.Launcher/PublicAPIInstance.SavePluginSettings) by Flow
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ISavable
|
public interface ISavable
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -76,23 +76,25 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
public void SaveAppAllSettings()
|
public void SaveAppAllSettings()
|
||||||
{
|
{
|
||||||
|
SavePluginSettings();
|
||||||
_mainVM.Save();
|
_mainVM.Save();
|
||||||
_settingsVM.Save();
|
_settingsVM.Save();
|
||||||
PluginManager.Save();
|
|
||||||
ImageLoader.Save();
|
ImageLoader.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task ReloadAllPluginData() => PluginManager.ReloadData();
|
public Task ReloadAllPluginData() => PluginManager.ReloadData();
|
||||||
|
|
||||||
public void ShowMsgError(string title, string subTitle = "") => ShowMsg(title, subTitle, Constant.ErrorIcon, true);
|
public void ShowMsgError(string title, string subTitle = "") =>
|
||||||
|
ShowMsg(title, subTitle, Constant.ErrorIcon, true);
|
||||||
|
|
||||||
public void ShowMsg(string title, string subTitle = "", string iconPath = "") => ShowMsg(title, subTitle, iconPath, true);
|
public void ShowMsg(string title, string subTitle = "", string iconPath = "") =>
|
||||||
|
ShowMsg(title, subTitle, iconPath, true);
|
||||||
|
|
||||||
public void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true)
|
public void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
var msg = useMainWindowAsOwner ? new Msg { Owner = Application.Current.MainWindow } : new Msg();
|
var msg = useMainWindowAsOwner ? new Msg {Owner = Application.Current.MainWindow} : new Msg();
|
||||||
msg.Show(title, subTitle, iconPath);
|
msg.Show(title, subTitle, iconPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -113,61 +115,70 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
public List<PluginPair> GetAllPlugins() => PluginManager.AllPlugins.ToList();
|
public List<PluginPair> GetAllPlugins() => PluginManager.AllPlugins.ToList();
|
||||||
|
|
||||||
public MatchResult FuzzySearch(string query, string stringToCompare) => StringMatcher.FuzzySearch(query, stringToCompare);
|
public MatchResult FuzzySearch(string query, string stringToCompare) =>
|
||||||
|
StringMatcher.FuzzySearch(query, stringToCompare);
|
||||||
|
|
||||||
public Task<string> HttpGetStringAsync(string url, CancellationToken token = default) => Http.GetAsync(url);
|
public Task<string> HttpGetStringAsync(string url, CancellationToken token = default) => Http.GetAsync(url);
|
||||||
|
|
||||||
public Task<Stream> HttpGetStreamAsync(string url, CancellationToken token = default) => Http.GetStreamAsync(url);
|
public Task<Stream> HttpGetStreamAsync(string url, CancellationToken token = default) =>
|
||||||
|
Http.GetStreamAsync(url);
|
||||||
|
|
||||||
public Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath, CancellationToken token = default) => Http.DownloadAsync(url, filePath, token);
|
public Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath,
|
||||||
|
CancellationToken token = default) => Http.DownloadAsync(url, filePath, token);
|
||||||
|
|
||||||
public void AddActionKeyword(string pluginId, string newActionKeyword) => PluginManager.AddActionKeyword(pluginId, newActionKeyword);
|
public void AddActionKeyword(string pluginId, string newActionKeyword) =>
|
||||||
|
PluginManager.AddActionKeyword(pluginId, newActionKeyword);
|
||||||
|
|
||||||
public void RemoveActionKeyword(string pluginId, string oldActionKeyword) => PluginManager.RemoveActionKeyword(pluginId, oldActionKeyword);
|
public void RemoveActionKeyword(string pluginId, string oldActionKeyword) =>
|
||||||
|
PluginManager.RemoveActionKeyword(pluginId, oldActionKeyword);
|
||||||
|
|
||||||
public void LogDebug(string className, string message, [CallerMemberName] string methodName = "") => Log.Debug(className, message, methodName);
|
public void LogDebug(string className, string message, [CallerMemberName] string methodName = "") =>
|
||||||
|
Log.Debug(className, message, methodName);
|
||||||
|
|
||||||
public void LogInfo(string className, string message, [CallerMemberName] string methodName = "") => Log.Info(className, message, methodName);
|
public void LogInfo(string className, string message, [CallerMemberName] string methodName = "") =>
|
||||||
|
Log.Info(className, message, methodName);
|
||||||
|
|
||||||
public void LogWarn(string className, string message, [CallerMemberName] string methodName = "") => Log.Warn(className, message, methodName);
|
public void LogWarn(string className, string message, [CallerMemberName] string methodName = "") =>
|
||||||
|
Log.Warn(className, message, methodName);
|
||||||
|
|
||||||
public void LogException(string className, string message, Exception e, [CallerMemberName] string methodName = "") => Log.Exception(className, message, e, methodName);
|
public void LogException(string className, string message, Exception e,
|
||||||
|
[CallerMemberName] string methodName = "") => Log.Exception(className, message, e, methodName);
|
||||||
|
|
||||||
private readonly Dictionary<Type, dynamic> PluginJsonStorages = new Dictionary<Type, dynamic>();
|
private readonly Dictionary<Type, object> _pluginJsonStorages = new();
|
||||||
|
|
||||||
public T LoadJsonStorage<T>() where T : new()
|
public void SavePluginSettings()
|
||||||
{
|
{
|
||||||
var type = typeof(T);
|
foreach (var value in _pluginJsonStorages.Values)
|
||||||
if (!PluginJsonStorages.ContainsKey(type))
|
{
|
||||||
PluginJsonStorages[type] = new PluginJsonStorage<T>();
|
var method = value.GetType().GetMethod("Save");
|
||||||
|
method?.Invoke(value, null);
|
||||||
return PluginJsonStorages[type].Load();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveJsonStorage<T>() where T : new()
|
public T LoadSettingJsonStorage<T>() where T : new()
|
||||||
{
|
{
|
||||||
var type = typeof(T);
|
var type = typeof(T);
|
||||||
if (!PluginJsonStorages.ContainsKey(type))
|
if (!_pluginJsonStorages.ContainsKey(type))
|
||||||
PluginJsonStorages[type] = new PluginJsonStorage<T>();
|
_pluginJsonStorages[type] = new PluginJsonStorage<T>();
|
||||||
|
|
||||||
PluginJsonStorages[type].Save();
|
return ((PluginJsonStorage<T>) _pluginJsonStorages[type]).Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveSettingJsonStorage<T>() where T : new()
|
||||||
|
{
|
||||||
|
var type = typeof(T);
|
||||||
|
if (!_pluginJsonStorages.ContainsKey(type))
|
||||||
|
_pluginJsonStorages[type] = new PluginJsonStorage<T>();
|
||||||
|
|
||||||
|
((PluginJsonStorage<T>) _pluginJsonStorages[type]).Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveJsonStorage<T>(T settings) where T : new()
|
public void SaveJsonStorage<T>(T settings) where T : new()
|
||||||
{
|
{
|
||||||
var type = typeof(T);
|
var type = typeof(T);
|
||||||
PluginJsonStorages[type] = new PluginJsonStorage<T>(settings);
|
_pluginJsonStorages[type] = new PluginJsonStorage<T>(settings);
|
||||||
|
|
||||||
PluginJsonStorages[type].Save();
|
((PluginJsonStorage<T>) _pluginJsonStorages[type]).Save();
|
||||||
}
|
|
||||||
|
|
||||||
public void BackupJsonStorage<T>() where T : new()
|
|
||||||
{
|
|
||||||
var type = typeof(T);
|
|
||||||
if (!PluginJsonStorages.ContainsKey(type))
|
|
||||||
throw new InvalidOperationException("You haven't registered the JsonStorage for specific Type");
|
|
||||||
|
|
||||||
PluginJsonStorages[type].BackupOriginFile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent;
|
||||||
|
|
@ -180,11 +191,12 @@ namespace Flow.Launcher
|
||||||
{
|
{
|
||||||
if (GlobalKeyboardEvent != null)
|
if (GlobalKeyboardEvent != null)
|
||||||
{
|
{
|
||||||
return GlobalKeyboardEvent((int)keyevent, vkcode, state);
|
return GlobalKeyboardEvent((int) keyevent, vkcode, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,21 +12,19 @@ using Flow.Launcher.Plugin.SharedCommands;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.BrowserBookmark
|
namespace Flow.Launcher.Plugin.BrowserBookmark
|
||||||
{
|
{
|
||||||
public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, ISavable, IContextMenu
|
public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContextMenu
|
||||||
{
|
{
|
||||||
private PluginInitContext context;
|
private PluginInitContext context;
|
||||||
|
|
||||||
private List<Bookmark> cachedBookmarks = new List<Bookmark>();
|
private List<Bookmark> cachedBookmarks = new List<Bookmark>();
|
||||||
|
|
||||||
private Settings _settings { get; set;}
|
private Settings _settings { get; set;}
|
||||||
private PluginJsonStorage<Settings> _storage { get; set;}
|
|
||||||
|
|
||||||
public void Init(PluginInitContext context)
|
public void Init(PluginInitContext context)
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|
||||||
_storage = new PluginJsonStorage<Settings>();
|
_settings = context.API.LoadSettingJsonStorage<Settings>();
|
||||||
_settings = _storage.Load();
|
|
||||||
|
|
||||||
cachedBookmarks = Bookmarks.LoadAllBookmarks();
|
cachedBookmarks = Bookmarks.LoadAllBookmarks();
|
||||||
}
|
}
|
||||||
|
|
@ -113,11 +111,6 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
|
||||||
return new SettingsControl(_settings);
|
return new SettingsControl(_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
_storage.Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Result> LoadContextMenus(Result selectedResult)
|
public List<Result> LoadContextMenus(Result selectedResult)
|
||||||
{
|
{
|
||||||
return new List<Result>() {
|
return new List<Result>() {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Name": "Browser Bookmarks",
|
"Name": "Browser Bookmarks",
|
||||||
"Description": "Search your browser bookmarks",
|
"Description": "Search your browser bookmarks",
|
||||||
"Author": "qianlifeng, Ioannis G.",
|
"Author": "qianlifeng, Ioannis G.",
|
||||||
"Version": "1.4.3",
|
"Version": "1.4.4",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.BrowserBookmark.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.BrowserBookmark.dll",
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ using Flow.Launcher.Plugin.Caculator.Views;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.Caculator
|
namespace Flow.Launcher.Plugin.Caculator
|
||||||
{
|
{
|
||||||
public class Main : IPlugin, IPluginI18n, ISavable, ISettingProvider
|
public class Main : IPlugin, IPluginI18n, ISettingProvider
|
||||||
{
|
{
|
||||||
private static readonly Regex RegValidExpressChar = new Regex(
|
private static readonly Regex RegValidExpressChar = new Regex(
|
||||||
@"^(" +
|
@"^(" +
|
||||||
|
|
@ -30,17 +30,11 @@ namespace Flow.Launcher.Plugin.Caculator
|
||||||
private static Settings _settings;
|
private static Settings _settings;
|
||||||
private static SettingsViewModel _viewModel;
|
private static SettingsViewModel _viewModel;
|
||||||
|
|
||||||
static Main()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Init(PluginInitContext context)
|
public void Init(PluginInitContext context)
|
||||||
{
|
{
|
||||||
Context = context;
|
Context = context;
|
||||||
|
_settings = context.API.LoadSettingJsonStorage<Settings>();
|
||||||
_viewModel = new SettingsViewModel();
|
_viewModel = new SettingsViewModel(_settings);
|
||||||
_settings = _viewModel.Settings;
|
|
||||||
|
|
||||||
MagesEngine = new Engine(new Configuration
|
MagesEngine = new Engine(new Configuration
|
||||||
{
|
{
|
||||||
|
|
@ -187,10 +181,5 @@ namespace Flow.Launcher.Plugin.Caculator
|
||||||
{
|
{
|
||||||
return new CalculatorSettings(_viewModel);
|
return new CalculatorSettings(_viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
_viewModel.Save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,23 +8,15 @@ using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.Caculator.ViewModels
|
namespace Flow.Launcher.Plugin.Caculator.ViewModels
|
||||||
{
|
{
|
||||||
public class SettingsViewModel : BaseModel, ISavable
|
public class SettingsViewModel : BaseModel
|
||||||
{
|
{
|
||||||
private readonly PluginJsonStorage<Settings> _storage;
|
public SettingsViewModel(Settings settings)
|
||||||
|
|
||||||
public SettingsViewModel()
|
|
||||||
{
|
{
|
||||||
_storage = new PluginJsonStorage<Settings>();
|
Settings = settings;
|
||||||
Settings = _storage.Load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Settings Settings { get; set; }
|
public Settings Settings { get; init; }
|
||||||
|
|
||||||
public IEnumerable<int> MaxDecimalPlacesRange => Enumerable.Range(1, 20);
|
public IEnumerable<int> MaxDecimalPlacesRange => Enumerable.Range(1, 20);
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
_storage.Save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Name": "Calculator",
|
"Name": "Calculator",
|
||||||
"Description": "Provide mathematical calculations.(Try 5*3-2 in Flow Launcher)",
|
"Description": "Provide mathematical calculations.(Try 5*3-2 in Flow Launcher)",
|
||||||
"Author": "cxfksword",
|
"Author": "cxfksword",
|
||||||
"Version": "1.1.7",
|
"Version": "1.1.8",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.Caculator.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.Caculator.dll",
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ using System.Windows.Controls;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.Explorer
|
namespace Flow.Launcher.Plugin.Explorer
|
||||||
{
|
{
|
||||||
public class Main : ISettingProvider, IAsyncPlugin, ISavable, IContextMenu, IPluginI18n
|
public class Main : ISettingProvider, IAsyncPlugin, IContextMenu, IPluginI18n
|
||||||
{
|
{
|
||||||
internal PluginInitContext Context { get; set; }
|
internal PluginInitContext Context { get; set; }
|
||||||
|
|
||||||
|
|
@ -31,9 +31,11 @@ namespace Flow.Launcher.Plugin.Explorer
|
||||||
public async Task InitAsync(PluginInitContext context)
|
public async Task InitAsync(PluginInitContext context)
|
||||||
{
|
{
|
||||||
Context = context;
|
Context = context;
|
||||||
viewModel = new SettingsViewModel(context);
|
|
||||||
await viewModel.LoadStorage();
|
Settings = context.API.LoadSettingJsonStorage<Settings>();
|
||||||
Settings = viewModel.Settings;
|
|
||||||
|
viewModel = new SettingsViewModel(context, Settings);
|
||||||
|
|
||||||
|
|
||||||
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
|
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
|
||||||
if (Settings.QuickFolderAccessLinks.Any())
|
if (Settings.QuickFolderAccessLinks.Any())
|
||||||
|
|
@ -57,11 +59,6 @@ namespace Flow.Launcher.Plugin.Explorer
|
||||||
return await searchManager.SearchAsync(query, token);
|
return await searchManager.SearchAsync(query, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
viewModel.Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetTranslatedPluginTitle()
|
public string GetTranslatedPluginTitle()
|
||||||
{
|
{
|
||||||
return Context.API.GetTranslation("plugin_explorer_plugin_name");
|
return Context.API.GetTranslation("plugin_explorer_plugin_name");
|
||||||
|
|
|
||||||
|
|
@ -9,27 +9,20 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
||||||
{
|
{
|
||||||
public class SettingsViewModel
|
public class SettingsViewModel
|
||||||
{
|
{
|
||||||
private readonly PluginJsonStorage<Settings> storage;
|
|
||||||
|
|
||||||
internal Settings Settings { get; set; }
|
internal Settings Settings { get; set; }
|
||||||
|
|
||||||
internal PluginInitContext Context { get; set; }
|
internal PluginInitContext Context { get; set; }
|
||||||
|
|
||||||
public SettingsViewModel(PluginInitContext context)
|
public SettingsViewModel(PluginInitContext context, Settings settings)
|
||||||
{
|
{
|
||||||
Context = context;
|
Context = context;
|
||||||
storage = new PluginJsonStorage<Settings>();
|
Settings = settings;
|
||||||
Settings = storage.Load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task LoadStorage()
|
|
||||||
{
|
|
||||||
return Task.Run(() => Settings = storage.Load());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
storage.Save();
|
Context.API.SaveSettingJsonStorage<Settings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void RemoveLinkFromQuickAccess(AccessLink selectedRow) => Settings.QuickAccessLinks.Remove(selectedRow);
|
internal void RemoveLinkFromQuickAccess(AccessLink selectedRow) => Settings.QuickAccessLinks.Remove(selectedRow);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"Name": "Explorer",
|
"Name": "Explorer",
|
||||||
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
|
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
|
||||||
"Author": "Jeremy Wu",
|
"Author": "Jeremy Wu",
|
||||||
"Version": "1.7.6",
|
"Version": "1.7.7",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,11 @@ using Flow.Launcher.Infrastructure;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.PluginsManager
|
namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
{
|
{
|
||||||
public class Main : ISettingProvider, IAsyncPlugin, ISavable, IContextMenu, IPluginI18n, IAsyncReloadable
|
public class Main : ISettingProvider, IAsyncPlugin, IContextMenu, IPluginI18n, IAsyncReloadable
|
||||||
{
|
{
|
||||||
internal PluginInitContext Context { get; set; }
|
internal PluginInitContext Context { get; set; }
|
||||||
|
|
||||||
|
|
@ -33,8 +34,8 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
public Task InitAsync(PluginInitContext context)
|
public Task InitAsync(PluginInitContext context)
|
||||||
{
|
{
|
||||||
Context = context;
|
Context = context;
|
||||||
viewModel = new SettingsViewModel(context);
|
Settings = context.API.LoadSettingJsonStorage<Settings>();
|
||||||
Settings = viewModel.Settings;
|
viewModel = new SettingsViewModel(context, Settings);
|
||||||
contextMenu = new ContextMenu(Context);
|
contextMenu = new ContextMenu(Context);
|
||||||
pluginManager = new PluginsManager(Context, Settings);
|
pluginManager = new PluginsManager(Context, Settings);
|
||||||
_ = pluginManager.UpdateManifest().ContinueWith(_ =>
|
_ = pluginManager.UpdateManifest().ContinueWith(_ =>
|
||||||
|
|
@ -78,11 +79,6 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
viewModel.Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetTranslatedPluginTitle()
|
public string GetTranslatedPluginTitle()
|
||||||
{
|
{
|
||||||
return Context.API.GetTranslation("plugin_pluginsmanager_plugin_name");
|
return Context.API.GetTranslation("plugin_pluginsmanager_plugin_name");
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,16 @@ using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.PluginsManager.ViewModels
|
namespace Flow.Launcher.Plugin.PluginsManager.ViewModels
|
||||||
{
|
{
|
||||||
public class SettingsViewModel
|
internal class SettingsViewModel
|
||||||
{
|
{
|
||||||
private readonly PluginJsonStorage<Settings> storage;
|
|
||||||
|
|
||||||
internal Settings Settings { get; set; }
|
internal Settings Settings { get; set; }
|
||||||
|
|
||||||
internal PluginInitContext Context { get; set; }
|
internal PluginInitContext Context { get; set; }
|
||||||
|
|
||||||
public SettingsViewModel(PluginInitContext context)
|
public SettingsViewModel(PluginInitContext context, Settings settings)
|
||||||
{
|
{
|
||||||
Context = context;
|
Context = context;
|
||||||
storage = new PluginJsonStorage<Settings>();
|
Settings = settings;
|
||||||
Settings = storage.Load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
storage.Save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace Flow.Launcher.Plugin.PluginsManager.Views
|
||||||
{
|
{
|
||||||
private readonly SettingsViewModel viewModel;
|
private readonly SettingsViewModel viewModel;
|
||||||
|
|
||||||
public PluginsManagerSettings(SettingsViewModel viewModel)
|
internal PluginsManagerSettings(SettingsViewModel viewModel)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
"Name": "Plugins Manager",
|
"Name": "Plugins Manager",
|
||||||
"Description": "Management of installing, uninstalling or updating Flow Launcher plugins",
|
"Description": "Management of installing, uninstalling or updating Flow Launcher plugins",
|
||||||
"Author": "Jeremy Wu",
|
"Author": "Jeremy Wu",
|
||||||
"Version": "1.8.0",
|
"Version": "1.8.1",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll",
|
||||||
|
|
|
||||||
|
|
@ -25,16 +25,14 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
|
|
||||||
private static BinaryStorage<Win32[]> _win32Storage;
|
private static BinaryStorage<Win32[]> _win32Storage;
|
||||||
private static BinaryStorage<UWP.Application[]> _uwpStorage;
|
private static BinaryStorage<UWP.Application[]> _uwpStorage;
|
||||||
private readonly PluginJsonStorage<Settings> _settingsStorage;
|
|
||||||
|
|
||||||
public Main()
|
public Main()
|
||||||
{
|
{
|
||||||
_settingsStorage = new PluginJsonStorage<Settings>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
_settingsStorage.Save();
|
|
||||||
_win32Storage.Save(_win32s);
|
_win32Storage.Save(_win32s);
|
||||||
_uwpStorage.Save(_uwps);
|
_uwpStorage.Save(_uwps);
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +69,7 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
|
||||||
_settings = _settingsStorage.Load();
|
_settings = context.API.LoadSettingJsonStorage<Settings>();
|
||||||
|
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Name": "Program",
|
"Name": "Program",
|
||||||
"Description": "Search programs in Flow.Launcher",
|
"Description": "Search programs in Flow.Launcher",
|
||||||
"Author": "qianlifeng",
|
"Author": "qianlifeng",
|
||||||
"Version": "1.4.5",
|
"Version": "1.4.6",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.Program.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.Program.dll",
|
||||||
|
|
|
||||||
|
|
@ -18,27 +18,14 @@ using Keys = System.Windows.Forms.Keys;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.Shell
|
namespace Flow.Launcher.Plugin.Shell
|
||||||
{
|
{
|
||||||
public class Main : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, ISavable
|
public class Main : IPlugin, ISettingProvider, IPluginI18n, IContextMenu
|
||||||
{
|
{
|
||||||
private const string Image = "Images/shell.png";
|
private const string Image = "Images/shell.png";
|
||||||
private PluginInitContext context;
|
private PluginInitContext context;
|
||||||
private bool _winRStroked;
|
private bool _winRStroked;
|
||||||
private readonly KeyboardSimulator _keyboardSimulator = new KeyboardSimulator(new InputSimulator());
|
private readonly KeyboardSimulator _keyboardSimulator = new KeyboardSimulator(new InputSimulator());
|
||||||
|
|
||||||
private readonly Settings _settings;
|
private Settings _settings;
|
||||||
private readonly PluginJsonStorage<Settings> _storage;
|
|
||||||
|
|
||||||
public Main()
|
|
||||||
{
|
|
||||||
_storage = new PluginJsonStorage<Settings>();
|
|
||||||
_settings = _storage.Load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
_storage.Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
|
|
@ -285,6 +272,7 @@ namespace Flow.Launcher.Plugin.Shell
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent;
|
context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent;
|
||||||
|
_settings = context.API.LoadSettingJsonStorage<Settings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool API_GlobalKeyboardEvent(int keyevent, int vkcode, SpecialKeyState state)
|
bool API_GlobalKeyboardEvent(int keyevent, int vkcode, SpecialKeyState state)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Name": "Shell",
|
"Name": "Shell",
|
||||||
"Description": "Provide executing commands from Flow Launcher",
|
"Description": "Provide executing commands from Flow Launcher",
|
||||||
"Author": "qianlifeng",
|
"Author": "qianlifeng",
|
||||||
"Version": "1.4.0",
|
"Version": "1.4.1",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.Shell.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.Shell.dll",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using Flow.Launcher.Plugin.SharedCommands;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.Url
|
namespace Flow.Launcher.Plugin.Url
|
||||||
{
|
{
|
||||||
public class Main : ISettingProvider,IPlugin, IPluginI18n, ISavable
|
public class Main : ISettingProvider,IPlugin, IPluginI18n
|
||||||
{
|
{
|
||||||
//based on https://gist.github.com/dperini/729294
|
//based on https://gist.github.com/dperini/729294
|
||||||
private const string urlPattern = "^" +
|
private const string urlPattern = "^" +
|
||||||
|
|
@ -44,20 +44,9 @@ namespace Flow.Launcher.Plugin.Url
|
||||||
"$";
|
"$";
|
||||||
Regex reg = new Regex(urlPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
Regex reg = new Regex(urlPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
private PluginInitContext context;
|
private PluginInitContext context;
|
||||||
private readonly Settings _settings;
|
private Settings _settings;
|
||||||
private readonly PluginJsonStorage<Settings> _storage;
|
|
||||||
|
|
||||||
public Main()
|
|
||||||
{
|
|
||||||
_storage = new PluginJsonStorage<Settings>();
|
|
||||||
_settings = _storage.Load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
_storage.Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<Result> Query(Query query)
|
public List<Result> Query(Query query)
|
||||||
{
|
{
|
||||||
var raw = query.Search;
|
var raw = query.Search;
|
||||||
|
|
@ -128,6 +117,8 @@ namespace Flow.Launcher.Plugin.Url
|
||||||
public void Init(PluginInitContext context)
|
public void Init(PluginInitContext context)
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|
||||||
|
_settings = context.API.LoadSettingJsonStorage<Settings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetTranslatedPluginTitle()
|
public string GetTranslatedPluginTitle()
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Name": "URL",
|
"Name": "URL",
|
||||||
"Description": "Open the typed URL from Flow Launcher",
|
"Description": "Open the typed URL from Flow Launcher",
|
||||||
"Author": "qianlifeng",
|
"Author": "qianlifeng",
|
||||||
"Version": "1.1.5",
|
"Version": "1.1.6",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.Url.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.Url.dll",
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ using Flow.Launcher.Plugin.SharedCommands;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.WebSearch
|
namespace Flow.Launcher.Plugin.WebSearch
|
||||||
{
|
{
|
||||||
public class Main : IAsyncPlugin, ISettingProvider, IPluginI18n, ISavable, IResultUpdated
|
public class Main : IAsyncPlugin, ISettingProvider, IPluginI18n, IResultUpdated
|
||||||
{
|
{
|
||||||
private PluginInitContext _context;
|
private PluginInitContext _context;
|
||||||
|
|
||||||
private readonly Settings _settings;
|
private Settings _settings;
|
||||||
private readonly SettingsViewModel _viewModel;
|
private SettingsViewModel _viewModel;
|
||||||
|
|
||||||
internal const string Images = "Images";
|
internal const string Images = "Images";
|
||||||
internal static string DefaultImagesDirectory;
|
internal static string DefaultImagesDirectory;
|
||||||
|
|
@ -31,10 +31,6 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
|
|
||||||
private readonly string SearchSourceGlobalPluginWildCardSign = "*";
|
private readonly string SearchSourceGlobalPluginWildCardSign = "*";
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
_viewModel.Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
|
public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
|
||||||
{
|
{
|
||||||
|
|
@ -164,12 +160,6 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
return new List<Result>();
|
return new List<Result>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Main()
|
|
||||||
{
|
|
||||||
_viewModel = new SettingsViewModel();
|
|
||||||
_settings = _viewModel.Settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task InitAsync(PluginInitContext context)
|
public Task InitAsync(PluginInitContext context)
|
||||||
{
|
{
|
||||||
return Task.Run(Init);
|
return Task.Run(Init);
|
||||||
|
|
@ -177,6 +167,10 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
|
||||||
|
_settings = _context.API.LoadSettingJsonStorage<Settings>();
|
||||||
|
_viewModel = new SettingsViewModel(_settings);
|
||||||
|
|
||||||
var pluginDirectory = _context.CurrentPluginMetadata.PluginDirectory;
|
var pluginDirectory = _context.CurrentPluginMetadata.PluginDirectory;
|
||||||
var bundledImagesDirectory = Path.Combine(pluginDirectory, Images);
|
var bundledImagesDirectory = Path.Combine(pluginDirectory, Images);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,12 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
{
|
{
|
||||||
private readonly PluginJsonStorage<Settings> _storage;
|
private readonly PluginJsonStorage<Settings> _storage;
|
||||||
|
|
||||||
public SettingsViewModel()
|
public SettingsViewModel(Settings settings)
|
||||||
{
|
{
|
||||||
_storage = new PluginJsonStorage<Settings>();
|
Settings = settings;
|
||||||
Settings = _storage.Load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Settings Settings { get; set; }
|
public Settings Settings { get; }
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
"Name": "Web Searches",
|
"Name": "Web Searches",
|
||||||
"Description": "Provide the web search ability",
|
"Description": "Provide the web search ability",
|
||||||
"Author": "qianlifeng",
|
"Author": "qianlifeng",
|
||||||
"Version": "1.3.8",
|
"Version": "1.3.9",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue