File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
src/Infrastructure/HydraScript.Infrastructure/Dumping Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 1+ using System . IO . Abstractions ;
2+ using Cysharp . Text ;
3+ using Microsoft . Extensions . Options ;
4+
15namespace HydraScript . Infrastructure . Dumping ;
26
37public interface IDumpingService
48{
5- void Dump ( string content , string fileExtension ) ;
9+ void Dump ( string ? contents , string fileExtension ) ;
610}
711
8- internal sealed class DumpingService : IDumpingService
12+ internal sealed class DumpingService (
13+ IFileSystem fileSystem ,
14+ IOptions < FileInfo > fileInfo ) : IDumpingService
915{
10- public void Dump ( string content , string fileExtension )
16+ public void Dump ( string ? contents , string fileExtension )
1117 {
12- throw new NotImplementedException ( ) ;
18+ var fileNameWithExtension = fileInfo . Value . Name ;
19+ var originalFileExtension = fileInfo . Value . Extension ;
20+ var fileName = fileNameWithExtension . Replace ( originalFileExtension , string . Empty ) ;
21+ var path = Path . Combine (
22+ fileInfo . Value . DirectoryName ?? string . Empty ,
23+ ZString . Concat ( fileName , "." , fileExtension ) ) ;
24+ fileSystem . File . WriteAllText ( path , contents ) ;
1325 }
1426}
You can’t perform that action at this time.
0 commit comments