private static int RunConversation(ConversationOptions options) { _log = LogFactory.Build(options.Verbose); _log.Info("Processing Conversations"); // Validate options DateTime start, end; try { start = options.StartTime ?? DateTime.UtcNow.AddMinutes(-15); end = options.EndTime ?? DateTime.UtcNow.AddMinutes(1); } catch (Exception e) { _log.Error(e.Message); return(1); } // Initialise connection var client = new FacebookClient(options.PageToken) { Version = "v2.10" }; FacebookPageDetails page; try { page = client.Get <FacebookPageDetails>("me"); _log.Info($"Connected: {page.id} ({page.name})"); } catch (FacebookOAuthException fbex) { _log.Error($"Cannot connect: {fbex.Message}"); return(1); } catch (Exception e) { _log.Error($"Something went wrong! {e.Message}"); return(1); } // Process try { var processor = new ConversationProcessor(_log, client, page, start, end, options); processor.Process(); } catch (Exception e) { _log.Error("Error during processing", e); return(1); } return(0); }
private void BackgroundWorkerOnProgressChanged(object sender, ProgressChangedEventArgs e) { RunnerLogger logger = (RunnerLogger)e.UserState; while (logger.Message.Count > 0) { UIElement logComponent = LogFactory.Build(Logger.Message.Dequeue()); SetLogVisibility(logComponent); logPanel.Children.Insert(0, logComponent); } // Other labels lblRuneCollect.Content = "Rune Collect: " + Logger.GetRunes; lblRuneSell.Content = "Rune Sell: " + Logger.SellRunes; lblFailedRuns.Content = "Failed Runs: " + Logger.FailedRuns; }
private void BackgroundWorkerRunCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled) { Logger.Log("Worker has been canceled!"); } else if (e.Error != null) { Logger.Log("There's an error with worker"); Logger.Log(e.ToString()); } else { Logger.Log("Worker has been stopped!"); } while (Logger.Message.Count > 0) { UIElement logComponent = LogFactory.Build(Logger.Message.Dequeue()); logPanel.Children.Insert(0, logComponent); } }
private void btnTestLog_Click(object sender, RoutedEventArgs e) { // Rune Rune rune1 = new Rune.RuneBuilder().Grade("6*").Set("Blade").Slot("4"). Rarity("Legendary").MainStat("ATK%").PrefixStat("DEF +5"). SubStat1("HP% +5").SubStat2("SPD +4").SubStat3("HP +200"). SubStat4("CRATE +6").Build(); Logger.Log(ACTION.GET, rune1); Thread.Sleep(1000); Rune rune2 = new Rune.RuneBuilder().Grade("4*").Set("Violent").Slot("4"). Rarity("Magic").MainStat("ATK%").PrefixStat("DEF +5"). SubStat1("HP% +5").SubStat2("SPD +4").SubStat3("HP +200"). SubStat4("CRATE +6").Build(); Logger.Log(ACTION.SELL, rune2); // Other Reward reward1 = new Reward("Item 1", REWARDTYPE.SUMMONSTONE); Reward reward2 = new Reward("Item 2", REWARDTYPE.GRINDSTONE); Logger.Log(ACTION.GET, reward1); Logger.Log(ACTION.SELL, reward2); // General Logger.Log("General log 1"); Logger.Log("General log 2"); Logger.Log("General log 3"); while (Logger.Message.Count > 0) { UIElement logComponent = LogFactory.Build(Logger.Message.Dequeue()); SetLogVisibility(logComponent); logPanel.Children.Insert(0, logComponent); } }
private static int RunFeed(FeedOptions options) { _log = LogFactory.Build(); _log.Error("Feed: Not Supported"); return(1); }