public void InvokeRemoteCommand(int handle, PotPlayerAction action) { var remote = new PotPlayerRemote(new ProcessWindow() { Handle = (IntPtr)handle }); remote.DoAction(action); }
private void Form1_Load(object sender, EventArgs e) { string filePath1 = Application.StartupPath + "\\config.ini"; roomid = ReadIniData("settings", "roomid", "783827", filePath1); textBox2.Text = roomid; processes = Process.GetProcesses().Where(t => t.ProcessName.ToLower().Contains("ai")); process = Process.GetProcesses().FirstOrDefault(t => t.ProcessName.StartsWith("PotPlayerMini64", StringComparison.CurrentCultureIgnoreCase)); remote = new PotPlayerRemote(new ProcessWindow(process)); userlastDanmu = new Dictionary <int, DateTime>(); adminsset = new HashSet <string>(); string[] admins = new string[10000]; string filePath0 = Application.StartupPath + "\\admins.txt"; try { if (File.Exists(filePath0)) { admins = File.ReadAllLines(filePath0, Encoding.GetEncoding("GB2312")); //byte[] mybyte = Encoding.UTF8.GetBytes(textBox1.Text); //textBox1.Text = Encoding.UTF8.GetString(mybyte); foreach (string admin in admins) { adminsset.Add(admin); } } else { MessageBox.Show("文件不存在"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } //文件路径 string filePath = Application.StartupPath + "\\使用说明.txt"; try { if (File.Exists(filePath)) { textBox1.Text = File.ReadAllText(filePath, Encoding.GetEncoding("GB2312")); //byte[] mybyte = Encoding.UTF8.GetBytes(textBox1.Text); //textBox1.Text = Encoding.UTF8.GetString(mybyte); } else { MessageBox.Show("文件不存在"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public IEnumerable <ProcessWindow> GetProcessWindows() { return(PotPlayerRemote.GetProcessWindowsForApp()); }