Simply3DScan
MainForm.cs
Go to the documentation of this file.
1 using System.IO;
2 using System.Linq;
3 using System.Windows.Forms;
4 
5 namespace ConvertFile
6 {
10  public sealed partial class MainForm : Form
11  {
12 
16  public MainForm()
17  {
18  this.AllowDrop = true;
19  this.InitializeComponent();
20  }
21 
27  private void MainForm_DragEnter(object sender, DragEventArgs e)
28  {
29  if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
30  }
31 
37  private void MainForm_DragDrop(object sender, DragEventArgs e)
38  {
39  string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
40  foreach (string file in files)
41  {
42  string[] importLines = File.ReadAllLines(file);
43 
44  string directory = Path.GetDirectoryName(file);
45  if (directory == null)
46  continue;
47 
48  string targetPath = Path.Combine(directory,
49  $"{Path.GetFileNameWithoutExtension(file)}_out{Path.GetExtension(file)}");
50 
51  File.WriteAllLines(targetPath, importLines.Select(line => line.Replace(' ', ',')).ToArray());
52  }
53  }
54  }
55 }
MainForm()
Initializes a new instance of the MainForm class.
Definition: MainForm.cs:16
converts all whitespaces in a file to comma
Definition: MainForm.cs:10