static bool PreLoading(string[] args) { Log = new LogControler(AppName); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); LogWapper = new GWLoggingWapper(Log); Log.WriteAppStart(AppName); // initialize config ConfigMgt = new ConfigMgt <ManagerConfig>(); ConfigMgt.FileName = Application.StartupPath + "\\" + ManagerConfig.FileName; if (ConfigMgt.Load(LogWapper)) { Log = new LogControler(AppName, ConfigMgt.Config.LogType); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); LogWapper = new GWLoggingWapper(Log); Program.ConfigMgt.Config.RefreshConfigInfo(); Log.Write("Load config succeeded. " + ConfigMgt.FileName); } else { Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastErrorInfor); if (MessageBox.Show("Cannot load " + AppName + " config file. \r\n" + ConfigMgt.FileName + "\r\n\r\nDo you want to create a config file with default setting?", AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ConfigMgt.Config = ManagerConfig.CreateDefaultConfig(); Program.ConfigMgt.Config.RefreshConfigInfo(); if (ConfigMgt.Save(LogWapper)) { Log.Write("Create config file succeeded. " + ConfigMgt.FileName); } else { Log.Write(LogType.Error, "Create config file failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastErrorInfor); } } Log.WriteAppExit(AppName); return(false); } return(true); }