public void reloadLog(string docId) { PropertyManager.getManager().setProperty("lootLogURI", docId); logURI = docId; loadEvents(); loadArmorTypes(); loadLogFeed(); }
public LootLog() { string log = PropertyManager.getManager().getProperty("lootLogURI"); if (log == null) { log = Constants.LOOT_ID; } reloadLog(log); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); GDriveManager.initialize(); Application.Run(new frmMain()); PropertyManager.getManager().close(); logger.Info("Closing..."); }
public bool setLogFile(string file) { if (File.Exists(file)) { logFilePath = file.Substring(0, file.LastIndexOf("\\")) + "\\"; logFileName = file.Substring(file.LastIndexOf("\\") + 1); PropertyManager.getManager().setProperty("EQlogFile", file); // parse current user name MatchCollection matches = userFromFileName.Matches(logFileName); if (matches.Count > 0) { PropertyManager.getManager().setProperty("UserName", matches[0].Groups[1].Value); } return(true); } return(false); }
private void lvTierSelection_ItemChecked(object sender, ItemCheckedEventArgs e) { String items = ""; foreach (ListViewItem i in lvTierSelection.CheckedItems) { items += i.Text + ","; } if (items.Length > 0) { items = items.Substring(0, items.Length - 1); } PropertyManager.getManager().setProperty(PropertyManager.LAST_TIER_SELECTED, items); if (!summaryRosterChanging) { getLootSummary(); } }
private void logReaderEvent(object sender, LogEventArgs e) { logger.Debug("logReaderEvent " + e.line); RichTextBox textBox = null; CheckBox checkBox = null; switch (e.type) { case LogReader.logTypes.OFFICER_CHAT: textBox = txtOfficerChat; checkBox = chkOfficerScroll; break; case LogReader.logTypes.GUILD_CHAT: textBox = txtGuildChat; checkBox = chkGuildScroll; break; case LogReader.logTypes.TELLS: textBox = txtTells; checkBox = chkTellsScroll; break; } // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (textBox != null) { if (textBox.InvokeRequired) { logger.Debug("Invoking for thread saftey..."); LogReaderEvent d = new LogReaderEvent(logReaderEvent); this.Invoke(d, new object[] { sender, e }); } else { logger.Debug("Setting the text..."); // Save the starting positions of the current cursor and selected text int start = textBox.SelectionStart; int len = textBox.SelectionLength; textBox.SelectionColor = Color.Black; // remove initial timestamp int firstChat = e.line.IndexOf(']') + 2; string theLine = e.line.Substring(firstChat, e.line.Length - firstChat); if (textBox == txtGuildChat) { bool isLootChat = guildLootChat.IsMatch(e.line) || (e.line.Split(new string[] { " // " }, StringSplitOptions.None).Length > 1); if (!isLootChat) { if (chkGuildLootOnly.Checked) { guildChatBuffer.Add(theLine); } else { if (textBox.Lines.Length > 0) { textBox.AppendText(Environment.NewLine); } textBox.AppendText(theLine); } } else { guildChatBuffer.Add(theLine); if (textBox.Lines.Length > 0) { textBox.AppendText(Environment.NewLine); } textBox.AppendText(theLine); } if (checkBox.Checked) { textBox.SelectionStart = textBox.Text.Length; } else { textBox.SelectionStart = start; textBox.SelectionLength = len; } } else { if (textBox.Lines.Length > 0) { textBox.AppendText(Environment.NewLine); } textBox.AppendText(theLine); } textBox.ScrollToCaret(); } } else if (e.type == LogReader.logTypes.LOOT) { // Group 0 is everything Group 1 Group 2 Group 3 //[Sun May 13 20:20:29 2018] --(You) have (looted) a (Enchanted Runestone).-- if (e.matches[0].Groups.Count == 4) { string userName = e.matches[0].Groups[1].Value; if ("You".Equals(userName)) { userName = PropertyManager.getManager().getProperty("UserName"); if (userName == null) { userName = "******"; } } string[] row = { userName, e.matches[0].Groups[3].Value }; this.Invoke(new MethodInvoker(delegate() { lootLogView.Items.Add(new ListViewItem(row)); } )); } } }
public frmMain() { InitializeComponent(); Refresh(); logger.Info("Main form initialized."); try { roster = new Roster(); lootLog = new LootLog(); logReader = new LogReader(); logReader.logEvent += new LogReaderEvent(logReaderEvent); itemListing = new ItemListing(); string savedFile = PropertyManager.getManager().getProperty("EQlogFile"); if (savedFile != null) { if (logReader.setLogFile(savedFile)) { logReader.start(); grpChatLogs.Text = String.Format("Chat Logs ({0})", savedFile); } } logRefresher = new Thread(updateLootLog); logRefresher.Start(); this.Text = "ROI Loot Manager - v" + Constants.PROGRAM_VERSION; Form mainFrm = this; timer.Elapsed += new System.Timers.ElapsedEventHandler( (object timerSender, ElapsedEventArgs timerEvent) => { mainFrm.Invoke(new MethodInvoker(delegate() { lblStatus.Text = ""; timer.Enabled = false; })); } ); timer.Interval = 2000; timer.Enabled = false; } catch (Exception e) { string message = "Could not get one of the worksheets used. A severe error occured or you may not have access. The program will close."; logger.Error(message, e); MessageBox.Show(message); System.Environment.Exit(-1); } cmbName.DataSource = roster.getActiveNames(); cmbName.DisplayMember = Roster.NAME_COL; cmbName.ValueMember = Roster.NAME_COL; cmbName.SelectedIndex = -1; cmbEvent.DataSource = lootLog.getEvents(); cmbEvent.DisplayMember = "shortName"; cmbEvent.ValueMember = "shortName"; cmbEvent.SelectedIndex = -1; cmbSlot.DataSource = lootLog.getArmorTypes(); cmbSlot.DisplayMember = "armorType"; cmbSlot.ValueMember = "armorType"; cmbSlot.SelectedIndex = -1; dteRaidDate.Value = DateTime.Today; loadRosterNames(); List <String> savedTierList = new List <String>(); string prop = PropertyManager.getManager().getProperty(PropertyManager.LAST_TIER_SELECTED); if (prop != null) { savedTierList.AddRange(prop.Split()); } List <String> tierList = lootLog.getTiers(); foreach (String t in tierList) { ListViewItem item = new ListViewItem(t); item.Text = t; item.Name = t; if (savedTierList.Contains(t)) { item.Checked = true; } lvTierSelection.Items.Add(item); } includeRots = false; chkIncludeRots.Checked = includeRots; dgvLootSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter); dgvVisibleSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter); dgvNonVisibleSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter); dgvWeaponSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter); lvRosterNames.ItemChecked += new ItemCheckedEventHandler(lvRosterNames_ItemChecked); lvTierSelection.ItemChecked += new ItemCheckedEventHandler(lvTierSelection_ItemChecked); lootLogView.ItemSelectionChanged += new ListViewItemSelectionChangedEventHandler(selectLoot); }