31 lines
970 B
C#
31 lines
970 B
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Tanshu.Accounts.Print
|
|
{
|
|
internal class ThermalPrinter
|
|
{
|
|
private static readonly bool _runningOnLinux;
|
|
internal static PlatformPrinter Printer;
|
|
static ThermalPrinter()
|
|
{
|
|
_runningOnLinux = RunningOnLinux();
|
|
Printer = _runningOnLinux ? (PlatformPrinter)new PrinterLinux() : new PrinterWindows();
|
|
}
|
|
|
|
internal static bool RunningOnLinux()
|
|
{
|
|
var platform = (int)Environment.OSVersion.Platform;
|
|
if ((platform == 4) || (platform == 6) || (platform == 128))
|
|
{
|
|
if (Environment.GetEnvironmentVariable("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null ||
|
|
Environment.GetEnvironmentVariable("MONO_MWF_MAC_FORCE_X11") != null)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|