private void button1_Click(object sender, EventArgs e) { r = new MpcHcRemote(@"C:\Program Files (x86)\Combined Community Codec Pack\MPC\mpc-hc.exe"); r.StartApplication(); }
private void Form1_Load(object sender, EventArgs e) { string MPHCPath = ""; bool foundMPHCPath = false; try { StreamReader inifile = new System.IO.StreamReader("config.ini"); string line; while ((line = inifile.ReadLine()) != null) { if(line.Contains("MediaPlayerHCPath")) { line = line.TrimStart(' '); line = line.Substring(17); line = line.TrimStart(' '); line = line.TrimEnd(' '); MPHCPath = String.Copy(line); foundMPHCPath = true; break; } } inifile.Close(); if (foundMPHCPath) { r = new MpcHcRemote(MPHCPath); r.StartApplication(); } else { textBox1.AppendText("Could not find definition for \"MediaPlayerHCPath\" in config.ini file"); } } catch (Exception ex) { textBox1.AppendText("Error: " + ex.Message.ToString() + "\r\n"); if (foundMPHCPath) { textBox1.AppendText("MediaPlayerHCPath: " + MPHCPath + "\r\n"); } } }