|
|
@ -12,6 +12,8 @@ namespace network.loki.lokinet.win32.ui
|
|
|
|
public static Process lokiNetDaemon = new Process();
|
|
|
|
public static Process lokiNetDaemon = new Process();
|
|
|
|
public static bool isConnected;
|
|
|
|
public static bool isConnected;
|
|
|
|
public static string logText;
|
|
|
|
public static string logText;
|
|
|
|
|
|
|
|
private string config_path;
|
|
|
|
|
|
|
|
private LogDumper ld;
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateUI(string text)
|
|
|
|
void UpdateUI(string text)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -21,6 +23,10 @@ namespace network.loki.lokinet.win32.ui
|
|
|
|
public main_frame()
|
|
|
|
public main_frame()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
if (Program.platform == PlatformID.Win32NT)
|
|
|
|
|
|
|
|
config_path = Environment.ExpandEnvironmentVariables("%APPDATA%\\.lokinet");
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
config_path = Environment.ExpandEnvironmentVariables("%HOME%/.lokinet");
|
|
|
|
StatusLabel.Text = "Disconnected";
|
|
|
|
StatusLabel.Text = "Disconnected";
|
|
|
|
var build = ((AssemblyInformationalVersionAttribute)Assembly
|
|
|
|
var build = ((AssemblyInformationalVersionAttribute)Assembly
|
|
|
|
.GetAssembly(typeof(main_frame))
|
|
|
|
.GetAssembly(typeof(main_frame))
|
|
|
@ -63,10 +69,13 @@ namespace network.loki.lokinet.win32.ui
|
|
|
|
lokiNetDaemon.Start();
|
|
|
|
lokiNetDaemon.Start();
|
|
|
|
lokiNetDaemon.BeginOutputReadLine();
|
|
|
|
lokiNetDaemon.BeginOutputReadLine();
|
|
|
|
btnConnect.Enabled = false;
|
|
|
|
btnConnect.Enabled = false;
|
|
|
|
|
|
|
|
TrayConnect.Enabled = false;
|
|
|
|
StatusLabel.Text = "Connected";
|
|
|
|
StatusLabel.Text = "Connected";
|
|
|
|
isConnected = true;
|
|
|
|
isConnected = true;
|
|
|
|
NotificationTrayIcon.Text = "LokiNET - connected";
|
|
|
|
NotificationTrayIcon.Text = "LokiNET - connected";
|
|
|
|
btnDrop.Enabled = true;
|
|
|
|
btnDrop.Enabled = true;
|
|
|
|
|
|
|
|
TrayDisconnect.Enabled = true;
|
|
|
|
|
|
|
|
NotificationTrayIcon.ShowBalloonTip(5, "LokiNET", "Connected to network.", ToolTipIcon.Info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnDrop_Click(object sender, EventArgs e)
|
|
|
|
private void btnDrop_Click(object sender, EventArgs e)
|
|
|
@ -74,12 +83,16 @@ namespace network.loki.lokinet.win32.ui
|
|
|
|
lokiNetDaemon.CancelOutputRead();
|
|
|
|
lokiNetDaemon.CancelOutputRead();
|
|
|
|
lokiNetDaemon.Kill();
|
|
|
|
lokiNetDaemon.Kill();
|
|
|
|
btnConnect.Enabled = true;
|
|
|
|
btnConnect.Enabled = true;
|
|
|
|
|
|
|
|
TrayConnect.Enabled = true;
|
|
|
|
btnDrop.Enabled = false;
|
|
|
|
btnDrop.Enabled = false;
|
|
|
|
|
|
|
|
TrayDisconnect.Enabled = false;
|
|
|
|
StatusLabel.Text = "Disconnected";
|
|
|
|
StatusLabel.Text = "Disconnected";
|
|
|
|
NotificationTrayIcon.Text = "LokiNET - disconnected";
|
|
|
|
NotificationTrayIcon.Text = "LokiNET - disconnected";
|
|
|
|
isConnected = false;
|
|
|
|
isConnected = false;
|
|
|
|
logText = lokinetd_fd1.Text;
|
|
|
|
logText = lokinetd_fd1.Text;
|
|
|
|
lokinetd_fd1.Text = string.Empty;
|
|
|
|
lokinetd_fd1.Text = string.Empty;
|
|
|
|
|
|
|
|
NotificationTrayIcon.ShowBalloonTip(5, "LokiNET", "Disconnected from network.", ToolTipIcon.Info);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void lokinetd_fd1_TextChanged(object sender, EventArgs e)
|
|
|
|
private void lokinetd_fd1_TextChanged(object sender, EventArgs e)
|
|
|
@ -97,15 +110,67 @@ namespace network.loki.lokinet.win32.ui
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void NotificationTrayIcon_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
|
|
private void NotificationTrayIcon_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!Visible)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Show();
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnAbout_Click(object sender, EventArgs e)
|
|
|
|
private void btnAbout_Click(object sender, EventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
AboutBox a = new AboutBox();
|
|
|
|
|
|
|
|
a.ShowDialog(this);
|
|
|
|
|
|
|
|
a.Dispose();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void saveLogToFileToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (isConnected)
|
|
|
|
|
|
|
|
MessageBox.Show("Cannot dump log when client is running.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (logText == string.Empty)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox.Show("Log is empty", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ld == null)
|
|
|
|
|
|
|
|
ld = new LogDumper(logText);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
ld.setText(logText);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ld.CreateLog(config_path);
|
|
|
|
|
|
|
|
MessageBox.Show(string.Format("Wrote log to {0}, previous log rotated", ld.getLogPath()), "LokiNET", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
|
|
|
logText = string.Empty;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AboutBox a = new AboutBox();
|
|
|
|
AboutBox a = new AboutBox();
|
|
|
|
a.ShowDialog();
|
|
|
|
a.ShowDialog();
|
|
|
|
a.Dispose();
|
|
|
|
a.Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Application.Exit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void TrayDisconnect_Click(object sender, EventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
btnDrop_Click(sender, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void TrayConnect_Click(object sender, EventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
btnConnect_Click(sender, e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void showToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Show();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|