2014-06-22 12:31:57 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Windows.Forms;
|
2014-07-05 20:46:58 +00:00
|
|
|
|
using System.Configuration;
|
|
|
|
|
|
|
|
|
|
using log4net;
|
|
|
|
|
using log4net.Config;
|
2016-01-10 22:28:29 +00:00
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Reflection;
|
2014-07-05 20:46:58 +00:00
|
|
|
|
//[assembly: log4net.Config.XmlConfigurator( Watch = true )]
|
|
|
|
|
[assembly: log4net.Config.XmlConfigurator( ConfigFile = "log4Net.config", Watch = true )]
|
2014-06-22 12:31:57 +00:00
|
|
|
|
|
|
|
|
|
namespace SCJMapper_V2
|
|
|
|
|
{
|
|
|
|
|
static class Program
|
|
|
|
|
{
|
2016-01-10 22:28:29 +00:00
|
|
|
|
private static readonly log4net.ILog log = log4net.LogManager.GetLogger ( System.Reflection.MethodBase.GetCurrentMethod( ).DeclaringType );
|
|
|
|
|
|
|
|
|
|
// not used as long as the culture change below works..
|
|
|
|
|
// internal static CultureInfo cultUS = new CultureInfo("en-US", false); // use strict US formats (this is used for numbers only)
|
|
|
|
|
// internal static NumberStyles nsNum = NumberStyles.Number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Thanks.. http://blog.rastating.com/setting-default-currentculture-in-all-versions-of-net/
|
|
|
|
|
static void SetDefaultCulture( CultureInfo culture )
|
|
|
|
|
{
|
|
|
|
|
// The CultureInfo class has two private static members named m_userDefaultCulture
|
|
|
|
|
// and m_userDefaultUICulture in versions prior to .NET 4.0;
|
|
|
|
|
// in 4.0 they are named s_userDefaultCulture and s_userDefaultUICulture.
|
|
|
|
|
|
|
|
|
|
Type type = typeof(CultureInfo);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
type.InvokeMember( "s_userDefaultCulture",
|
|
|
|
|
BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Static,
|
|
|
|
|
null,
|
|
|
|
|
culture,
|
|
|
|
|
new object[] { culture } );
|
|
|
|
|
|
|
|
|
|
type.InvokeMember( "s_userDefaultUICulture",
|
|
|
|
|
BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Static,
|
|
|
|
|
null,
|
|
|
|
|
culture,
|
|
|
|
|
new object[] { culture } );
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
type.InvokeMember( "m_userDefaultCulture",
|
|
|
|
|
BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Static,
|
|
|
|
|
null,
|
|
|
|
|
culture,
|
|
|
|
|
new object[] { culture } );
|
|
|
|
|
|
|
|
|
|
type.InvokeMember( "m_userDefaultUICulture",
|
|
|
|
|
BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Static,
|
|
|
|
|
null,
|
|
|
|
|
culture,
|
|
|
|
|
new object[] { culture } );
|
|
|
|
|
}
|
|
|
|
|
catch { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-07-05 20:46:58 +00:00
|
|
|
|
/* Log Levels Inc Priority
|
|
|
|
|
* ALL
|
|
|
|
|
* DEBUG
|
|
|
|
|
* INFO
|
|
|
|
|
* WARN
|
|
|
|
|
* ERROR
|
|
|
|
|
* FATAL
|
|
|
|
|
* OFF
|
|
|
|
|
* */
|
2014-06-22 12:31:57 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The main entry point for the application.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main( )
|
|
|
|
|
{
|
2016-01-10 22:28:29 +00:00
|
|
|
|
// Log file setup
|
2014-07-05 20:46:58 +00:00
|
|
|
|
log.InfoFormat( "\n" );
|
|
|
|
|
log.InfoFormat( "SCJMapper_V2 - Started" );
|
|
|
|
|
|
2016-01-10 22:28:29 +00:00
|
|
|
|
CultureInfo current = CultureInfo.CurrentCulture;
|
|
|
|
|
CultureInfo modded = new CultureInfo( current.Name ); // that is the users locale
|
|
|
|
|
CultureInfo us = new CultureInfo( "en-US" );
|
|
|
|
|
modded.NumberFormat = us.NumberFormat; // change the whole number format to US - should be safe ...
|
|
|
|
|
// change the applications formatting to US (the dec point is essential here)
|
|
|
|
|
SetDefaultCulture( modded ); // have to maintain number formats without tracking every piece of code with locales
|
|
|
|
|
log.InfoFormat( "SCJMapper_V2 - Changed to US number formatting" );
|
|
|
|
|
|
|
|
|
|
|
2014-06-22 12:31:57 +00:00
|
|
|
|
Application.EnableVisualStyles( );
|
|
|
|
|
Application.SetCompatibleTextRenderingDefault( false );
|
|
|
|
|
Application.Run( new MainForm( ) );
|
2014-07-05 20:46:58 +00:00
|
|
|
|
|
|
|
|
|
log.InfoFormat( "SCJMapper_V2 - Ended\n" );
|
2014-06-22 12:31:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|