TestForm.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Oreo.NetMonitor.Commons;
  2. using System;
  3. using System.Diagnostics;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. using Y.Utils.NetUtils.NetInfoUtils;
  8. namespace Oreo.NetMonitor.Views
  9. {
  10. public partial class TestForm : Form
  11. {
  12. NetflowTool nft = new NetflowTool();
  13. public TestForm()
  14. {
  15. InitializeComponent();
  16. }
  17. private void TestForm_Load(object sender, EventArgs e)
  18. {
  19. PerformanceCounterCategory performanceCounterCategory = new PerformanceCounterCategory("Network Interface");
  20. string[] instances = performanceCounterCategory.GetInstanceNames();
  21. var info = NetcardInfoTool.GetNetworkCardInfo();
  22. Task.Factory.StartNew(() =>
  23. {
  24. nft.InitNetcard("Intel[R] Dual Band Wireless-AC 3165");//Intel(R) Dual Band Wireless-AC 3165
  25. nft.InitSettings(1000, 1000);
  26. nft.StartDataMonitor();
  27. while (true)
  28. {
  29. R.Log.v("upload data: " + nft.UploadData + " download data: " + nft.DownloadData);
  30. Thread.Sleep(1000);
  31. }
  32. });
  33. //var a = NetProcessTool.GetTcpConn();
  34. //var b = NetProcessTool.GetUdpConn();
  35. }
  36. }
  37. }