NetOpenvpnGui zum laufen gebracht

This commit is contained in:
2011-01-27 10:19:41 +00:00
parent 973ac92433
commit 5b32a2a00e
10 changed files with 524 additions and 89 deletions
+1 -1
View File
@@ -28,7 +28,7 @@
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>E:\Programme\NetMonitor\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -3,4 +3,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<StartArguments>-r</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<StartArguments>-r</StartArguments>
</PropertyGroup>
</Project>
+39 -21
View File
@@ -31,15 +31,19 @@ namespace NetMonitorServer
if (par.Length != 3)
return;
this.serviceController.ServiceName = par[2];
this.serviceController.Start();
this.serviceController.WaitForStatus(System.ServiceProcess.ServiceControllerStatus.Running,new TimeSpan(0,0,10));
String ret;
try
{
this.serviceController.Start();
this.serviceController.WaitForStatus(System.ServiceProcess.ServiceControllerStatus.Running, new TimeSpan(0, 0, 30));
}
catch (Exception)
{
this.sendStr("false");
}
if (this.serviceController.Status == System.ServiceProcess.ServiceControllerStatus.Running)
ret = "true";
this.sendStr("true");
else
ret = "false";
byte[] answ = Encoding.UTF8.GetBytes(ret);
net_send.Send(answ, answ.Length, net_send_port);
this.sendStr("false");
}
private void setServiceStop(string data)
@@ -48,15 +52,19 @@ namespace NetMonitorServer
if (par.Length != 3)
return;
this.serviceController.ServiceName = par[2];
this.serviceController.Stop();
this.serviceController.WaitForStatus(System.ServiceProcess.ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 10));
String ret;
try
{
this.serviceController.Stop();
this.serviceController.WaitForStatus(System.ServiceProcess.ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 30));
}
catch (Exception)
{
this.sendStr("false");
}
if (this.serviceController.Status == System.ServiceProcess.ServiceControllerStatus.Stopped)
ret = "true";
this.sendStr("true");
else
ret = "false";
byte[] answ = Encoding.UTF8.GetBytes(ret);
net_send.Send(answ, answ.Length, net_send_port);
this.sendStr("false");
}
private void getServiceStatus(string data)
@@ -64,13 +72,23 @@ namespace NetMonitorServer
String[] par = data.Split(' ');
if (par.Length != 3)
return;
this.serviceController.ServiceName = par[2];
String ret;
if (this.serviceController.Status == System.ServiceProcess.ServiceControllerStatus.Running)
ret = "true";
else
ret = "false";
byte[] answ = Encoding.UTF8.GetBytes(ret);
try
{
this.serviceController.ServiceName = par[2];
if (this.serviceController.Status == System.ServiceProcess.ServiceControllerStatus.Running)
this.sendStr("true");
else
this.sendStr("false");
}
catch (Exception)
{
this.sendStr("false");
}
}
private void sendStr(string p)
{
byte[] answ = Encoding.UTF8.GetBytes(p);
net_send.Send(answ, answ.Length, net_send_port);
}
}