Initial commit
This commit is contained in:
Executable
+88
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
|
||||
namespace WoL_Manager
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
string fileName1 = "hosts.xml";
|
||||
string fileName2 = "hosts.dtd";
|
||||
string fileName3 = "settings.xml";
|
||||
string fileName4 = "settings.dtd";
|
||||
|
||||
ManagerSettings.createDTD(fileName4);
|
||||
if (System.IO.File.Exists(fileName3))
|
||||
{
|
||||
bool result;
|
||||
try
|
||||
{
|
||||
result = ManagerSettings.readFromFile(fileName3);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result == false)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("Parse Error while reading settings-file!");
|
||||
try
|
||||
{
|
||||
System.IO.File.Delete(fileName3);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("Couldn't delete file 'settings.xml'!\nPlease delete this file manually.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Host.createDTD(fileName2);
|
||||
if (System.IO.File.Exists(fileName1))
|
||||
{
|
||||
bool result;
|
||||
try
|
||||
{
|
||||
result = Host.readFromFile(fileName1);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result == false)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("Parse Error while reading host-file!");
|
||||
try
|
||||
{
|
||||
System.IO.File.Delete(fileName1);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("Couldn't delete file 'hosts.xml'!\nPlease delete this file manually.");
|
||||
return;
|
||||
}
|
||||
Host.clearList();
|
||||
}
|
||||
}
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
MainWindow apps = new MainWindow();
|
||||
Host.Parent = apps;
|
||||
Application.Run(apps);
|
||||
Host.writeToFile(fileName1);
|
||||
ManagerSettings.writeToFile(fileName3);
|
||||
apps.deletePingThreads();
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user