mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
bugfix
This commit is contained in:
parent
5103b2b712
commit
642ea4a290
5 changed files with 34 additions and 24 deletions
|
|
@ -36,20 +36,20 @@
|
|||
<system:String x:Key="flowlauncher_plugin_program_delete_program_source">Are you sure you want to delete the selected program sources?</system:String>
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_program_update">OK</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_only_index_tip">Program Plugin will only index files that end with the following file types.</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_only_index_tip">Program Plugin will only index files with following suffixes.</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_update_file_suffixes">Successfully updated file suffixes</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_cannot_empty">File suffixes can't be empty</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_protocols_cannot_empty">Protocols can't be empty</system:String>
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_excutable_types">Excutable Types</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_types">URL Types</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_custom_urls">Custom URL Types</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_custom_file_types">Custom File Types</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_excutable_types">File Suffixes</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_types">URL Protocols</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_custom_urls">Custom URL Protocols</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_custom_file_types">Custom File Suffixes</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_tooltip">
|
||||
Insert file types what you want, Each file type should split by ';'. (ex>bat; py;)
|
||||
Insert file suffixes you want to index. File types should be separated by ';'. (ex>bat;py)
|
||||
</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_program_protocol_tooltip">
|
||||
Insert protocol types what you want, Each protocol type should split by ';'. (ex>steam; epic;)
|
||||
Insert protocols in .url files you want to index. Protocols should be separated by ';'. (ex>ftp;netflix)
|
||||
</system:String>
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_program_run_as_different_user">Run As Different User</system:String>
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@
|
|||
<CheckBox
|
||||
Name="CustomFiles"
|
||||
Margin="10,0,0,0"
|
||||
IsChecked="{Binding _settings.UseCustomSuffixes}"
|
||||
IsChecked="{Binding UseCustomSuffixes}"
|
||||
Content="{DynamicResource flowlauncher_plugin_program_suffixes_custom_file_types}" />
|
||||
<TextBox
|
||||
x:Name="tbSuffixes"
|
||||
|
|
@ -199,7 +199,7 @@
|
|||
<CheckBox
|
||||
Name="CustomProtocol"
|
||||
Margin="10,0,0,0"
|
||||
IsChecked="{Binding _settings.UseCustomProtocols}"
|
||||
IsChecked="{Binding UseCustomProtocols}"
|
||||
Content="{DynamicResource flowlauncher_plugin_program_suffixes_custom_urls}" />
|
||||
<TextBox
|
||||
x:Name="tbProtocols"
|
||||
|
|
|
|||
|
|
@ -7,17 +7,23 @@ namespace Flow.Launcher.Plugin.Program
|
|||
public partial class ProgramSuffixes
|
||||
{
|
||||
private PluginInitContext context;
|
||||
public Settings _settings;
|
||||
public Dictionary<string, bool> SuffixesStatus => _settings.BuiltinSuffixesStatus;
|
||||
public Dictionary<string, bool> ProtocolsStatus => _settings.BuiltinProtocolsStatus;
|
||||
private Settings _settings;
|
||||
public Dictionary<string, bool> SuffixesStatus { get; set; }
|
||||
public Dictionary<string, bool> ProtocolsStatus { get; set; }
|
||||
public bool UseCustomSuffixes { get; set; }
|
||||
public bool UseCustomProtocols { get; set; }
|
||||
|
||||
public ProgramSuffixes(PluginInitContext context, Settings settings)
|
||||
{
|
||||
this.context = context;
|
||||
_settings = settings;
|
||||
SuffixesStatus = new Dictionary<string, bool>(_settings.BuiltinSuffixesStatus);
|
||||
ProtocolsStatus = new Dictionary<string, bool>(_settings.BuiltinProtocolsStatus);
|
||||
UseCustomSuffixes = _settings.UseCustomSuffixes;
|
||||
UseCustomProtocols = _settings.UseCustomProtocols;
|
||||
InitializeComponent();
|
||||
tbSuffixes.Text = string.Join(Settings.SuffixSeperator, _settings.CustomSuffixes);
|
||||
tbProtocols.Text = string.Join(Settings.SuffixSeperator, _settings.CustomProtocols);
|
||||
tbSuffixes.Text = string.Join(Settings.SuffixSeparator, _settings.CustomSuffixes);
|
||||
tbProtocols.Text = string.Join(Settings.SuffixSeparator, _settings.CustomProtocols);
|
||||
}
|
||||
|
||||
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
||||
|
|
@ -27,17 +33,17 @@ namespace Flow.Launcher.Plugin.Program
|
|||
|
||||
private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
|
||||
var protocols = tbProtocols.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
|
||||
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeparator, StringSplitOptions.RemoveEmptyEntries);
|
||||
var protocols = tbProtocols.Text.Split(Settings.SuffixSeparator, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (suffixes.Length == 0 && _settings.UseCustomSuffixes)
|
||||
if (suffixes.Length == 0 && UseCustomSuffixes)
|
||||
{
|
||||
string warning = context.API.GetTranslation("flowlauncher_plugin_program_suffixes_cannot_empty");
|
||||
MessageBox.Show(warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (protocols.Length == 0 && _settings.UseCustomProtocols)
|
||||
if (protocols.Length == 0 && UseCustomProtocols)
|
||||
{
|
||||
string warning = context.API.GetTranslation("flowlauncher_plugin_protocols_cannot_empty");
|
||||
MessageBox.Show(warning);
|
||||
|
|
@ -46,6 +52,10 @@ namespace Flow.Launcher.Plugin.Program
|
|||
|
||||
_settings.CustomSuffixes = suffixes;
|
||||
_settings.CustomProtocols = protocols;
|
||||
_settings.BuiltinSuffixesStatus = new Dictionary<string, bool>(SuffixesStatus);
|
||||
_settings.BuiltinProtocolsStatus = new Dictionary<string, bool>(ProtocolsStatus);
|
||||
_settings.UseCustomSuffixes = UseCustomSuffixes;
|
||||
_settings.UseCustomProtocols = UseCustomProtocols;
|
||||
|
||||
DialogResult = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ namespace Flow.Launcher.Plugin.Program
|
|||
|
||||
[JsonIgnore]
|
||||
public Dictionary<string, bool> BuiltinProtocolsStatus { get; set; } = new Dictionary<string, bool>{
|
||||
{ $"steam://run/{SuffixSeperator}steam://rungameid/", true }, { "com.epicgames.launcher://apps/", true }, { $"http://{SuffixSeperator}https://", false}
|
||||
{ $"steam://run/{SuffixSeparator}steam://rungameid/", true }, { "com.epicgames.launcher://apps/", true }, { $"http://{SuffixSeparator}https://", false}
|
||||
};
|
||||
|
||||
public bool UseCustomSuffixes = false;
|
||||
public bool UseCustomProtocols = false;
|
||||
public bool UseCustomSuffixes { get; set; } = false;
|
||||
public bool UseCustomProtocols { get; set; } = false;
|
||||
|
||||
public string[] GetSuffixes()
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
{
|
||||
if (item.Value)
|
||||
{
|
||||
var tmp = item.Key.Split(SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
|
||||
var tmp = item.Key.Split(SuffixSeparator, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach(var p in tmp)
|
||||
{
|
||||
protocols.Add(p);
|
||||
|
|
@ -85,7 +85,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
public string CustomizedExplorer { get; set; } = Explorer;
|
||||
public string CustomizedArgs { get; set; } = ExplorerArgs;
|
||||
|
||||
internal const char SuffixSeperator = ';';
|
||||
internal const char SuffixSeparator = ';';
|
||||
|
||||
internal const string Explorer = "explorer";
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
var text = value as string[];
|
||||
if (text != null)
|
||||
{
|
||||
return string.Join(Settings.SuffixSeperator, text);
|
||||
return string.Join(Settings.SuffixSeparator, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue