我想创建一个log4net RollingFileAppender,每次程序启动时都会创建一个新文件.如果文件变大,它可以滚动,但每次启动应用程序时都必须滚动.如果在配置中配置了另一个appender,则不应添加appender.实质上,创建可以通过更改配置文件来覆盖的默认日志配置.
我正在尝试做一些似乎超出 System.Diagnostics.Process 对象范围的事情。可接受的答案可以提出不同的方法,只要它使用 .net 4.5/c#5。
我的程序正在调用 gdalwarp.exe 对大型 tiff 文件执行长时间运行的进程。Galwarp.exe 以这种格式输出。
Creating output file that is 6014P x 4988L.
Processing input file [FileName].tiff.
Using band 4 of source image as alpha.
Using band 4 of destination image as alpha.
0...10...20...30...40...50...60...70...80...90...100 - done.
Run Code Online (Sandbox Code Playgroud)
最后一行缓慢流入以指示进展。我想在它发生变化时阅读该行,以便我可以移动进度条以通知用户。
首先,我尝试读取,Process.StandardOutput但在整个过程完成之前它不会提供任何数据。其次,我尝试调用Process.BeginOutputReadLine()并连接该事件,Process.OutputDataReceived但它仅在线路完成时触发。
这是对 Execute GDalWarp.exe 的调用。
public static void ResizeTiff(string SourceFile, string DestinationFile, float ResolutionWidth, float ResolutionHeight, Guid ProcessId)
{
var directory = GDalBin;
var exe = Path.Combine(directory, "gdalwarp.exe");
var args = …Run Code Online (Sandbox Code Playgroud)