internal static bool PreLoading(EntityInitializeArgument arg) { Log = new LogControler(AppName, arg.LogConfig); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); Log.Write(arg.ToLog()); ConfigPath = arg.ConfigFilePath; string FileName = ConfigHelper.GetFullPath(Path.Combine(arg.ConfigFilePath, MonitorConfig.ConfigFileName)); ConfigMgt = new ConfigManager <MonitorConfig>(FileName); if (ConfigMgt.Load()) { Log.Write("Load config succeeded. " + ConfigMgt.FileName); return(true); } else { Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName); Log.Write(LogType.Error, ConfigMgt.LastError.ToString()); return(false); } }
internal void PreLoading(EntityInitializeArgument arg) { AppArgument = arg; Log = new LogControler(arg.GetLogFileName(AppName), arg.LogConfig); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); Log.Write(arg.ToLog()); string FileName = ConfigHelper.GetFullPath(Path.Combine(arg.ConfigFilePath, SOAPServerConfig.SOAPServerConfigFileName)); ConfigMgr = new ConfigManager <SOAPServerConfig>(FileName); if (ConfigMgr.Load()) { ConfigMgr.Config._context = this; Log.Write("Load config succeeded. " + ConfigMgr.FileName); } else { Log.Write(LogType.Error, "Load config failed. " + ConfigMgr.FileName); Log.Write(LogType.Error, ConfigMgr.LastError.ToString()); if (System.Windows.Forms.MessageBox.Show("Cannot load " + AppName + " configuration file. \r\n" + ConfigMgr.FileName + "\r\n\r\nDo you want to create a configuration file with default setting and continue?", AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { CreateDefaultConfig(); ConfigMgr.Config._context = this; CreateDefaultConfigFiles(); } } }
private bool PreLoading(string hostConfigFilePath) { HostConfigFileName = Path.Combine(hostConfigFilePath, NTServiceHostConfig.NTServiceHostConfigFileName); ConfigMgt = new ConfigManager <NTServiceHostConfig>(HostConfigFileName); if (ConfigMgt.Load()) { LogControler.BaseDirectory = hostConfigFilePath; Log = new LogControler(HostName, ConfigMgt.Config.LogConfig); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(HostName); Log.Write("Load config succeeded. " + ConfigMgt.FileName); return(true); } else { LogControler.BaseDirectory = hostConfigFilePath; LogConfig logCfg = new LogConfig(); logCfg.LogType = LogType.Debug; Log = new LogControler(HostName, logCfg); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(HostName); Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastError); return(false); } }
internal static void PreLoading() { LogConfig lcfg = new LogConfig(); lcfg.DumpData = true; lcfg.LogType = LogType.Debug; Log = new LogControler(AppName, lcfg); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); string FileName = ConfigHelper.GetFullPath(HL7GatewayConfigConfig.ConfigFileName); ConfigMgr = new ConfigManager <HL7GatewayConfigConfig>(FileName); if (ConfigMgr.Load()) { Log.Write("Load config succeeded. " + ConfigMgr.FileName); } else { Log.Write(LogType.Error, "Load config failed. " + ConfigMgr.FileName); Log.Write(LogType.Error, ConfigMgr.LastError.ToString()); if (System.Windows.Forms.MessageBox.Show("Cannot load " + AppName + " configuration file. \r\n" + ConfigMgr.FileName + "\r\n\r\nDo you want to create a configuration file with default setting and continue?", AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { CreateDefaultConfig(); } } }
internal static void PreLoading() { LogConfig cfg = new LogConfig(); cfg.LogType = LogType.Debug; cfg.DurationDay = 7; Log = new LogControler(AppName, cfg); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); }
//private static bool createDefaultConfigSilently; internal static bool PreLoading(string[] args) { //Log = new LogControler(AppName); //LogHelper.EnableApplicationLogging(Log); //LogHelper.EnableXmlLogging(Log); //Log.WriteAppStart(AppName, args); ConfigMgt = new ConfigManager <EntityConfigHostConfig>(EntityConfigHostConfig.ConfigHostConfigFileName); if (ConfigMgt.Load()) { Log = new LogControler(AppName, ConfigMgt.Config.LogConfig); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName, args); Log.Write("Load config succeeded. " + ConfigMgt.FileName); LoadSolutionDir(); return(true); } else { Log = new LogControler(AppName); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName, args); Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastError); if (//createDefaultConfigSilently || MessageBox.Show("Cannot load " + AppName + " configuration file. \r\n" + ConfigMgt.FileName + "\r\n\r\nDo you want to create a configuration file with default setting and continue?", AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ConfigMgt.Config = new EntityConfigHostConfig(); ConfigMgt.Config.LogConfig.HostName = "ConfigGUI"; if (ConfigMgt.Save()) { Log.Write("Create config file succeeded. " + ConfigMgt.FileName); return(true); } else { Log.Write(LogType.Error, "Create config file failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastError); return(false); } } return(false); } }
internal static bool PreLoading() { //Log = new LogControler(AppName); //LogHelper.EnableApplicationLogging(Log); //LogHelper.EnableXmlLogging(Log); //Log.WriteAppStart(AppName); string filePath = Path.Combine(GetSolutionRoot(), AppConfigFileName); //20091217 ConfigMgt = new ConfigManager <SolutionConfig>(filePath); //ConfigMgt = new ConfigManager<SolutionConfig>(AppConfigFileName); if (ConfigMgt.Load()) { Log = new LogControler(AppName, ConfigMgt.Config.LogConfig); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); Log.Write("Load config succeeded. " + ConfigMgt.FileName); return(true); } else { Log = new LogControler(AppName); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastError); if (MessageBox.Show("Cannot load " + AppName + " configuration file. \r\n" + ConfigMgt.FileName + "\r\n\r\nDo you want to create a configuration file with default setting and continue?", AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ConfigMgt.Config = SolutionConfig.GetDefault();// new SolutionConfig(); if (ConfigMgt.Save()) { Log.Write("Create config file succeeded. " + ConfigMgt.FileName); return(true); } else { Log.Write(LogType.Error, "Create config file failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastError); return(false); } } return(false); } }
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); }
static void Main() { LogConfig lcfg = new LogConfig(); lcfg.DumpData = true; lcfg.LogType = LogType.Debug; Log = new LogControler(AppName, lcfg); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); Log.WriteAppExit(AppName); }
internal static bool PreLoading() { //Log = new LogControler(AppName); //LogHelper.EnableApplicationLogging(Log); //LogHelper.EnableXmlLogging(Log); //Log.WriteAppStart(AppName); ConfigMgt = new ConfigManager <NTServiceHostConfig>(AppConfigFileName); if (ConfigMgt.Load()) { Log = new LogControler(AppName, ConfigMgt.Config.LogConfig); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); Log.Write("Load config succeeded. " + ConfigMgt.FileName); License = new LicenseManager <LicenseConfig>(AppLicenseFileName); License.EnabledCrypto = true; if (License.Load()) { Log.Write("Load license succeeded. " + License.FileName); return(true); } else { //CreateReceiverDefaultLicense(); Log.Write(LogType.Error, "Load license failed. " + License.FileName); Log.Write(License.LastError); return(false); } } else { Log = new LogControler(AppName); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastError); return(false); } }
public void PreLoading(EntityInitializeArgument arg) { AppArgument = arg; Log = new LogControler(arg.GetLogFileName(AppName), arg.LogConfig); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); SocketHelper.EnableSocketLogging(Log, arg.LogConfig.DumpData); Log.WriteAppStart(AppName); Log.Write(arg.ToLog()); string FileName = ConfigHelper.GetFullPath(Path.Combine(arg.ConfigFilePath, HL7InboundConfig.HL7InboundConfigFileName)); ConfigMgr = new ConfigManager <HL7InboundConfig>(FileName); if (ConfigMgr.Load()) { ConfigMgr.Config._contextForDump = this; ConfigMgr.Config._contextForTemplate = this; ConfigMgr.Config._contextForTemplate2 = this; Log.Write("Load config succeeded. " + ConfigMgr.FileName); } else { Log.Write(LogType.Error, "Load config failed. " + ConfigMgr.FileName); Log.Write(LogType.Error, ConfigMgr.LastError.ToString()); if (System.Windows.Forms.MessageBox.Show("Cannot load " + AppName + " configuration file. \r\n" + ConfigMgr.FileName + "\r\n\r\nDo you want to create a configuration file with default setting and continue?", AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { CreateDefaultConfig(); //CreateDefaultHL7AckTempalte(); // the templates are packed in the PublishTempaltes folder when build ConfigMgr.Config._contextForDump = this; ConfigMgr.Config._contextForTemplate = this; ConfigMgr.Config._contextForTemplate2 = this; } } }
internal static void PreLoading(EntityInitializeArgument arg) { Log = new LogControler(AppName, arg.LogConfig); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); Log.Write(arg.ToLog()); string FileName = ConfigHelper.GetFullPath(Path.Combine(arg.ConfigFilePath, ServiceConfig.FileName)); ConfigMgt = new ConfigManager <ServiceConfig>(FileName); if (ConfigMgt.Load()) { Log.Write("Load config succeeded. " + ConfigMgt.FileName); } else { Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName); Log.Write(LogType.Error, ConfigMgt.LastError.ToString()); //if (System.Windows.Forms.MessageBox.Show("Cannot load " + AppName + " configuration file. \r\n" + // ConfigMgr.FileName + "\r\n\r\nDo you want to create a configuration file with default setting and continue?", // AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) //{ ConfigMgt.Config = new ServiceConfig(); if (ConfigMgt.Save()) { Log.Write("Save config succeeded. " + ConfigMgt.FileName); } else { Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastError); } //} } }
static void Main() { //Directory.Delete(@"D:\temp\a"); //throw exception if folder not empty //return; //SortedDictionary<int, string> dic = new SortedDictionary<int, string>(); //dic.Add(-2, "a"); //dic.Add(-1, "b"); //dic.Add(-3, "c"); //StringBuilder sb = new StringBuilder(); //foreach (KeyValuePair<int, string> p in dic) //{ // sb.AppendLine(p.Key.ToString() + "_" + p.Value); //} //MessageBox.Show(sb.ToString()); //return; //List<string> alist = new List<string>(); //alist.Capacity = 3; //alist.Add("a"); //alist.Add("b"); //alist.Add("c"); //alist.Add("d"); //alist.Add("e"); ////alist.Add("f"); //MessageBox.Show(alist.Count.ToString() + "//" + alist.Capacity.ToString()); //return; //string path = Path.GetDirectoryName(@"c:\..\..\aaa"); //string path = Path.GetDirectoryName(Path.GetDirectoryName(@"c:\a")); //MessageBox.Show("'" + path + "'"); //return; //string folder = Path.GetFileName(@"C:\asd\aa"); //MessageBox.Show(folder); //return; //Test_Path(); //return; //XObjectManager.OnError += new XObjectExceptionHandler(XObjectManager_OnError); //Test_Body(); //return; Log = new LogControler(AppName); LogHelper.EnableApplicationLogging(Log); LogHelper.EnableXmlLogging(Log); Log.WriteAppStart(AppName); ConfigMgt = new ConfigManager <NTServiceHostConfig>(AppConfigFileName); if (ConfigMgt.Load()) { Log.Write("Load config succeeded. " + ConfigMgt.FileName); } else { Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName); Log.Write(ConfigMgt.LastError); MessageBox.Show("Cannot load configuration file."); return; } //Test_Header(); //Test_Message(); //Test_SubscribeCriteria(); //Test_EntityContract(); //Test_EntityConfig(); //Test_ConfigMgt(); //return; //AppDomain.CurrentDomain.AppendPrivatePath(@"D:\ClearCase\10095177_GCGateway_view_dev_mobile\gcgateway\XDS-Gateway\SRC\Messaging\DemoFileAdapter\bin\Debug"); //string str = AppDomain.CurrentDomain.RelativeSearchPath; //str = AppDomain.CurrentDomain.DynamicDirectory; System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.Run(new Form1()); Log.WriteAppExit(AppName); }