From 475a235837a53787e86f5d0c5668fb4b5edfedcc Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Thu, 15 Jul 2010 00:41:08 +0000 Subject: [PATCH] Konsolenversion --- NetMonitor.sln | 12 ++ NetMonitorClient/EditNetworks.cs | 25 ++- NetMonitorClient/Form1.Designer.cs | 19 +- NetMonitorClient/Form1.cs | 46 +---- NetMonitorClient/InIReader.cs | 2 +- NetMonitorClient/NetMonitorClient.csproj | 3 +- NetMonitorClient/Networks.cs | 87 --------- NetMonitorClient/Networksetter.cs | 177 +++++++++++++++++++ NetMonitorClient/ServiceControl.cs | 2 +- NetMonitorConsole/CMDArgs.cs | 43 +++++ NetMonitorConsole/NetMonitorConsole.csproj | 64 +++++++ NetMonitorConsole/Program.cs | 38 ++++ NetMonitorConsole/Properties/AssemblyInfo.cs | 36 ++++ 13 files changed, 417 insertions(+), 137 deletions(-) create mode 100644 NetMonitorClient/Networksetter.cs create mode 100644 NetMonitorConsole/CMDArgs.cs create mode 100644 NetMonitorConsole/NetMonitorConsole.csproj create mode 100644 NetMonitorConsole/Program.cs create mode 100644 NetMonitorConsole/Properties/AssemblyInfo.cs diff --git a/NetMonitor.sln b/NetMonitor.sln index acf1104..9868af3 100644 --- a/NetMonitor.sln +++ b/NetMonitor.sln @@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetMonitorClient", "NetMoni EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetMonitorServer", "NetMonitorServer\NetMonitorServer.csproj", "{7813196F-D729-44A2-81C7-82BB83E207F5}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetMonitorConsole", "NetMonitorConsole\NetMonitorConsole.csproj", "{148AA47C-FA4D-4807-9EB0-5AEAC36C1524}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -35,6 +37,16 @@ Global {7813196F-D729-44A2-81C7-82BB83E207F5}.Release|Mixed Platforms.Build.0 = Release|x86 {7813196F-D729-44A2-81C7-82BB83E207F5}.Release|x86.ActiveCfg = Release|x86 {7813196F-D729-44A2-81C7-82BB83E207F5}.Release|x86.Build.0 = Release|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Debug|Any CPU.ActiveCfg = Debug|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Debug|x86.ActiveCfg = Debug|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Debug|x86.Build.0 = Debug|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Release|Any CPU.ActiveCfg = Release|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Release|Mixed Platforms.Build.0 = Release|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Release|x86.ActiveCfg = Release|x86 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NetMonitorClient/EditNetworks.cs b/NetMonitorClient/EditNetworks.cs index 8af9533..0ac0433 100644 --- a/NetMonitorClient/EditNetworks.cs +++ b/NetMonitorClient/EditNetworks.cs @@ -14,7 +14,8 @@ namespace NetMonitorClient { public enum Options { - Show + Show, + Edit } internal enum RWFlag { @@ -35,6 +36,10 @@ namespace NetMonitorClient { this.acess = RWFlag.Read; } + if (option == Options.Edit) + { + this.acess = RWFlag.Write; + } InitializeComponent(); ReadNetworksSettings(); SetRWSettings(); @@ -60,6 +65,24 @@ namespace NetMonitorClient this.RadioWinsAuto.Enabled = false; this.RadioWinsManu.Enabled = false; } + if (this.acess == RWFlag.Write) + { + this.BoxDns.ReadOnly = false; + this.BoxGateway.ReadOnly = false; + this.BoxIpAdresse.ReadOnly = false; + this.BoxName.ReadOnly = false; + this.BoxSubnet.ReadOnly = false; + this.BoxWins.ReadOnly = false; + this.Text = "Netzwerke Ändern"; + this.RadioAllAuto.Enabled = true; + this.RadioAllManu.Enabled = true; + this.RadioDnsAuto.Enabled = true; + this.RadioDnsManu.Enabled = true; + this.RadioIpAuto.Enabled = true; + this.RadioIpManu.Enabled = true; + this.RadioWinsAuto.Enabled = true; + this.RadioWinsManu.Enabled = true; + } } private void ReadNetworksSettings() diff --git a/NetMonitorClient/Form1.Designer.cs b/NetMonitorClient/Form1.Designer.cs index 8d4cb68..91e8823 100644 --- a/NetMonitorClient/Form1.Designer.cs +++ b/NetMonitorClient/Form1.Designer.cs @@ -83,21 +83,22 @@ this.ProgramMenuDateiNetzwerkeAnsehen, this.ProgramMenuDateiNetzwerkeBearbeiten}); this.ProgramMenuDateiNetzwerke.Name = "ProgramMenuDateiNetzwerke"; - this.ProgramMenuDateiNetzwerke.Size = new System.Drawing.Size(129, 22); + this.ProgramMenuDateiNetzwerke.Size = new System.Drawing.Size(152, 22); this.ProgramMenuDateiNetzwerke.Text = "Netzwerke"; // // ProgramMenuDateiNetzwerkeAnsehen // this.ProgramMenuDateiNetzwerkeAnsehen.Name = "ProgramMenuDateiNetzwerkeAnsehen"; - this.ProgramMenuDateiNetzwerkeAnsehen.Size = new System.Drawing.Size(130, 22); + this.ProgramMenuDateiNetzwerkeAnsehen.Size = new System.Drawing.Size(152, 22); this.ProgramMenuDateiNetzwerkeAnsehen.Text = "Ansehen"; this.ProgramMenuDateiNetzwerkeAnsehen.Click += new System.EventHandler(this.ProgramMenuDateiNetzwerkeAnsehen_Click); // // ProgramMenuDateiNetzwerkeBearbeiten // this.ProgramMenuDateiNetzwerkeBearbeiten.Name = "ProgramMenuDateiNetzwerkeBearbeiten"; - this.ProgramMenuDateiNetzwerkeBearbeiten.Size = new System.Drawing.Size(130, 22); + this.ProgramMenuDateiNetzwerkeBearbeiten.Size = new System.Drawing.Size(152, 22); this.ProgramMenuDateiNetzwerkeBearbeiten.Text = "Bearbeiten"; + this.ProgramMenuDateiNetzwerkeBearbeiten.Click += new System.EventHandler(this.ProgramMenuDateiNetzwerkeBearbeiten_Click); // // ProgramMenuDateiEmail // @@ -105,25 +106,25 @@ this.ProgramMenuDateiEmailAnsehen, this.ProgramMenuDateiEmailHinzufuegen}); this.ProgramMenuDateiEmail.Name = "ProgramMenuDateiEmail"; - this.ProgramMenuDateiEmail.Size = new System.Drawing.Size(129, 22); + this.ProgramMenuDateiEmail.Size = new System.Drawing.Size(152, 22); this.ProgramMenuDateiEmail.Text = "E-Mail"; // // ProgramMenuDateiEmailAnsehen // this.ProgramMenuDateiEmailAnsehen.Name = "ProgramMenuDateiEmailAnsehen"; - this.ProgramMenuDateiEmailAnsehen.Size = new System.Drawing.Size(136, 22); + this.ProgramMenuDateiEmailAnsehen.Size = new System.Drawing.Size(152, 22); this.ProgramMenuDateiEmailAnsehen.Text = "Ansehen"; // // ProgramMenuDateiEmailHinzufuegen // this.ProgramMenuDateiEmailHinzufuegen.Name = "ProgramMenuDateiEmailHinzufuegen"; - this.ProgramMenuDateiEmailHinzufuegen.Size = new System.Drawing.Size(136, 22); + this.ProgramMenuDateiEmailHinzufuegen.Size = new System.Drawing.Size(152, 22); this.ProgramMenuDateiEmailHinzufuegen.Text = "Hinzufügen"; // // ProgramMenuDateiBeenden // this.ProgramMenuDateiBeenden.Name = "ProgramMenuDateiBeenden"; - this.ProgramMenuDateiBeenden.Size = new System.Drawing.Size(129, 22); + this.ProgramMenuDateiBeenden.Size = new System.Drawing.Size(152, 22); this.ProgramMenuDateiBeenden.Text = "Beenden"; // // ProgramMenuDienst @@ -138,13 +139,13 @@ // ProgramMenuDienstStarten // this.ProgramMenuDienstStarten.Name = "ProgramMenuDienstStarten"; - this.ProgramMenuDienstStarten.Size = new System.Drawing.Size(118, 22); + this.ProgramMenuDienstStarten.Size = new System.Drawing.Size(152, 22); this.ProgramMenuDienstStarten.Text = "Starten"; // // ProgramMenuDienstStoppen // this.ProgramMenuDienstStoppen.Name = "ProgramMenuDienstStoppen"; - this.ProgramMenuDienstStoppen.Size = new System.Drawing.Size(118, 22); + this.ProgramMenuDienstStoppen.Size = new System.Drawing.Size(152, 22); this.ProgramMenuDienstStoppen.Text = "Stoppen"; // // ProgramMenuNetzwerke diff --git a/NetMonitorClient/Form1.cs b/NetMonitorClient/Form1.cs index 0455491..ce4f188 100644 --- a/NetMonitorClient/Form1.cs +++ b/NetMonitorClient/Form1.cs @@ -12,16 +12,6 @@ namespace NetMonitorClient { public partial class Netzmonitor : Form { - private enum netsetter - { - Auto, - IpAuto, - Ip, - DnsAuto, - Dns, - WinsAuto, - Wins - } private ServiceControl sc; public Netzmonitor() { @@ -48,33 +38,10 @@ namespace NetMonitorClient private void TrayMenuNet_Click(object sender, EventArgs e) { ToolStripMenuItem Item = (ToolStripMenuItem)sender; - String name = networkini.getValue(Item.Name, "Name"); - String ip = networkini.getValue(Item.Name, "Ip"); - String subnet = networkini.getValue(Item.Name, "Subnet"); - String gateway = networkini.getValue(Item.Name, "Gateway"); - String dns = networkini.getValue(Item.Name, "Dns"); - String wins = networkini.getValue(Item.Name, "Wins"); - String adapter = networkini.getValue(Item.Name, "Adapter"); - - if (ip == "auto" && dns == "auto" && wins == "auto") - { - setNetworkAuto(adapter, name); - } - else - { - if (ip == "auto") - setNetworkIpAuto(adapter, name); - else - setNetworkIp(ip, subnet, gateway, adapter, name); - if (dns == "auto") - setNetworkDnsAuto(adapter, name); - else - setNetworkDns(dns, adapter, name); - if (wins == "auto") - setNetworkWinsAuto(adapter, name); - else - setNetworkWins(wins, adapter, name); - } + Networksetter netsetter = new Networksetter(Item.Name, networkini, sc); + netsetter.setNetwork(); + this.showPopup(netsetter.getPopupBool(), netsetter.getPopupTitel(), netsetter.getPopupText()); + this.StatusLog.Items.AddRange(netsetter.getLog().ToArray()); } private void showPopup(bool p, string titel, string text) @@ -98,5 +65,10 @@ namespace NetMonitorClient { new EditNetworks(EditNetworks.Options.Show).ShowDialog(this); } + + private void ProgramMenuDateiNetzwerkeBearbeiten_Click(object sender, EventArgs e) + { + new EditNetworks(EditNetworks.Options.Edit).ShowDialog(this); + } } } diff --git a/NetMonitorClient/InIReader.cs b/NetMonitorClient/InIReader.cs index 3cbff95..0e36d7d 100644 --- a/NetMonitorClient/InIReader.cs +++ b/NetMonitorClient/InIReader.cs @@ -8,7 +8,7 @@ using System.Text.RegularExpressions; namespace NetMonitorClient { - class InIReader + public class InIReader { private StreamReader file; private ArrayList cont = new ArrayList(); diff --git a/NetMonitorClient/NetMonitorClient.csproj b/NetMonitorClient/NetMonitorClient.csproj index cda4d39..6d40a03 100644 --- a/NetMonitorClient/NetMonitorClient.csproj +++ b/NetMonitorClient/NetMonitorClient.csproj @@ -36,7 +36,7 @@ true full false - bin\Debug\ + E:\Programme\NetMonitor\ DEBUG;TRACE prompt 4 @@ -86,6 +86,7 @@ Form + diff --git a/NetMonitorClient/Networks.cs b/NetMonitorClient/Networks.cs index f149cc0..5d23023 100644 --- a/NetMonitorClient/Networks.cs +++ b/NetMonitorClient/Networks.cs @@ -9,93 +9,6 @@ namespace NetMonitorClient { partial class Netzmonitor { - private void setNetworkAuto(string adapter, string name) - { - setNetwork(netsetter.Auto, null, null, null, adapter, name, null, null); - } - private void setNetworkIpAuto(string adapter, string name) - { - setNetwork(netsetter.IpAuto, null, null, null, adapter, name, null, null); - } - private void setNetworkIp(string ip, string subnet, string gateway, string adapter, string name) - { - setNetwork(netsetter.Ip, ip, subnet, gateway, adapter, name, null, null); - } - private void setNetworkDnsAuto(string adapter, string name) - { - setNetwork(netsetter.DnsAuto, null, null, null, adapter, name, null, null); - } - private void setNetworkDns(string dns, string adapter, string name) - { - setNetwork(netsetter.Dns, null, null, null, adapter, name, dns, null); - } - private void setNetworkWinsAuto(string adapter, string name) - { - setNetwork(netsetter.WinsAuto, null, null, null, adapter, name, null, null); - } - private void setNetworkWins(string wins, string adapter, string name) - { - setNetwork(netsetter.Wins, null, null, null, adapter, name, null, wins); - } - private void setNetwork(netsetter option, string ip, string subnet, string gateway, string adapter, string name, string dns, string wins) - { - bool status = false; - String text = ""; - if (option == netsetter.Ip) - { - text = "Ip: " + ip + ";Subnet: " + subnet + ";Gateway: " + gateway; - this.StatusLog.Items.Add("Gesendet: " + text); - Application.DoEvents(); - status = this.sc.setNetworkIp(ip, subnet, gateway, adapter); - } - if (option == netsetter.Auto) - { - text = "Netzwerk auf Auto"; - this.StatusLog.Items.Add("Gesendet: " + text); - Application.DoEvents(); - status = this.sc.setNetworkAuto(adapter); - } - if (option == netsetter.IpAuto) - { - text = "Ip auf Auto"; - this.StatusLog.Items.Add("Gesendet: " + text); - Application.DoEvents(); - status = this.sc.setNetworkIpAuto(adapter); - } - if (option == netsetter.DnsAuto) - { - text = "Dns auf Auto"; - this.StatusLog.Items.Add("Gesendet: " + text); - Application.DoEvents(); - status = this.sc.setNetworkDnsAuto(adapter); - } - if (option == netsetter.WinsAuto) - { - text = "Wins auf Auto"; - this.StatusLog.Items.Add("Gesendet: " + text); - Application.DoEvents(); - status = this.sc.setNetworkWinsAuto(adapter); - } - if (option == netsetter.Dns) - { - text = "Dns: " + dns; - this.StatusLog.Items.Add("Gesendet: " + text); - Application.DoEvents(); - status = this.sc.setNetworkDNS(dns, adapter); - } - if (option == netsetter.Wins) - { - text = "Wins: " + wins; - this.StatusLog.Items.Add("Gesendet: " + text); - Application.DoEvents(); - status = this.sc.setNetworkWINS(wins, adapter); - } - this.StatusLog.Items.Add("Antwort: " + ((status) ? "Ok" : "Fehler")); - Application.DoEvents(); - this.showPopup(status, name, text); - Application.DoEvents(); - } - private void InitNetworks() { this.networkini = new InIReader("network.ini"); diff --git a/NetMonitorClient/Networksetter.cs b/NetMonitorClient/Networksetter.cs new file mode 100644 index 0000000..c3eac39 --- /dev/null +++ b/NetMonitorClient/Networksetter.cs @@ -0,0 +1,177 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NetMonitorClient +{ + public class Networksetter + { + private ServiceControl sc; + private InIReader networkini; + private string net_name; + private List loglist; + + private bool Pstatus; + private string Pname; + private string Ptext; + private enum netsetter + { + Auto, + IpAuto, + Ip, + DnsAuto, + Dns, + WinsAuto, + Wins + } + public Networksetter(string name, InIReader ini, ServiceControl serv) + { + this.net_name = name; + this.networkini = ini; + loglist = new List(); + this.sc = serv; + } + public void setNetwork() + { + String name = networkini.getValue(net_name, "Name"); + String ip = networkini.getValue(net_name, "Ip"); + String subnet = networkini.getValue(net_name, "Subnet"); + String gateway = networkini.getValue(net_name, "Gateway"); + String dns = networkini.getValue(net_name, "Dns"); + String wins = networkini.getValue(net_name, "Wins"); + String adapter = networkini.getValue(net_name, "Adapter"); + + if (ip == "auto" && dns == "auto" && wins == "auto") + { + setNetworkAuto(adapter, name); + } + else + { + if (ip == "auto") + setNetworkIpAuto(adapter, name); + else + setNetworkIp(ip, subnet, gateway, adapter, name); + if (dns == "auto") + setNetworkDnsAuto(adapter, name); + else + setNetworkDns(dns, adapter, name); + if (wins == "auto") + setNetworkWinsAuto(adapter, name); + else + setNetworkWins(wins, adapter, name); + } + } + private void setNetworkAuto(string adapter, string name) + { + setNetwork(netsetter.Auto, null, null, null, adapter, name, null, null); + } + private void setNetworkIpAuto(string adapter, string name) + { + setNetwork(netsetter.IpAuto, null, null, null, adapter, name, null, null); + } + private void setNetworkIp(string ip, string subnet, string gateway, string adapter, string name) + { + setNetwork(netsetter.Ip, ip, subnet, gateway, adapter, name, null, null); + } + private void setNetworkDnsAuto(string adapter, string name) + { + setNetwork(netsetter.DnsAuto, null, null, null, adapter, name, null, null); + } + private void setNetworkDns(string dns, string adapter, string name) + { + setNetwork(netsetter.Dns, null, null, null, adapter, name, dns, null); + } + private void setNetworkWinsAuto(string adapter, string name) + { + setNetwork(netsetter.WinsAuto, null, null, null, adapter, name, null, null); + } + private void setNetworkWins(string wins, string adapter, string name) + { + setNetwork(netsetter.Wins, null, null, null, adapter, name, null, wins); + } + private void setNetwork(netsetter option, string ip, string subnet, string gateway, string adapter, string name, string dns, string wins) + { + bool status = false; + List text = new List(); + if (option == netsetter.Ip) + { + text.Add("Ip: " + ip + ";Subnet: " + subnet + ";Gateway: " + gateway); + loglist.Add("Gesendet: " + text); + System.Windows.Forms.Application.DoEvents(); + status = this.sc.setNetworkIp(ip, subnet, gateway, adapter); + } + if (option == netsetter.Auto) + { + text.Add("Netzwerk auf Auto"); + loglist.Add("Gesendet: " + text); + System.Windows.Forms.Application.DoEvents(); + status = this.sc.setNetworkAuto(adapter); + } + if (option == netsetter.IpAuto) + { + text.Add("Ip auf Auto"); + loglist.Add("Gesendet: " + text); + System.Windows.Forms.Application.DoEvents(); + status = this.sc.setNetworkIpAuto(adapter); + } + if (option == netsetter.DnsAuto) + { + text.Add("Dns auf Auto"); + loglist.Add("Gesendet: " + text); + System.Windows.Forms.Application.DoEvents(); + status = this.sc.setNetworkDnsAuto(adapter); + } + if (option == netsetter.WinsAuto) + { + text.Add("Wins auf Auto"); + loglist.Add("Gesendet: " + text); + System.Windows.Forms.Application.DoEvents(); + status = this.sc.setNetworkWinsAuto(adapter); + } + if (option == netsetter.Dns) + { + text.Add("Dns: " + dns); + loglist.Add("Gesendet: " + text); + status = this.sc.setNetworkDNS(dns, adapter); + } + if (option == netsetter.Wins) + { + text.Add("Wins: " + wins); + loglist.Add("Gesendet: " + text); + System.Windows.Forms.Application.DoEvents(); + status = this.sc.setNetworkWINS(wins, adapter); + } + loglist.Add("Antwort: " + ((status) ? "Ok" : "Fehler")); + System.Windows.Forms.Application.DoEvents(); + setPopup(status, name, String.Join("\n",text.ToArray())); + } + + private void setPopup(bool status, string name, string text) + { + this.Pstatus = status; + this.Pname = name; + this.Ptext = text; + } + + internal bool getPopupBool() + { + return this.Pstatus; + } + + internal string getPopupTitel() + { + return this.Pname; + } + + internal string getPopupText() + { + return this.Ptext; + } + + public List getLog() + { + return this.loglist; + } + } +} diff --git a/NetMonitorClient/ServiceControl.cs b/NetMonitorClient/ServiceControl.cs index 4c13f15..ba02207 100644 --- a/NetMonitorClient/ServiceControl.cs +++ b/NetMonitorClient/ServiceControl.cs @@ -8,7 +8,7 @@ using System.Net; namespace NetMonitorClient { - class ServiceControl + public class ServiceControl { private UdpClient net_send; private IPEndPoint net_send_port; diff --git a/NetMonitorConsole/CMDArgs.cs b/NetMonitorConsole/CMDArgs.cs new file mode 100644 index 0000000..8446df5 --- /dev/null +++ b/NetMonitorConsole/CMDArgs.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NetMonitorConsole +{ + class CMDArgs + { + private string[] args; + public enum Worker + { + Network, + Nothing + } + private Worker work; + public CMDArgs(string[] arg) + { + this.args = arg; + work = Worker.Nothing; + setWorker(); + } + + private void setWorker() + { + if (args.Length >= 1 && args[0].ToLower() == "-n") + work = Worker.Network; + } + + + internal Worker getWorker() + { + return work; + } + + internal string getNetworkName() + { + if (work == Worker.Network) + return args[1]; + return null; + } + } +} diff --git a/NetMonitorConsole/NetMonitorConsole.csproj b/NetMonitorConsole/NetMonitorConsole.csproj new file mode 100644 index 0000000..2a1a732 --- /dev/null +++ b/NetMonitorConsole/NetMonitorConsole.csproj @@ -0,0 +1,64 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {148AA47C-FA4D-4807-9EB0-5AEAC36C1524} + Exe + Properties + NetMonitorConsole + NetMonitorConsole + v4.0 + Client + 512 + + + x86 + true + full + false + E:\Programme\NetMonitor\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {718693A0-06A3-4765-801D-33842861AA61} + NetMonitorClient + + + + + \ No newline at end of file diff --git a/NetMonitorConsole/Program.cs b/NetMonitorConsole/Program.cs new file mode 100644 index 0000000..9842484 --- /dev/null +++ b/NetMonitorConsole/Program.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NetMonitorClient; + +namespace NetMonitorConsole +{ + class Program + { + private static ServiceControl sc; + private static InIReader networkini; + private static CMDArgs arg; + static void Main(string[] args) + { + Console.WriteLine("NetMonitorConsole: Programm zum setzen der Netzwerkeinstellungen"); + sc = new ServiceControl("NetMonitorServer"); + networkini = new InIReader("network.ini"); + arg = new CMDArgs(args); + switch (arg.getWorker()) + { + case CMDArgs.Worker.Network: + setNetwork(); + break; + case CMDArgs.Worker.Nothing: + Console.WriteLine("usage: NetMonitorConsole.exe: -n [networkid]"); + break; + } + } + + private static void setNetwork() + { + Networksetter netsetter = new Networksetter(arg.getNetworkName(), networkini, sc); + netsetter.setNetwork(); + Console.WriteLine(String.Join("\n",netsetter.getLog().ToArray())); + } + } +} diff --git a/NetMonitorConsole/Properties/AssemblyInfo.cs b/NetMonitorConsole/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f963a1c --- /dev/null +++ b/NetMonitorConsole/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("NetMonitorConsole")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NetMonitorConsole")] +[assembly: AssemblyCopyright("Copyright © 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("8bc2ac0e-a728-4329-845c-6bf9dc353a6f")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]