@@ -46,10 +46,10 @@ private static AbsolutePath GetConfigsFolderPath(IFileSystem fileSystem)
4646 return fileSystem . GetKnownPath ( baseKnownPath ) . Combine ( baseDirectoryName ) ;
4747 }
4848
49- private AbsolutePath GetConfigPath < T > ( )
49+ private AbsolutePath GetConfigPath < T > ( string ? key )
5050 {
5151 var typeName = typeof ( T ) . FullName ?? typeof ( T ) . Name ;
52- var fileName = $ "{ typeName } .json";
52+ var fileName = string . IsNullOrWhiteSpace ( key ) ? $ "{ typeName } .json" : $ " { typeName } _ { key } .json";
5353 return _configDirectory . Combine ( fileName ) ;
5454 }
5555
@@ -80,17 +80,17 @@ private void Serialize<T>(Stream stream ,T value) where T : class
8080 }
8181
8282 /// <inheritdoc/>
83- public void Save < T > ( T value ) where T : class , ISettings , new ( )
83+ public void Save < T > ( T value , string ? key ) where T : class , ISettings , new ( )
8484 {
85- var configPath = GetConfigPath < T > ( ) ;
85+ var configPath = GetConfigPath < T > ( key ) ;
8686 using var stream = configPath . Open ( FileMode . Create , FileAccess . ReadWrite , FileShare . None ) ;
8787 Serialize ( stream , value ) ;
8888 }
8989
9090 /// <inheritdoc/>
91- public T ? Load < T > ( ) where T : class , ISettings , new ( )
91+ public T ? Load < T > ( string ? key ) where T : class , ISettings , new ( )
9292 {
93- var configPath = GetConfigPath < T > ( ) ;
93+ var configPath = GetConfigPath < T > ( key ) ;
9494 if ( ! configPath . FileExists ) return null ;
9595
9696 using var stream = configPath . Open ( FileMode . Open , FileAccess . Read , FileShare . Read ) ;
0 commit comments