netmonitor/NetMonitorClient/ServiceControl.cs

55 lines
1.5 KiB
C#
Raw Normal View History

2010-04-16 11:51:46 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
2010-04-26 12:46:03 +02:00
using System.ServiceProcess;
using System.Net.Sockets;
using System.Net;
2010-04-16 11:51:46 +02:00
2010-04-21 13:48:40 +02:00
namespace NetMonitorClient
2010-04-16 11:51:46 +02:00
{
class ServiceControl
{
2010-04-26 12:46:03 +02:00
private UdpClient client;
private IPEndPoint rep; //remoteEndPoint
public ServiceControl(string name)
2010-04-16 11:51:46 +02:00
{
2010-04-26 12:46:03 +02:00
ServiceController sc = new ServiceController();
sc.ServiceName = name;
//if (sc.Status != ServiceControllerStatus.Running)
//{
// sc.Start();
//}
this.client = new UdpClient();
this.rep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 34523);
2010-04-16 11:51:46 +02:00
}
internal void setNetworkAuto(string networkcard)
2010-04-16 11:51:46 +02:00
{
if (networkcard == null)
{
System.Windows.Forms.MessageBox.Show("Adapter ist not Set!");
return;
}
byte[] data = Encoding.UTF8.GetBytes("NET AUTO "+networkcard);
2010-04-26 12:46:03 +02:00
this.client.Send(data, data.Length, this.rep);
//throw new NotImplementedException();
2010-04-16 11:51:46 +02:00
}
internal void setNetworkIp(string ip, string subnet, string gateway)
{
throw new NotImplementedException();
}
internal void setNetworkDNS(string dns)
{
throw new NotImplementedException();
}
internal void setNetworkWINS(string wins)
{
throw new NotImplementedException();
}
}
}