mirror of
https://github.com/Ylianst/MeshCentralRouter
synced 2025-12-23 11:43:20 +00:00
Fixed custom apps.
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MeshCentralRouter
|
||||
{
|
||||
@@ -23,7 +18,17 @@ namespace MeshCentralRouter
|
||||
|
||||
private void CustomAppsForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (apps != null) { foreach (string[] app in apps) { mainListView.Items.Add(new ListViewItem(app)); } }
|
||||
if (apps != null) {
|
||||
foreach (string[] app in apps) {
|
||||
string[] x = new string[5];
|
||||
x[0] = app[0];
|
||||
x[1] = app[1];
|
||||
x[2] = "\"" + app[2] + "\" " + app[3];
|
||||
x[3] = app[2];
|
||||
x[4] = app[3];
|
||||
mainListView.Items.Add(new ListViewItem(x));
|
||||
}
|
||||
}
|
||||
UpdateInfo();
|
||||
}
|
||||
|
||||
@@ -32,10 +37,11 @@ namespace MeshCentralRouter
|
||||
List<string[]> r = new List<string[]>();
|
||||
foreach (ListViewItem l in mainListView.Items)
|
||||
{
|
||||
string[] x = new string[3];
|
||||
string[] x = new string[4];
|
||||
x[0] = l.SubItems[0].Text;
|
||||
x[1] = l.SubItems[1].Text.ToLower();
|
||||
x[2] = l.SubItems[2].Text;
|
||||
x[2] = l.SubItems[3].Text;
|
||||
x[3] = l.SubItems[4].Text;
|
||||
r.Add(x);
|
||||
}
|
||||
return r;
|
||||
@@ -52,10 +58,12 @@ namespace MeshCentralRouter
|
||||
foreach (ListViewItem l in list) { mainListView.Items.Remove(l); }
|
||||
|
||||
// Add the new protocol
|
||||
string[] x = new string[3];
|
||||
string[] x = new string[5];
|
||||
x[0] = f.appName;
|
||||
x[1] = f.appProtocol.ToLower();
|
||||
x[2] = f.appCommand;
|
||||
x[2] = "\"" + f.appCommand + "\" " + f.appArgs;
|
||||
x[3] = f.appCommand;
|
||||
x[4] = f.appArgs;
|
||||
mainListView.Items.Add(new ListViewItem(x));
|
||||
}
|
||||
}
|
||||
@@ -99,8 +107,8 @@ namespace MeshCentralRouter
|
||||
{
|
||||
if (mainListView.SelectedItems.Count != 1) return;
|
||||
ListViewItem i = mainListView.SelectedItems[0];
|
||||
CustomAppsRunForm f = new CustomAppsRunForm(i.SubItems[2].Text);
|
||||
if (f.ShowDialog(this) == DialogResult.OK) { Process.Start(f.getFinalCommand()); }
|
||||
CustomAppsRunForm f = new CustomAppsRunForm(i.SubItems[3].Text, i.SubItems[4].Text);
|
||||
if (f.ShowDialog(this) == DialogResult.OK) { Process.Start(i.SubItems[3].Text, f.getFinalArgs()); }
|
||||
}
|
||||
|
||||
private void editToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@@ -110,7 +118,8 @@ namespace MeshCentralRouter
|
||||
CustomAppsAddForm f = new CustomAppsAddForm();
|
||||
f.appName = i.SubItems[0].Text;
|
||||
f.appProtocol = i.SubItems[1].Text;
|
||||
f.appCommand = i.SubItems[2].Text;
|
||||
f.appCommand = i.SubItems[3].Text;
|
||||
f.appArgs = i.SubItems[4].Text;
|
||||
if (f.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
// Remove any matching protocol
|
||||
@@ -119,13 +128,14 @@ namespace MeshCentralRouter
|
||||
foreach (ListViewItem l in list) { mainListView.Items.Remove(l); }
|
||||
|
||||
// Add the new protocol
|
||||
string[] x = new string[3];
|
||||
string[] x = new string[5];
|
||||
x[0] = f.appName;
|
||||
x[1] = f.appProtocol.ToLower();
|
||||
x[2] = f.appCommand;
|
||||
x[2] = "\"" + f.appCommand + "\" " + f.appArgs;
|
||||
x[3] = f.appCommand;
|
||||
x[4] = f.appArgs;
|
||||
mainListView.Items.Add(new ListViewItem(x));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user