gpt4 book ai didi

c# - 如何在 .Net 中读取 .ETL 文件?

转载 作者:行者123 更新时间:2023-11-30 15:07:54 25 4
gpt4 key购买 nike

如何在 .Net 中读取 .ETL 文件?我想在 ListView 中查看我的 etl 文件,但我无法解析文件的内容,因为它不是 ascii。

最佳答案

没关系,我使用各种谷歌搜索找到了它。我是这样做的:

    //Init
System.Diagnostics.Process worker = new System.Diagnostics.Process();
//Start logging
worker.StartInfo.FileName="logman";
worker.StartInfo.Arguments="start MyTcpipLog -p Microsoft-Windows-TCPIP -ets";
worker.Start();
worker.WaitForExit();
//Do nothing for 30 seconds
DateTime start = DateTime.Now;
while(DateTime.Now.Subtract(start).Seconds<5){}
//Stop logging
worker.StartInfo.FileName="logman";
worker.StartInfo.Arguments="stop MyTcpipLog -ets";
worker.Start();
worker.WaitForExit();
//Convert .etl to .csv
worker.StartInfo.FileName="tracerpt";
worker.StartInfo.Arguments = "\""+System.IO.Path.GetDirectoryName(Application.ExecutablePath)+"\\MyTcpipLog.etl\" -o \""+System.IO.Path.GetDirectoryName(Application.ExecutablePath)+"\\MyTcpipLog.csv\"";
worker.Start();
worker.WaitForExit();
//Load CSV into memory
// create reader & open file
System.IO.TextReader tr = new System.IO.StreamReader("MyTcpipLog.csv");
string data = tr.ReadToEnd();
tr.Close();
//Delete CSV
System.IO.File.Delete("MyTcpipLog.etl");
System.IO.File.Delete("MyTcpipLog.csv");

关于c# - 如何在 .Net 中读取 .ETL 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6164961/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com