-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathLinux64NativeBundle.cs
executable file
·48 lines (39 loc) · 1.26 KB
/
Linux64NativeBundle.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
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace WkHtmlToXSharp
{
public class Linux64NativeBundle : INativeLibraryBundle
{
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
private static readonly string ResourcesPath = typeof(Linux64NativeBundle).Namespace + ".Libs.";
#region INativeLibraryBundle Members
public bool SupportsCurrentPlatform
{
get {
return Environment.OSVersion.Platform == PlatformID.Unix && WkHtmlToXLibrariesManager.RunningIn64Bits;
}
}
private void DeployLibrary(WkHtmlToXLibrariesManager manager, string resource)
{
var fileName = resource.Substring(ResourcesPath.Length);
using (var stream = Assembly.GetManifestResourceStream(resource))
{
manager.DeployLibrary(stream, fileName, File.GetLastWriteTime(Assembly.Location));
}
}
public void DeployBundle(WkHtmlToXLibrariesManager manager)
{
if (manager == null) throw new ArgumentNullException("manager");
var resourcesList = Assembly.GetManifestResourceNames();
foreach (var res in resourcesList)
{
if (res.StartsWith(ResourcesPath))
DeployLibrary(manager, res);
}
}
#endregion
}
}