Program.cs
1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Web.Administration;
using System.Management;
using System.Diagnostics;
using Vrh.XmlProcessing;
using VRH.Common;
using System.Xml.Linq;
namespace Vrh.Log4Pro.MaintenanceConsole
{
class Program
{
static void Main(string[] args)
{
ColorConsole.ReadLine("Press a key to start...");
var appconfigpath = CommandLine.GetCommandLineArgument(args, "-APPCONFIG");
CommandLine.SetAppConfigFile(appconfigpath);
try { ColorConsole.SetWindowSize(120, 64); }
catch (Exception ex)
{
ColorConsole.WriteLine("Change the size of the console fonts smaller!");
ColorConsole.ReadKey();
return;
}
if (!Tools.IsElevated)
{
ColorConsole.WriteLine("Run as administartor!");
ColorConsole.ReadKey();
return;
}
var mm = new Menu("Log4ProIS Maintenance Console")
.AddMenuItem(new Menu.Item("WAM", "Web Application Manager", WebApplicationManager.Execute))
.AddMenuItem(new Menu.Item("WSM", "Windows Service Manager", WindowsServiceManager.Execute))
.AddMenuItem(new Menu.Item("FCL", "File Cleaner Manager", FileCleanerManager.Execute))
.AddMenuItem(new Menu.Item("SCH", "Scheduled Task Manager", ScheduledTaskmanagerManager.Execute))
.AddMenuItem(new Menu.ItemSeparator('-'))
.AddMenuItem(new Menu.Item("TOL", "Maintenance tools", MaintenanceToolManager.Execute))
.SetSelectionMode(Menu.SelectionMode.Single);
var commandmode = !string.IsNullOrEmpty(CommandLine.GetCommandLineArgument(args, "-MODULE"));
if (commandmode)
{
var silentmode = !string.IsNullOrEmpty(CommandLine.GetCommandLineArgument(args, "-SILENT", switchtype: true));
ColorConsole.SetSilentMode(silentmode);
Menu.SetCommandModeAllMenus();
mm.ExecuteCmd(args);
}
else
{
mm.ExecuteMenu();
ColorConsole.PressAnykeyToContinue();
}
}
}
}