-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathEmbeddedResources.cs
67 lines (58 loc) · 2.09 KB
/
EmbeddedResources.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
using Microsoft.Extensions.FileProviders;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using System.Reflection;
namespace Tiled2Dmap.CLI
{
internal static class EmbeddedResources
{
private static Image<Rgba32> getImage(string imageName)
{
var provider = new EmbeddedFileProvider(Assembly.GetExecutingAssembly());
var file = provider.GetFileInfo(imageName);
return Image.Load<Rgba32>(file.CreateReadStream());
}
private static Image<Rgba32> access = null;
internal static Image<Rgba32> Access()
{
if (access == null)
access = getImage("Resources/access.png");
return access.Clone();
}
private static Image<Rgba32> diamond128 = null;
internal static Image<Rgba32> Diamond128()
{
if (diamond128 == null)
diamond128 = getImage("Resources/diamond_128x64.png");
return diamond128.Clone();
}
private static Image<Rgba32> diamond256 = null;
internal static Image<Rgba32> Diamond256()
{
if (diamond256 == null)
diamond256 = getImage("Resources/diamond_256x128.png");
return diamond256.Clone();
}
private static Image<Rgba32> portal128 = null;
internal static Image<Rgba32> Portal128()
{
if (portal128 == null)
portal128 = getImage("Resources/exit_128x64.png");
return portal128.Clone();
}
private static Image<Rgba32> fontNegative = null;
internal static Image<Rgba32> FontNegative()
{
if (fontNegative == null)
fontNegative = getImage("Resources/font_neg.png");
return fontNegative.Clone();
}
private static Image<Rgba32> fontNumbers = null;
internal static Image<Rgba32> FontNumbers()
{
if (fontNumbers == null)
fontNumbers = getImage("Resources/pixel_font.png");
return fontNumbers.Clone();
}
}
}