@@ -6,6 +6,7 @@ class ConfigData {
66 public string NeosCacheDirectory { get ; set ; }
77 public string LaunchArguments { get ; set ; }
88 public bool IgnoreNeosInstallMissing { get ; set ; }
9+ public string GithubToken { get ; set ; }
910}
1011public class Config {
1112 //Config file
@@ -23,6 +24,8 @@ public class Config {
2324 public static string LaunchArguments { get ; set ; } = @"" ;
2425 /**<summary>Ignore message prompting to set Neos Install Path</summary>*/
2526 public static bool IgnoreNeosInstallMissing { get ; set ; } = false ;
27+ /**<summary>Optional Github token, Increases rate limit from 60 to 5000 per hour</summary>*/
28+ public static string GithubToken { get ; set ; } = "" ;
2629
2730
2831 //Derived directories
@@ -66,8 +69,9 @@ static void WriteNewConfig() {
6669 LaunchArguments = "" ,
6770 NeosDataDirectory = "" ,
6871 NeosCacheDirectory = "" ,
69- IgnoreNeosInstallMissing = false
70- } ;
72+ IgnoreNeosInstallMissing = false ,
73+ GithubToken = ""
74+ } ;
7175 string json = JsonSerializer . Serialize ( _data , JsonSerializerOptions ) ;
7276 File . WriteAllText ( ConfigFile , json ) ;
7377 } catch ( Exception ex ) {
@@ -84,8 +88,9 @@ public static void SaveConfig() {
8488 UseNeosLauncher = UseNeosLauncher ,
8589 NeosDataDirectory = NeosDataDirectory ,
8690 NeosCacheDirectory = NeosCacheDirectory ,
87- IgnoreNeosInstallMissing = IgnoreNeosInstallMissing
88- } ;
91+ IgnoreNeosInstallMissing = IgnoreNeosInstallMissing ,
92+ GithubToken = GithubToken
93+ } ;
8994 string json = JsonSerializer . Serialize ( _data , JsonSerializerOptions ) ;
9095 File . WriteAllText ( ConfigFile , json ) ;
9196 ReadConfig ( ) ; //ensures derived values are updated
@@ -123,6 +128,8 @@ public static void ReadConfig() {
123128 //TODO check what happens for missing or invalid keys
124129 IgnoreNeosInstallMissing = openedConfig . IgnoreNeosInstallMissing ;
125130
131+ GithubToken = openedConfig . GithubToken ;
132+
126133 //Creates nml_mods and nml_libs if they don't exist
127134 if ( ! Directory . Exists ( NeosInstallDirectory ) ) {
128135 Log ( "Neos install directory does not exist" , Level . ERROR ) ;
0 commit comments