@@ -53,11 +53,11 @@ public TonClient(ILogger<TonClient> logger, Microsoft.Extensions.Options.IOption
5353 /// <inheritdoc />
5454 public int SyncStateCurrentSeqno { get ; private set ; }
5555
56- /// <summary>
57- /// Add assembly with additional <see cref="TypeBase"/> classes for LiteServer interaction.
58- /// </summary>
59- /// <param name="assembly">Assembly to add</param>
60- public static void RegisterAssembly ( System . Reflection . Assembly assembly )
56+ /// <summary>
57+ /// Add assembly with additional <see cref="TypeBase"/> classes for LiteServer interaction.
58+ /// </summary>
59+ /// <param name="assembly">Assembly to add</param>
60+ public static void RegisterAssembly ( System . Reflection . Assembly assembly )
6161 {
6262 TonTypeResolver . AdditionalAsseblies . Add ( assembly ) ;
6363 }
@@ -90,8 +90,20 @@ public static void RegisterAssembly(System.Reflection.Assembly assembly)
9090 return null ;
9191 }
9292
93- var httpClient = new HttpClient ( ) ;
94- var fullConfig = await httpClient . GetStringAsync ( tonOptions . UseMainnet ? tonOptions . ConfigPathMainnet : tonOptions . ConfigPathTestnet ) . ConfigureAwait ( false ) ;
93+ string fullConfig ;
94+ var localConfigSource = tonOptions . UseMainnet ? tonOptions . ConfigPathLocalMainnet : tonOptions . ConfigPathLocalTestnet ;
95+ if ( ! string . IsNullOrEmpty ( localConfigSource ) )
96+ {
97+ fullConfig = await File . ReadAllTextAsync ( localConfigSource ) ;
98+ logger . LogDebug ( "Used local config file: {Name}" , localConfigSource ) ;
99+ }
100+ else
101+ {
102+ var remoteConfigSource = tonOptions . UseMainnet ? tonOptions . ConfigPathMainnet : tonOptions . ConfigPathTestnet ;
103+ using var httpClient = new HttpClient ( ) ;
104+ fullConfig = await httpClient . GetStringAsync ( remoteConfigSource ) . ConfigureAwait ( false ) ;
105+ logger . LogDebug ( "Used internet config file: {Url}" , remoteConfigSource ) ;
106+ }
95107
96108 var jdoc = JsonNode . Parse ( fullConfig ) ;
97109 var servers = jdoc [ "liteservers" ] . AsArray ( ) ;
0 commit comments