Skip to content

Commit 4b7976d

Browse files
committed
add file logging
1 parent 25c9605 commit 4b7976d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Castor/Castor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ApplicationIcon>castor-icon.ico</ApplicationIcon>
77
<Company>ZtModArchive</Company>
88
<Copyright>MIT License</Copyright>
9-
<Version>3.1.0</Version>
9+
<Version>3.2.0</Version>
1010
<PackageProjectUrl>https://github.com/ZtModArchive/Castor/tree/main/Castor</PackageProjectUrl>
1111
<PackageIcon>castor-icon.ico</PackageIcon>
1212
<PackageIconUrl />

Castor/Services/CommandService.cs

+8-4
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,16 @@ public void ConsoleCommand(string program, string arg)
194194
process.StartInfo.UseShellExecute = false;
195195
process.Start();
196196

197-
while (!process.StandardOutput.EndOfStream)
197+
using (StreamWriter writer = new StreamWriter("castorlog.txt"))
198198
{
199-
string line = process.StandardOutput.ReadLine();
200-
Console.WriteLine(line);
201-
// do something with line
199+
while (!process.StandardOutput.EndOfStream)
200+
{
201+
string line = process.StandardOutput.ReadLine();
202+
Console.WriteLine($"{line}");
203+
writer.WriteLine($"{line}");
204+
}
202205
}
206+
203207
process.WaitForExit();
204208
}
205209
}

0 commit comments

Comments
 (0)