/// <summary> /// Starts the log parse, with given filePath, and invokes if needed. /// </summary> /// <param name="filePath">The filepath of the file</param> public void StartLogParse(String filePath) { if (this.dayzLogParserForm.blissHiveDownloadProgressBar.InvokeRequired) { this.dayzLogParserForm.BeginInvoke(new MethodInvoker(delegate() { StartLogParse(filePath); })); } else { foreach (MenuItem item in this.dayzLogParserForm.fileMenuItem.MenuItems) { if ((String)item.Tag == "openFile") { item.Enabled = false; // Don't break // break; } } this.dayzLogParserForm.blissHiveDownloadLogBtn.Text = "Parsing.."; this.dayzLogParserForm.blissHiveDownloadLogBtn.Enabled = false; this.dayzLogParserForm.blissHiveProgressTimeRemainingLbl.Text = ""; this.dayzLogParserForm.blissHivePlayerName.Text = "Parsing log file.."; BlissHiveLogContainer blissHiveLogContainer = new BlissHiveLogContainer(); int maximum = blissHiveLogContainer.GetLogCount(filePath); this.dayzLogParserForm.blissHiveDownloadProgressBar.Minimum = 0; this.dayzLogParserForm.blissHiveDownloadProgressBar.Maximum = maximum; LogController.GetInstance().blissHiveLogContainer = blissHiveLogContainer; // Start a background worker to do calculating stuff outside of the UI thread BackgroundWorker bw = new BackgroundWorker(); bw.RunWorkerAsync(filePath); bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.WorkerSupportsCancellation = false; bw.WorkerReportsProgress = false; } }
public void ParseData(BlissHiveLogContainer container) { int count = 0; StringBuilder b = new StringBuilder(); foreach (BlissHiveLogSurvivor survivor in container.survivorContainer.survivors) { b.Append("survivor_" + count + "[]").Append("=").Append(survivor.username ?? "").Append("&"); b.Append("survivor_" + count + "[]").Append("=").Append(survivor.survivorUpdateID ?? "").Append("&"); foreach (String str in survivor.locations) { b.Append("survivor_" + count + "_locations[]").Append("=").Append(str).Append("&"); } count++; } this.data = b.ToString(); // this.data = String.Join("&", result.ToArray<String>()); }