@@ -15,37 +15,39 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
15
15
/// </remarks>
16
16
public class ProgramSource
17
17
{
18
- private string name ;
18
+ private string name = string . Empty ;
19
+ private string loc = string . Empty ;
20
+ private string uniqueIdentifier = string . Empty ;
19
21
20
- private string loc ;
21
22
public string Location
22
23
{
23
24
get => loc ;
24
25
set
25
26
{
26
- loc = value ;
27
- UniqueIdentifier = value . ToLowerInvariant ( ) ;
27
+ loc = value ?? string . Empty ;
28
+ UniqueIdentifier = value ;
28
29
}
29
30
}
30
- public string Name { get => name ?? new DirectoryInfo ( Location ) . Name ; set => name = value ; }
31
+
32
+ public string Name { get => name ; set => name = value ?? string . Empty ; }
31
33
public bool Enabled { get ; set ; } = true ;
32
34
33
- public string UniqueIdentifier { get ; private set ; }
35
+ public string UniqueIdentifier
36
+ {
37
+ get => uniqueIdentifier ;
38
+ private set
39
+ {
40
+ uniqueIdentifier = value == null ? string . Empty : value . ToLowerInvariant ( ) ;
41
+ }
42
+ }
34
43
35
44
[ JsonConstructor ]
36
45
public ProgramSource ( string name , string location , bool enabled , string uniqueIdentifier )
37
46
{
38
- loc = location ;
39
- this . name = name ;
47
+ loc = location ?? string . Empty ;
48
+ Name = name ;
40
49
Enabled = enabled ;
41
- if ( location . Equals ( uniqueIdentifier , StringComparison . OrdinalIgnoreCase ) )
42
- {
43
- UniqueIdentifier = location . ToLowerInvariant ( ) ; // To make sure old config can be reset to case-insensitive
44
- }
45
- else
46
- {
47
- UniqueIdentifier = uniqueIdentifier ; // For uwp apps
48
- }
50
+ UniqueIdentifier = uniqueIdentifier ;
49
51
}
50
52
51
53
/// <summary>
@@ -55,14 +57,15 @@ public ProgramSource(string name, string location, bool enabled, string uniqueId
55
57
/// <param name="enabled">enabled</param>
56
58
public ProgramSource ( string location , bool enabled = true )
57
59
{
58
- loc = location ;
60
+ loc = location ?? string . Empty ;
59
61
Enabled = enabled ;
60
- UniqueIdentifier = location . ToLowerInvariant ( ) ; // For path comparison
62
+ UniqueIdentifier = location ; // For path comparison
63
+ Name = new DirectoryInfo ( Location ) . Name ;
61
64
}
62
65
63
66
public ProgramSource ( IProgram source )
64
67
{
65
- loc = source . Location ;
68
+ loc = source . Location ?? string . Empty ;
66
69
Name = source . Name ;
67
70
Enabled = source . Enabled ;
68
71
UniqueIdentifier = source . UniqueIdentifier ;
0 commit comments