[go: up one dir, main page]

Menu

[9b8379]: / lat / Main.cs  Maximize  Restore  History

Download this file

139 lines (110 with data), 3.7 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
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//
// lat - Main.cs
// Author: Loren Bandiera
// Copyright 2005-2006 MMG Security, Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; Version 2
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
//
using System;
using System.Text;
using Gtk;
using Gnome;
using lat;
public class Global
{
public static Gdk.Pixbuf latIcon;
public static MainWindow Window;
public static ConnectionManager Connections;
public static PluginManager Plugins;
public static TemplateManager Templates;
#if ENABLE_NETWORKMANAGER
public static NetworkDetect Network;
#endif
}
public class LdapAdministrationTool
{
static void PrintUsage ()
{
StringBuilder usage = new StringBuilder ();
usage.AppendFormat ("{0} {1}\n", Defines.PACKAGE, Defines.VERSION);
usage.AppendFormat ("Web page: https://sourceforge.net/projects/ldap-at/\n");
usage.AppendFormat ("Copyright 2005-2006 MMG Security, Inc.\nCopyright 2008-2012 Jeroen Asselman\n");
usage.AppendFormat ("Usage: {0} [OPTIONS]\n\n", Defines.PACKAGE);
usage.AppendFormat ("Options:\n");
usage.AppendFormat (" -d, --debug\t\t\tTurn on debugging messages.\n");
usage.AppendFormat (" -v, --version\t\tPrint version and exit.\n");
usage.AppendFormat (" -h, --help\t\t\tPrint this usage message.\n");
Console.WriteLine (usage.ToString());
}
static void PrintVersion ()
{
StringBuilder version = new StringBuilder ();
version.AppendFormat ("{0} {1}\n\n", Defines.PACKAGE, Defines.VERSION);
version.AppendFormat ("Copyright 2005-2006 MMG Security, Inc.\nCopyright 2008-2012 Jeroen Asselman\n");
version.AppendFormat ("This is free software; see the source for copying conditions. There is NO\n");
version.AppendFormat ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
Console.WriteLine (version.ToString());
}
public static void Main (string[] args)
{
int i = 0;
LogLevel logLevel = LogLevel.Info;
while (i < args.Length) {
string arg = args[i];
++i;
switch (arg) {
case "-d":
case "--debug":
logLevel = LogLevel.Debug;
break;
case "-h":
case "--help":
PrintUsage ();
Environment.Exit (0);
break;
case "-v":
case "--version":
PrintVersion ();
Environment.Exit (0);
break;
default:
Console.WriteLine ("Unknown argument '{0}'", arg);
break;
}
}
Application.Init ();
Log.Initialize (logLevel);
Log.Info ("Starting {0} (version {1})", Defines.PACKAGE, Defines.VERSION);
Util.SetProcessName (Defines.PACKAGE);
if (Util.IsOldConfig())
Util.UpgradeConfigurationFiles ();
Global.Templates = new TemplateManager ();
Global.Plugins = new PluginManager ();
Global.Connections = new ConnectionManager ();
Mono.Unix.Catalog.Init (Defines.PACKAGE, Defines.LOCALE_DIR);
try {
Program program = new Program (Defines.PACKAGE, Defines.VERSION, Modules.UI, args);
Global.Window = new MainWindow (program);
program.Run ();
} catch (Exception e) {
Log.Debug (e);
Log.Error (e.Message);
}
Global.Templates.Save ();
Global.Connections.Save ();
Global.Plugins.Save ();
Log.Info ("Exiting {0}", Defines.PACKAGE);
}
}