Provides information about the runtime platform. It contains a set of properties that can be used to determine the operating system, architecture, and other runtime-specific information.
public static class Platform
class Platform:
using Leadtools;
private static string GetLibraryPath()
{
var currentDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string binFolderName = string.Empty;
var kernelName = string.Empty;
if (Platform.IsLinux)
{
binFolderName = Path.Combine("Lib", Platform.Is64Bit ? "x64" : "x86");
kernelName = "libltkrn.so";
}
else if (Platform.IsMacOS)
{
binFolderName = "Xcode/Frameworks/macOS/";
kernelName = "Leadtools.framework";
}
else
{
binFolderName = Path.Combine("CDLL", Platform.Is64Bit ? "x64" : "Win32");
kernelName = Platform.Is64Bit ? "LtKrnx.dll" : "LtKrnu.dll";
}
const int levels = 10;
for (var i = 0; i < levels; i++)
{
currentDir = Path.Combine(currentDir, "..");
var path = Path.GetFullPath(Path.Combine(currentDir, "Bin", binFolderName, kernelName));
if (Platform.IsMacOS && Directory.Exists(path) || File.Exists(path))
return Path.GetDirectoryName(path);
}
throw new DllNotFoundException(kernelName);
}
public static void InitRuntime(string path)
{
if (string.IsNullOrEmpty(path))
Platform.LibraryPath = Path.GetFullPath(GetLibraryPath());
else
Platform.LibraryPath = path;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document