forked from fdorg/flashdevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileInspector.cs
More file actions
163 lines (133 loc) · 4.47 KB
/
Copy pathFileInspector.cs
File metadata and controls
163 lines (133 loc) · 4.47 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
using System.Collections;
using System.IO;
namespace PluginCore.Helpers
{
public class FileInspector
{
public static string[] ExecutableFileTypes = null;
public static bool IsActionScript(string path, string ext)
{
return ext == ".as";
}
public static bool IsFLA(string path, string ext)
{
return ext == ".fla";
}
public static bool IsActionScript(ICollection paths)
{
foreach (string path in paths)
{
if (!IsActionScript(path, Path.GetExtension(path).ToLower())) return false;
}
return true;
}
public static bool IsHaxeFile(string path, string ext)
{
return ext == ".hx" || ext == ".hxp";
}
public static bool IsMxml(string path, string ext)
{
return ext == ".mxml";
}
public static bool IsCss(string path, string ext)
{
return ext == ".css";
}
public static bool IsImage(string path, string ext)
{
return ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".gif";
}
public static bool IsSwf(string path, string ext)
{
return ext == ".swf";
}
public static bool IsSwc(string path)
{
return IsSwc(path, Path.GetExtension(path).ToLower());
}
public static bool IsSwc(string path, string ext)
{
return ext == ".swc" || ext == ".ane" || ext == ".jar";
}
public static bool IsFont(string path, string ext)
{
return ext == ".ttf" || ext == ".otf";
}
public static bool IsSound(string path, string ext)
{
return ext == ".mp3";
}
public static bool IsResource(string path, string ext)
{
return IsImage(path, ext) || IsSwf(path, ext) || IsFont(path, ext) || IsSound(path, ext);
}
public static bool IsResource(ICollection paths)
{
foreach (string path in paths)
{
if (!IsResource(path, Path.GetExtension(path).ToLower())) return false;
}
return true;
}
public static bool ShouldUseShellExecute(string path)
{
string ext = Path.GetExtension(path).ToLower();
if (ExecutableFileTypes != null)
foreach (string type in ExecutableFileTypes)
{
if (type == ext) return true;
}
return false;
}
public static bool IsHtml(string path, string ext)
{
return ext == ".html" || ext == ".htm" || ext == ".mtt"/*haxe templo*/;
}
public static bool IsXml(string path, string ext)
{
// allow for mxml, sxml, asml, etc
return (ext == ".xml" || (ext.Length == 5 && ext.EndsWith("ml")));
}
public static bool IsText(string path, string ext)
{
return ext == ".txt" || Path.GetFileName(path).StartsWith(".");
}
public static bool IsAS2Project(string path, string ext)
{
return ext == ".fdp" || ext == ".as2proj";
}
public static bool IsAS3Project(string path, string ext)
{
return ext == ".as3proj" || IsFlexBuilderProject(path);
}
public static bool IsFlexBuilderPackagedProject(string path)
{
string ext = Path.GetExtension(path).ToLower();
return ext == ".fxp" || ext == ".zip" || ext == ".fxpl";
}
public static bool IsFlexBuilderProject(string path)
{
return Path.GetFileName(path).ToLower() == ".actionscriptproperties";
}
public static bool IsHaxeProject(string path, string ext)
{
return ext == ".hxproj";
}
public static bool IsGenericProject(string path, string ext)
{
return ext == ".fdproj";
}
public static bool IsProject(string path)
{
return IsProject(path, Path.GetExtension(path).ToLower());
}
public static bool IsProject(string path, string ext)
{
return IsAS2Project(path, ext) || IsAS3Project(path, ext) || IsHaxeProject(path, ext) || IsGenericProject(path, ext);
}
public static bool IsTemplate(string path, string ext)
{
return ext == ".template";
}
}
}