@@ -11,19 +11,28 @@ public sealed class BigotryFilter
11
11
12
12
static BigotryFilter ( )
13
13
{
14
- var path = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , "comroid" , "pronouns.txt" ) ;
14
+ try
15
+ {
16
+ var path = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , "comroid" , "pronouns.txt" ) ;
15
17
16
- string content ;
17
- if ( File . Exists ( path ) )
18
- content = File . ReadAllText ( path ) ;
19
- else
18
+ string content ;
19
+ if ( File . Exists ( path ) )
20
+ content = File . ReadAllText ( path ) ;
21
+ else
22
+ {
23
+ Console . Write ( "Please enter your preferred pronouns: " ) ;
24
+ content = Console . ReadLine ( ) ?? throw new NullReferenceException ( "No input detected" ) ;
25
+ File . WriteAllText ( path , content ) ;
26
+ }
27
+ if ( content == string . Empty )
28
+ throw new ArgumentException ( "Please enter your pronouns" ) ;
29
+ Pronouns = content . Split ( Separators , StringSplitOptions . RemoveEmptyEntries ) ;
30
+ Log < BigotryFilter > . Config ( "Found Pronouns: " + string . Join ( "/" , Pronouns ) ) ;
31
+ }
32
+ catch ( Exception e )
20
33
{
21
- Console . Write ( "Please enter your preferred pronouns: " ) ;
22
- content = Console . ReadLine ( ) ?? throw new NullReferenceException ( "No input detected" ) ;
23
- File . WriteAllText ( path , content ) ;
34
+ Log < BigotryFilter > . Error ( "Could not obtain pronouns" , e ) ;
24
35
}
25
- Pronouns = content . Split ( Separators , StringSplitOptions . RemoveEmptyEntries ) ;
26
- Log < BigotryFilter > . Config ( "Found Pronouns: " + string . Join ( "/" , Pronouns ) ) ;
27
36
}
28
37
29
38
public static void Init ( )
0 commit comments