static void Main() { LoggerBuilder.Init(LogTemplate.GetLogTemp(ConfigSystem.ReadConfig("Config", "Log", "Path"))).Set("Server").Info("Server Program Start"); FactoryDao.CreateInstance(ConfigSystem.ReadConfig("Config", "DB", "Connection"), ConfigSystem.ReadConfig("Config", "Log", "Path")); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); }
static void Main(string[] args) { Logger logger = null; try { if (Debug.IsDebug()) { args = new String[] { Debug.GetDebugKey(), Debug.GetDebugParam() }; } if (args.Length != 2) { throw new ScraperException("Parameter Length Error " + args.Length); } logger = LoggerBuilder.Init(LogTemplate.GetLogTemp(ConfigSystem.ReadConfig("Config", "Log", "WritePath") + "\\" + args[0] + ".log")).Set("Server").Info("Client Program Start"); logger.Debug("arg[0] : " + args[0]); logger.Debug("arg[1] : " + args[1]); FactoryDao.CreateInstance(ConfigSystem.ReadConfig("Config", "DB", "Connection"), ConfigSystem.ReadConfig("Config", "Temp", "Path")); IScrapingStatusDao dao = FactoryDao.GetInstance().GetDao <IScrapingStatusDao>(); if (!Debug.IsDebug()) { ScrapingStatus entity = dao.GetEntity(args[0]); if (entity == null) { throw new ScraperException("Nothing entity " + args[0]); } if (entity.Status != "0") { throw new ScraperException("entity status" + args[0]); } entity.Status = "1"; dao.Update(entity); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ScraperContext(args[0], args[1])); } catch (Exception e) { if (logger != null) { logger.Error(e.ToString()); } Exit(); } }
static void Main() { string mtxName = "WebScraping"; Mutex mtx = new Mutex(true, mtxName); TimeSpan tsWait = new TimeSpan(0, 0, 1); bool success = mtx.WaitOne(tsWait); if (!success) { MessageBox.Show("이미실행중입니다."); return; } LoggerBuilder.Init(LogTemplate.GetLogTemp(ConfigSystem.ReadConfig("Config", "Log", "WritePath") + "\\Broker.log")); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Main()); }
static void Main(string[] args) { Logger logger = null; try { String arg = null; if (Debug.IsDebug()) { arg = Debug.GetDebugParam(); } else { if (args.Length != 1) { throw new ScraperException("Parameter Length Error " + args.Length); } byte[] buffer = Convert.FromBase64String(args[0]); arg = Encoding.UTF8.GetString(buffer); } Parameter param = JsonConvert.DeserializeObject <Parameter>(arg); logger = LoggerBuilder.Init(LogTemplate.GetLogTemp(ConfigSystem.ReadConfig("Config", "Log", "WritePath") + "\\" + param.Key + ".log")).Set("Server").Info("Client Program Start"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (Debug.IsDebug()) { Application.Run(new ScraperForm(param)); } else { Application.Run(new ScraperContext(param)); } } catch (Exception e) { if (logger != null) { logger.Error(e.ToString()); } Exit(); } }