Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnConnect_Click(object sender, EventArgs e)
- {
- //using (var fileStream = new FileStream(logpath, FileMode.Open, FileAccess.Write, FileShare.Read))
- var proc = new Process
- {
- StartInfo = new ProcessStartInfo
- {
- FileName = Application.StartupPath + "\\bin\\openvpn.exe",
- Arguments = "--config .\\bin\\vpnconfig.ovpn http-proxy 127.0.0.1 8000 --log logfile.txt",
- UseShellExecute = false,
- CreateNoWindow = true
- }
- };
- proc.Start();
- ShowLog();
- }
- private void ShowLog()
- {
- using (var fileStream = new FileStream(logpath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
- using (TextReader reader = new StreamReader(fileStream))
- {
- rtbLog.Text = "";
- string line = reader.ReadLine();
- while (line != null)
- {
- rtbLog.AppendText(line + '\n');
- rtbLog.ScrollToCaret();
- Thread.Sleep(3000);
- line = reader.ReadLine();
- }
- reader.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement