/// <summary> /// Creates a new instance of <see cref="ShellProxy" />. /// </summary> /// <param name="knimeDir">The path to the KNIME executable. If left empty KNIME will be called without absolute path to the executable and must therefore be known in the PATH.</param> /// <exception cref="DirectoryNotFoundException">Invalid KNIME directory</exception> /// <exception cref="NotImplementedException">Could not determine operating system type</exception> /// <exception cref="ArgumentOutOfRangeException"></exception> /// <exception cref="FileNotFoundException">The KNIME executable could not be found</exception> /// <exception cref="DirectoryNotFoundException"></exception> public ShellProxy(string knimeDir = null) { if (knimeDir != null) { if (!knimeDir.EndsWith(Path.DirectorySeparatorChar.ToString())) { knimeDir += Path.DirectorySeparatorChar; } if (!Directory.Exists(knimeDir)) { throw new DirectoryNotFoundException("Invalid KNIME directory"); } } _knimeDir = knimeDir; switch (OperatingSystem.GetOsType()) { case OsType.Mac: _knimeApp = "knime.app/Contents/MacOS/knime"; break; case OsType.Windows: _knimeApp = "knime.exe"; break; case OsType.X11: _knimeApp = "knime"; break; case OsType.Other: throw new NotImplementedException("Could not determine operating system type"); default: throw new ArgumentOutOfRangeException(); } /* Empty dir means using path so skip checking file existance. */ if (_knimeDir != null && !File.Exists(_knimeDir + _knimeApp)) { throw new FileNotFoundException("The KNIME executable could not be found"); } }
/// <summary> /// Creates a new <see cref="ArgumentBag" /> with default properties. /// </summary> /// <exception cref="NotImplementedException">The operating system is not supported.</exception> /// <exception cref="ArgumentOutOfRangeException"></exception> public ArgumentBag() { /* Set OS specific must haves */ switch (OperatingSystem.GetOsType()) { case OsType.Mac: NoSplash = true; break; case OsType.Windows: NoSplash = true; break; case OsType.X11: NoSplash = true; break; case OsType.Other: throw new NotImplementedException("The operating system is not supported."); default: throw new ArgumentOutOfRangeException(); } }