Added initial "ini" code

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@808 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2010-08-17 19:21:45 +00:00
commit d609525999

View file

@ -33,12 +33,13 @@ using System.Windows.Forms;
using Greenshot.Capturing;
using Greenshot.Configuration;
using Greenshot.Core;
using Greenshot.Drawing;
using Greenshot.Forms;
using Greenshot.Helpers;
using Greenshot.Plugin;
using Greenshot.UnmanagedHelpers;
using Greenshot.Core;
using GreenshotCore.Configuration;
namespace Greenshot {
/// <summary>
@ -48,20 +49,10 @@ namespace Greenshot {
private const string LOG4NET_FILE = "log4net.xml";
private static log4net.ILog LOG = null;
private static AppConfig conf;
private static Mutex applicationMutex = null;
private static CoreConfiguration coreConfiguration;
[STAThread]
public static void Main(string[] args) {
bool isAlreadyRunning = false;
List<string> filesToOpen = new List<string>();
// Set the Thread name, is better than "1"
Thread.CurrentThread.Name = Application.ProductName;
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
private static void InitializeLog4NET() {
// Setup log4j, currently the file is called log4net.xml
string log4netFilename = Path.Combine(Application.StartupPath, LOG4NET_FILE);
if (File.Exists(log4netFilename)) {
@ -72,10 +63,30 @@ namespace Greenshot {
// Setup the LOG
LOG = log4net.LogManager.GetLogger(typeof(MainForm));
}
[STAThread]
public static void Main(string[] args) {
bool isAlreadyRunning = false;
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
List<string> filesToOpen = new List<string>();
// Init Log4NET
InitializeLog4NET();
// Log the startup
LOG.Info("Starting: " + EnvironmentInfo.EnvironmentToString(false));
// Set the Thread name, is better than "1"
Thread.CurrentThread.Name = Application.ProductName;
// Read configuration
coreConfiguration = IniConfig.GetInstance().GetSection<CoreConfiguration>();
IniConfig.GetInstance().Save();
LOG.Info(coreConfiguration.IsFirstLaunch);
try {
// Fix for Bug 2495900, Multi-user Environment
// check whether there's an local instance running already