Blame view

Vrh.Log4Pro.MaintenanceConsole/Program.cs 1.91 KB
c0dd7bdf   Schwirg László   Add project files.
1
2
3
4
5
6
7
8
9
10
11
  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;
37bf94ab   Schwirg László   command mode kial...
12
  using VRH.Common;
c0dd7bdf   Schwirg László   Add project files.
13
14
15
16
17
18
19
20
  using System.Xml.Linq;
  
  namespace Vrh.Log4Pro.MaintenanceConsole
  {
  	class Program
  	{
  		static void Main(string[] args)
  		{
37bf94ab   Schwirg László   command mode kial...
21
22
23
24
25
  			ColorConsole.ReadLine("Press a key to start...");
  			var appconfigpath = CommandLine.GetCommandLineArgument(args, "-APPCONFIG");
  			CommandLine.SetAppConfigFile(appconfigpath);
  
  			try { ColorConsole.SetWindowSize(120, 64); } 
c0dd7bdf   Schwirg László   Add project files.
26
27
  			catch (Exception ex)
  			{
37bf94ab   Schwirg László   command mode kial...
28
29
30
31
32
33
34
35
  				ColorConsole.WriteLine("Change the size of the console fonts smaller!");
  				ColorConsole.ReadKey();
  				return;
  			}
  			if (!Tools.IsElevated)
  			{
  				ColorConsole.WriteLine("Run as administartor!");
  				ColorConsole.ReadKey();
c0dd7bdf   Schwirg László   Add project files.
36
37
38
39
40
41
  				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))
e76b5118   Schwirg László   FileCleanerManage...
42
  				.AddMenuItem(new Menu.Item("FCL", "File Cleaner Manager", FileCleanerManager.Execute))
37bf94ab   Schwirg László   command mode kial...
43
  				.AddMenuItem(new Menu.Item("SCH", "Scheduled Task Manager", ScheduledTaskmanagerManager.Execute))
e76b5118   Schwirg László   FileCleanerManage...
44
45
  				.AddMenuItem(new Menu.ItemSeparator('-'))
  				.AddMenuItem(new Menu.Item("TOL", "Maintenance tools", MaintenanceToolManager.Execute))
c0dd7bdf   Schwirg László   Add project files.
46
47
  				.SetSelectionMode(Menu.SelectionMode.Single);
  
37bf94ab   Schwirg László   command mode kial...
48
49
50
51
52
53
54
55
56
57
58
59
60
  			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();
  			}
c0dd7bdf   Schwirg László   Add project files.
61
62
63
  		}
  	}
  }