1
- using System . IO . Compression ;
2
- using System . Numerics ;
1
+ using System . Numerics ;
3
2
using CodexContractsPlugin . ChainMonitor ;
4
3
using CodexContractsPlugin . Marketplace ;
5
4
using Logging ;
@@ -24,18 +23,16 @@ public Entry(DateTime utc, string msg)
24
23
private readonly ILog log ;
25
24
private readonly List < Entry > entries = new ( ) ;
26
25
private readonly string folder ;
27
- private readonly List < string > files = new ( ) ;
28
26
private readonly Input input ;
29
27
private readonly Config config ;
30
28
31
29
public Output ( ILog log , Input input , Config config )
32
30
{
33
- folder = Path . Combine ( Path . GetTempPath ( ) , Guid . NewGuid ( ) . ToString ( ) ) ;
31
+ folder = config . GetOuputFolder ( ) ;
34
32
Directory . CreateDirectory ( folder ) ;
35
33
36
34
var filename = Path . Combine ( folder , $ "contract_{ input . PurchaseId } ") ;
37
35
var fileLog = new FileLog ( filename ) ;
38
- files . Add ( fileLog . FullFilename + ".log" ) ;
39
36
foreach ( var pair in config . LogReplacements )
40
37
{
41
38
fileLog . AddStringReplace ( pair . Key , pair . Value ) ;
@@ -101,9 +98,14 @@ public void WriteContractEvents()
101
98
102
99
public LogFile CreateNodeLogTargetFile ( string node )
103
100
{
104
- var file = log . CreateSubfile ( node ) ;
105
- files . Add ( file . Filename ) ;
106
- return file ;
101
+ return log . CreateSubfile ( node ) ;
102
+ }
103
+
104
+ public void ShowOutputFiles ( ILog console )
105
+ {
106
+ console . Log ( "Files in output folder:" ) ;
107
+ var files = Directory . GetFiles ( folder ) ;
108
+ foreach ( var file in files ) console . Log ( file ) ;
107
109
}
108
110
109
111
private void Write ( Entry e )
@@ -116,16 +118,6 @@ private void LogReserveSlotCall(ReserveSlotFunction call)
116
118
Add ( call . Block . Utc , $ "Reserve-slot called. Index: { call . SlotIndex } Host: '{ call . FromAddress } '") ;
117
119
}
118
120
119
- public string Package ( )
120
- {
121
- var outputFolder = config . GetOuputFolder ( ) ;
122
- Directory . CreateDirectory ( outputFolder ) ;
123
- var filename = Path . Combine ( outputFolder , $ "contract_{ input . PurchaseId } .zip") ;
124
-
125
- ZipFile . CreateFromDirectory ( folder , filename ) ;
126
- return filename ;
127
- }
128
-
129
121
private void Add ( DateTime utc , string msg )
130
122
{
131
123
entries . Add ( new Entry ( utc , msg ) ) ;
0 commit comments