-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
SetupHelper.cs
77 lines (65 loc) · 2.44 KB
/
SetupHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using Microsoft.VisualBasic.ApplicationServices;
using System;
using System.IO;
using System.Linq;
namespace ESPEDfGK
{
//*****************************************************************************************
internal class FileListGetter
{
//*****************************************************************************************
public string[] filelist(string path, string pattern)
{
try
{
return Directory.GetFiles(path, pattern, SearchOption.AllDirectories);
}
catch
{
return new string[0];
}
}
//*****************************************************************************************
public string[] filelistNewAtTop(string[] fl)
{
if (fl.Length > 1) // eine einfache suche, erstes element austauschen
{
int i = 0;
DateTime md = File.GetLastWriteTime(fl[0]);
for (int j = 1; j < fl.Length; j++)
{
DateTime nmd = File.GetLastWriteTime(fl[j]);
if (nmd > md)
{
i = j;
md = nmd;
}
}
if (i > 0)
{
string s = fl[0];
fl[0] = fl[i];
fl[i] = s;
}
}
return fl;
}
}
//*****************************************************************************************
internal class SetupHelper
{
//*****************************************************************************************
public string[] findAddr2LineExe()
{
string pArduino = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) +
Path.DirectorySeparatorChar + StringContent.arduino15;
string pPlatformIO = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) +
Path.DirectorySeparatorChar + StringContent.platformio;
FileListGetter flg = new();
string[] res = flg.filelist(pArduino, StringContent.xtensaaddr2line);
string[] resPIO = flg.filelist(pPlatformIO, StringContent.xtensaaddr2line);
res = res.Union(resPIO).ToArray();
return res;
}
}
}