69 lines
1.8 KiB
C#
69 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using NetMonitorTray.Properties;
|
|
using BlubbFish.Utils;
|
|
|
|
namespace NetMonitorTray.Models
|
|
{
|
|
public class Window : OwnModel<Window>
|
|
{
|
|
private InIReader networkfile;
|
|
private Window()
|
|
{
|
|
this.init();
|
|
}
|
|
|
|
override protected void init()
|
|
{
|
|
this.networkfile = InIReader.getInstance("network.ini");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Listet alle Netzwerke auf
|
|
/// </summary>
|
|
public List<string> Networks
|
|
{
|
|
get { return this.networkfile.getSections(); }
|
|
}
|
|
|
|
public string getNetworkProperty(string network, string property)
|
|
{
|
|
return this.networkfile.getValue(network, property);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Fügt ein neues Netzwerk hinzu
|
|
/// </summary>
|
|
/// <param name="name">Netzwerkid</param>
|
|
/// <returns>true if added, false if error</returns>
|
|
public bool addNetwork(string name)
|
|
{
|
|
if (this.networkfile.addSection(name))
|
|
{
|
|
this.update();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Löscht ein Netzwerk
|
|
/// </summary>
|
|
/// <param name="name">Netzwerkid</param>
|
|
/// <returns>true if deleted, false if error</returns>
|
|
public bool removeNetwork(string name)
|
|
{
|
|
if (this.networkfile.removeSection(name))
|
|
{
|
|
this.update();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|