mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
commit
4232ef78d4
3 changed files with 30 additions and 4 deletions
|
|
@ -43,6 +43,9 @@
|
||||||
|
|
||||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_excutable_types">File Suffixes</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_URL_types">URL Protocols</system:String>
|
||||||
|
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_steam">Steam Games</system:String>
|
||||||
|
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_epic">Epic Games</system:String>
|
||||||
|
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_http">Http/Https</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_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_custom_file_types">Custom File Suffixes</system:String>
|
||||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_tooltip">
|
<system:String x:Key="flowlauncher_plugin_program_suffixes_tooltip">
|
||||||
|
|
|
||||||
|
|
@ -189,9 +189,9 @@
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
FontWeight="SemiBold"
|
FontWeight="SemiBold"
|
||||||
Text="{DynamicResource flowlauncher_plugin_program_suffixes_URL_types}" />
|
Text="{DynamicResource flowlauncher_plugin_program_suffixes_URL_types}" />
|
||||||
<CheckBox Name="steam" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[steam]}">Steam Games</CheckBox>
|
<CheckBox Name="steam" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[steam]}" Content="{DynamicResource flowlauncher_plugin_program_suffixes_URL_steam}"></CheckBox>
|
||||||
<CheckBox Name="epic" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[epic]}">Epic Games</CheckBox>
|
<CheckBox Name="epic" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[epic]}" Content="{DynamicResource flowlauncher_plugin_program_suffixes_URL_epic}"></CheckBox>
|
||||||
<CheckBox Name="http" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[http]}">Http/Https</CheckBox>
|
<CheckBox Name="http" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[http]}" Content="{DynamicResource flowlauncher_plugin_program_suffixes_URL_http}"></CheckBox>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Name="CustomProtocol"
|
Name="CustomProtocol"
|
||||||
Margin="10,0,0,0"
|
Margin="10,0,0,0"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using Windows.Foundation.Metadata;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.Program
|
namespace Flow.Launcher.Plugin.Program
|
||||||
{
|
{
|
||||||
|
|
@ -11,7 +12,10 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
public DateTime LastIndexTime { get; set; }
|
public DateTime LastIndexTime { get; set; }
|
||||||
public List<ProgramSource> ProgramSources { get; set; } = new List<ProgramSource>();
|
public List<ProgramSource> ProgramSources { get; set; } = new List<ProgramSource>();
|
||||||
public List<DisabledProgramSource> DisabledProgramSources { get; set; } = new List<DisabledProgramSource>();
|
public List<DisabledProgramSource> DisabledProgramSources { get; set; } = new List<DisabledProgramSource>();
|
||||||
public string[] CustomSuffixes { get; set; } = Array.Empty<string>();
|
|
||||||
|
[Obsolete, JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
public string[] ProgramSuffixes { get; set; } = null;
|
||||||
|
public string[] CustomSuffixes { get; set; } = Array.Empty<string>(); // Custom suffixes only
|
||||||
public string[] CustomProtocols { get; set; } = Array.Empty<string>();
|
public string[] CustomProtocols { get; set; } = Array.Empty<string>();
|
||||||
|
|
||||||
public Dictionary<string, bool> BuiltinSuffixesStatus { get; set; } = new Dictionary<string, bool>{
|
public Dictionary<string, bool> BuiltinSuffixesStatus { get; set; } = new Dictionary<string, bool>{
|
||||||
|
|
@ -32,6 +36,7 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
|
|
||||||
public string[] GetSuffixes()
|
public string[] GetSuffixes()
|
||||||
{
|
{
|
||||||
|
RemoveRedundantSuffixes();
|
||||||
List<string> extensions = new List<string>();
|
List<string> extensions = new List<string>();
|
||||||
foreach (var item in BuiltinSuffixesStatus)
|
foreach (var item in BuiltinSuffixesStatus)
|
||||||
{
|
{
|
||||||
|
|
@ -84,6 +89,24 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RemoveRedundantSuffixes()
|
||||||
|
{
|
||||||
|
// Migrate to new settings
|
||||||
|
// CustomSuffixes no longer contains custom suffixes
|
||||||
|
// users has tweaked the settings
|
||||||
|
// or this function has been executed once
|
||||||
|
if (UseCustomSuffixes == true || ProgramSuffixes == null)
|
||||||
|
return;
|
||||||
|
var suffixes = ProgramSuffixes.ToList();
|
||||||
|
foreach(var item in BuiltinSuffixesStatus)
|
||||||
|
{
|
||||||
|
suffixes.Remove(item.Key);
|
||||||
|
}
|
||||||
|
CustomSuffixes = suffixes.ToArray(); // Custom suffixes
|
||||||
|
UseCustomSuffixes = CustomSuffixes.Length != 0; // Search custom suffixes or not
|
||||||
|
ProgramSuffixes = null;
|
||||||
|
}
|
||||||
|
|
||||||
public bool EnableStartMenuSource { get; set; } = true;
|
public bool EnableStartMenuSource { get; set; } = true;
|
||||||
public bool EnableDescription { get; set; } = false;
|
public bool EnableDescription { get; set; } = false;
|
||||||
public bool HideAppsPath { get; set; } = true;
|
public bool HideAppsPath { get; set; } = true;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue