AddSurvivor(BlissHiveLogSurvivor survivor, LinkedList <BlissHiveLogActivityItem> activityItems) { LinkedList <BlissHiveLogActivityItem> result = new LinkedList <BlissHiveLogActivityItem>(); foreach (BlissHiveLogActivityItem activityItem in activityItems) { result.AddLast( new BlissHiveLogSurvivorActivityItem( survivor, activityItem.quantity, activityItem.item, activityItem.timestamp ) ); } return(result); }
void blissHivePlayerTree_AfterSelect(object sender, TreeViewEventArgs e) { if ((String)e.Node.Tag == "survivor") { this.dayzLogParserForm.blissHiveCardControl.SelectedIndex = 0; this.dayzLogParserForm.blissHivePlayerName.Text = "Player " + e.Node.Text; foreach (BlissHiveLogSurvivor survivor in LogController.GetInstance().blissHiveLogContainer.survivorContainer.survivors) { if (survivor.username == e.Node.Text) { this.selectedSurvivor = survivor; // Fill the formatted data control this.dayzLogParserForm.blissHivePlayerDataFormattedLogDataListView.Items.Clear(); foreach (BlissHiveLogEntry logEntry in survivor.logEntries) { this.dayzLogParserForm.blissHivePlayerDataFormattedLogDataListView.Items.Add( new ListViewItem( new String[3] { logEntry.timestamp, logEntry.functionName, String.Join(", ", logEntry.parameters) } ) ); } // Fill the raw data control StringBuilder stringBuilder = new StringBuilder(""); foreach (BlissHiveLogEntry logEntry in survivor.logEntries) { stringBuilder.AppendLine(logEntry.original); } this.dayzLogParserForm.blissHivePlayerDataRawLogDataTextBox.Text = stringBuilder.ToString(); // Fill the combo box for the inventories ComboBox inventoryComboBox = this.dayzLogParserForm.blissHivePlayerDataInventoryHistoryComboBox; inventoryComboBox.Items.Clear(); foreach (BlissHiveLogInventory inv in survivor.inventories) { inventoryComboBox.Items.Add(inv.originalLogEntry.timestamp); } // If selected, the list views will clear & fill if (inventoryComboBox.Items.Count > 0) { inventoryComboBox.SelectedIndex = inventoryComboBox.Items.Count - 1; } else { // If not selected, the list views need to be cleared still this.dayzLogParserForm .blissHivePlayerDataInventoryHistoryBackpackListView.Items.Clear(); this.dayzLogParserForm .blissHivePlayerDataInventoryHistoryInventoryListView.Items.Clear(); } // Fill the combo box for the debug log ComboBox debugMonitorComboBox = this.dayzLogParserForm.blissHivePlayerDataDebugMonitorHistoryComboBox; debugMonitorComboBox.Items.Clear(); foreach (BlissHiveLogDebugMonitor debug in survivor.debugMonitors) { debugMonitorComboBox.Items.Add(debug.originalLogEntry.timestamp); } // If selected, the list views will clear & fill if (debugMonitorComboBox.Items.Count > 0) { debugMonitorComboBox.SelectedIndex = debugMonitorComboBox.Items.Count - 1; } else { // If not selected, the list views need to be cleared still this.dayzLogParserForm .blissHivePlayerDataDebugMonitorHistoryListView.Items.Clear(); } // Fill the activity log ListView listView = this.dayzLogParserForm.blissHivePlayerDataActivityLogListView; listView.Items.Clear(); foreach (BlissHiveLogActivityItem item in survivor.activity) { ListViewItem listViewItem = new ListViewItem(new String[2] { item.timestamp + "", item.ToString() }); listView.Items.Add(listViewItem); } // Enable all the tabs! foreach (TabPage tab in this.dayzLogParserForm.blissHivePlayerDataTabControl.TabPages) { tab.Enabled = true; } this.dayzLogParserForm.blissHivePlayerDataTabControl.Enabled = true; } } } }
public override LogParseResult Parse() { LinkedList <LogParseResultEntry> result = new LinkedList <LogParseResultEntry>(); String currentUsername = ""; int count = 0; foreach (BlissHiveLogEntry entry in container.logs) { // Are we checking the stats now? if (entry.functionName == "proc_getSurvivorStats") { // Yes, is the user name already set? (Hope so!) if (currentUsername != "") { // Valid, normal result if (this.ContainsSurvivor(result, currentUsername)) { // Yay, it contained it! BlissHiveSurvivorLogParseResultEntry resultEntry = this.GetSurvivor(result, currentUsername); resultEntry.survivor.survivorUpdateID = entry.parameters[0]; resultEntry.survivor.logEntries.AddLast(entry); } else { // It wasn't there .. can't do much with just an update ID } // Reset the username currentUsername = ""; } else { // Shit .. we just missed someone's login name, best to drop it } } else if (entry.functionName == "proc_loginSurvivor") { // Did we already have a username set? if (currentUsername != "") { // It's already set, which means that the next updateSurvivor function call // will be either of this guy, or the previous guy. Can't tell, gotta skip both currentUsername = ""; } else { currentUsername = entry.parameters[1]; if (!this.ContainsSurvivor(result, currentUsername)) { // New survivor joined that wasn't in the log yet! BlissHiveLogSurvivor survivor = new BlissHiveLogSurvivor(currentUsername, entry.parameters[0]); BlissHiveSurvivorLogParseResultEntry resultEntry = new BlissHiveSurvivorLogParseResultEntry(entry, survivor); result.AddLast(resultEntry); survivor.logEntries.AddLast(entry); } else { // New survivor joined that was already in the logs foreach (BlissHiveSurvivorLogParseResultEntry resultEntry in result) { if (resultEntry.survivor.survivorID == entry.parameters[0]) { resultEntry.survivor.online = true; resultEntry.survivor.logEntries.AddLast(entry); break; } } } } } else if (entry.functionName == "proc_logLogout") { foreach (BlissHiveSurvivorLogParseResultEntry resultEntry in result) { if (resultEntry.survivor.survivorID == entry.parameters[0]) { resultEntry.survivor.online = false; resultEntry.survivor.logEntries.AddLast(entry); break; } } } else if (entry.functionName == "proc_updateSurvivor") { foreach (BlissHiveSurvivorLogParseResultEntry resultEntry in result) { if (resultEntry.survivor.survivorUpdateID == entry.parameters[0]) { resultEntry.survivor.lastSignOfActivity = entry.timestampUnix; resultEntry.survivor.logEntries.AddLast(entry); if (entry.parameters[1].Length > 5) { String[] split = entry.parameters[1].Replace("[", "") .Replace("]", "") .Split(','); String location = ""; // Sometimes the Z coordinate is missing .. sigh for (int i = 1; i < split.Length; i++) { location += split[i]; if (i < split.Length - 1) { location += ","; } } resultEntry.survivor.locations.AddLast(location); } break; } } } else if (entry.functionName == "proc_killSurvivor") { foreach (BlissHiveSurvivorLogParseResultEntry resultEntry in result) { if (resultEntry.survivor.survivorUpdateID == entry.parameters[0]) { resultEntry.survivor.logEntries.AddLast(entry); break; } } } this.onParseProgressListeners(count, this.container.logs.Length); count++; } double lastTimestampUnix = this.container.logs[container.logs.Length - 1].timestampUnix; foreach (BlissHiveSurvivorLogParseResultEntry resultEntry in result) { // If we didn't hear from someone for at least OFFLINE_MS_LIMIT if (lastTimestampUnix - resultEntry.survivor.lastSignOfActivity > BlissHiveSurvivorLogParser.OFFLINE_MS_LIMIT) { // He ain't online resultEntry.survivor.online = false; } } this.onParseProgressListeners = null; return(new LogParseResult(result)); }
public BlissHiveLogSurvivorActivityItem(BlissHiveLogSurvivor survivor, int quantity, BlissHiveLogItem item, String timestamp) : base(quantity, item, timestamp) { this.survivor = survivor; }
public BlissHiveSurvivorLogParseResultEntry(LogEntry entry, BlissHiveLogSurvivor survivor) : base(entry) { this.survivor = survivor; this.survivor.lastSignOfActivity = entry.timestampUnix; }