internal TwainConfig(PlatformID platform, bool is32Bit) { Platform = platform; Is32Bit = is32Bit; // initial default until twain entry is available switch (platform) { case PlatformID.Win32NT: _defaultMemoryManager = new WinMemoryManager(); break; default: _defaultMemoryManager = new MarshalMemoryManager(); break; } }
PlatformInfo() { IsApp64Bit = IntPtr.Size == 8; IsOnMono = Type.GetType("Mono.Runtime") != null; IsWindows = Environment.OSVersion.Platform == PlatformID.Win32NT; IsLinux = Environment.OSVersion.Platform == PlatformID.Unix; _defaultLog = new TraceLog(); if (IsWindows) { _defaultMemManager = new WinMemoryManager(); // only the new twaindsm can be loaded outside of windows folder, twain_32 can't newDsmPath = GetFirstFilePathThatExists(Dsm.WIN_NEW_DSM_NAME, // should be same order as dllimport search order GetExeFolder(), AppDomain.CurrentDomain.BaseDirectory, Environment.SystemDirectory, GetWindowsFolder(), Environment.CurrentDirectory) ?? Path.Combine(Environment.SystemDirectory, Dsm.WIN_NEW_DSM_NAME); oldDsmPath = Path.Combine(GetWindowsFolder(), Dsm.WIN_OLD_DSM_NAME); PreferNewDSM = true; } else if (IsLinux) { _defaultMemManager = new LinuxMemoryManager(); ExpectedDsmPath = Dsm.LINUX_DSM_PATH; DsmExists = File.Exists(ExpectedDsmPath); IsSupported = DsmExists && IsOnMono; } else { // mac? not gonna happen } }