forked from Trevor3000/RemoteControl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRSCApplication.cs
More file actions
92 lines (77 loc) · 3.1 KB
/
RSCApplication.cs
File metadata and controls
92 lines (77 loc) · 3.1 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
namespace RemoteControl.Server
{
internal class RSCApplication
{
public static List<string> lstSkins = new List<string>();
public static RemoteControlServer oRemoteControlServer = null;
public static string GetPath(ePathType pathType)
{
string sPath = string.Empty;
switch (pathType)
{
case ePathType.APP:
sPath = Application.ExecutablePath;
break;
case ePathType.APP_DIR:
sPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\";
break;
case ePathType.SKINS_DIR:
sPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\Skins\\";
break;
case ePathType.AVATAR_DIR:
sPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\Avatars\\";
break;
case ePathType.TOOL_DIR:
sPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\Tools\\";
break;
}
return sPath;
}
public static List<string> GetAllSkinFiles()
{
List<string> lstSkinFiles = new List<string>();
string sSkinPath = GetPath(ePathType.SKINS_DIR);
if (!System.IO.Directory.Exists(sSkinPath))
return lstSkinFiles;
string[] arrDirecotry = System.IO.Directory.GetDirectories(sSkinPath);
for (int i = 0; i < arrDirecotry.Length; i++)
{
string sDirectory = arrDirecotry[i];
// searchPattern,可以使用*或?字符进行模糊搜索,如果不使用则为精确搜索
string[] arrFile = System.IO.Directory.GetFiles(sDirectory, "*.ssk");
lstSkinFiles.AddRange(arrFile);
}
return lstSkinFiles;
}
public static List<string> GetAllAvatarFiles()
{
List<string> files = new List<string>();
string path = GetPath(ePathType.AVATAR_DIR);
if (!System.IO.Directory.Exists(path))
return files;
files.AddRange(System.IO.Directory.GetFiles(path));
return files;
}
public static List<string> GetAllTools()
{
List<string> files = new List<string>();
string path = GetPath(ePathType.TOOL_DIR);
if (!System.IO.Directory.Exists(path))
return files;
files.AddRange(System.IO.Directory.GetFiles(path, "*.exe"));
return files;
}
public static List<string> GetLocalIPV4s()
{
IPAddress[] ips = Dns.GetHostAddresses(Dns.GetHostName());
return ips.ToList().FindAll(m => m.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).Select(s => s.ToString()).ToList();
}
}
}