public static bool isInTerminalServerSession() { // If Current Session = Console Session return false; if (ProcessClass.GetConsoleSessionId().ToString() == Process.GetCurrentProcess().SessionId.ToString()) { return(false); } // If Current Session if (!ProcessClass.isTerminalServerInstalled()) { return(false); } if (isInCitrixSession()) { return(true); } if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "rdp.ini")) { return(true); } return(System.Windows.Forms.SystemInformation.TerminalServerSession); }
public static string[] getCommPortSearchList(string settingPorts) { string[] serialPorts; serialPorts = SerialPort.GetPortNames(); List <string> portList = new List <string>(); List <string> portListSorted = new List <string>(); if (settingPorts != null && settingPorts != "" && settingPorts.IndexOf(":") >= 0) { // Override Windows Ports. foreach (string myPort in serialPorts) { if (settingPorts.IndexOf(myPort + ":") >= 0) { portList.Add(myPort); } } //serialPorts = portList.ToArray(); } else { portList.AddRange(serialPorts); } /* Sort comports in integer order from COM1 to COM255 */ /* Must be a better way to do this */ if (portList.Count() > 0) { for (int i = 0; i < 255; i++) { if (portList.IndexOf("COM" + i.ToString()) >= 0) { portListSorted.Add("COM" + i.ToString()); } } } // TODO. If Terminal Simulator APplication installed, only then add COMX to search list if (ProcessClass.isSimulatorInstalled()) { portListSorted.Insert(0, "COMX"); } serialPorts = portListSorted.ToArray(); return(serialPorts); }
/// <summary> /// Path to where application should be stored. Hardcoded for HICAPSConnect, but should come off assembly variables /// </summary> /// <returns></returns> private string getCachePath() { return(ProcessClass.getUserConfigPath() + Path.DirectorySeparatorChar + DatabaseName + ".hcd"); }