Program.cs 885 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Net.Http;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace ConsoleApp1
  9. {
  10. internal class Program
  11. {
  12. static async Task Main(string[] args)
  13. {
  14. var dateName = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss");
  15. var fileName = dateName + "12345678" + ".csv";
  16. var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
  17. var exsit = File.Exists(filePath);
  18. using var streamWriter = new StreamWriter(filePath, false, Encoding.UTF8);
  19. if (!exsit)
  20. {
  21. await streamWriter.WriteAsync("barcode,test_result,uut_start,uut_stop,value,shift,head_id,line_id,station_id");
  22. await streamWriter.FlushAsync();
  23. }
  24. }
  25. }
  26. }