static void Main(string[] args) { Console.WriteLine("Creating timer: {0}\n", DateTime.Now.ToString("h:mm:ss")); try { PlurkApi.PlurkApi mApi = new PlurkApi.PlurkApi(GetConfig.GetApiKey()); mApi.login(GetConfig.GetUserName(), GetConfig.GetPassword()); TimerCallback callback = new TimerCallback(Tick); // create a one second timer tick Timer stateTimer = new Timer(callback, mApi, 0, GetConfig.GetTimerInterval()); // loop here forever for (; ; ) { try { if (!blnRoot) RootingJob(mApi); } catch (Exception ex) { Console.WriteLine("[Error]" + ex.Message); } } } catch (Exception ex) { //程式結束 Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); if (ex.InnerException != null) Console.WriteLine(ex.InnerException.Message); Console.WriteLine("Press enter to terminate process..."); Console.ReadLine(); } }