File tree Expand file tree Collapse file tree 1 file changed +23
-16
lines changed
Flow.Launcher.Infrastructure/UserSettings Expand file tree Collapse file tree 1 file changed +23
-16
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
- using System . Collections . Generic ;
3
- using System . Linq ;
4
- using System . Text ;
5
- using System . Threading . Tasks ;
2
+ using System . Text . Json . Serialization ;
6
3
7
4
namespace Flow . Launcher . Infrastructure . UserSettings
8
5
{
9
- public class CustomShortcutModel
6
+ public class CustomShortcutBaseModel
10
7
{
11
8
public string Key { get ; set ; }
12
- public string Value { get ; set ; }
13
9
14
- public CustomShortcutModel ( string key , string value )
15
- {
16
- Key = key ;
17
- Value = value ;
18
- }
10
+ [ JsonIgnore ]
11
+ public Func < string > Expand { get ; set ; } = ( ) => { return "" ; } ;
19
12
20
13
public override bool Equals ( object obj )
21
14
{
22
- return obj is CustomShortcutModel other &&
23
- Key == other . Key &&
24
- Value == other . Value ;
15
+ return obj is CustomShortcutBaseModel other &&
16
+ Key == other . Key ;
25
17
}
26
18
27
19
public override int GetHashCode ( )
28
20
{
29
- return HashCode . Combine ( Key , Value ) ;
21
+ return HashCode . Combine ( Key ) ;
22
+ }
23
+ } ;
24
+
25
+ public class CustomShortcutModel : CustomShortcutBaseModel
26
+ {
27
+ public string Value
28
+ {
29
+ get { return Expand ( ) ; }
30
+ set { Expand = ( ) => { return value ; } ; }
31
+ }
32
+
33
+ public CustomShortcutModel ( string key , string value )
34
+ {
35
+ Key = key ;
36
+ Value = value ;
30
37
}
31
38
32
39
public void Deconstruct ( out string key , out string value )
33
40
{
34
41
key = Key ;
35
- value = Value ;
42
+ value = Expand ( ) ;
36
43
}
37
44
38
45
public static implicit operator ( string Key , string Value ) ( CustomShortcutModel shortcut )
You can’t perform that action at this time.
0 commit comments