private void DownloadChangeLogFinished(Updater.DownloadChangeLogResult result) { if (this.InvokeRequired) { Debug.WriteLine("Invoking download change log on update form."); Updater.DownloadChangeLogFinishedHandler updateFormInvoker = new Updater.DownloadChangeLogFinishedHandler(DownloadChangeLogFinished); this.Invoke(updateFormInvoker, result); } Program.updateHelper.updater.DownloadChangeLogFinished -= DownloadChangeLogFinished; if (result.Success) { //string[] lines = result.LogText.Split(("\n\r").ToCharArray(), StringSplitOptions.None); string[] lines = Regex.Split(result.LogText, @"\r?\n|\r"); richTextBoxChangeLog.Clear(); foreach (string line in lines) { if (line == "Change Log") { richTextBoxChangeLog.SelectionIndent = 0; richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold); richTextBoxChangeLog.AppendText(line + "\n"); richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 8.25f); } else { if (line.Contains("(") && line.Contains(")")) { richTextBoxChangeLog.SelectionIndent = 0; richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 10f, FontStyle.Bold); richTextBoxChangeLog.AppendText(line + "\n"); richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular); } else { richTextBoxChangeLog.SelectionIndent = 10; richTextBoxChangeLog.AppendText(line + "\n"); } } } } }
private void DownloadChangeLogFinished(Updater.DownloadChangeLogResult result) { if (this.InvokeRequired) { Debug.WriteLine("Invoking download change log on update form."); Updater.DownloadChangeLogFinishedHandler updateFormInvoker = new Updater.DownloadChangeLogFinishedHandler(DownloadChangeLogFinished); this.Invoke(updateFormInvoker, result); } Program.updateHelper.updater.DownloadChangeLogFinished -= DownloadChangeLogFinished; if (result.Success) { //string[] lines = result.LogText.Split(("\n\r").ToCharArray(), StringSplitOptions.None); string[] lines = Regex.Split(result.LogText, @"\r?\n|\r"); richTextBoxChangeLog.Clear(); foreach (string line in lines) { if (line == "Change Log") { richTextBoxChangeLog.SelectionIndent = 0; richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold); richTextBoxChangeLog.AppendText(line + "\n"); richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 8.25f); } else { if (line.Contains("(") && line.Contains(")")) { richTextBoxChangeLog.SelectionIndent = 0; richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 10f, FontStyle.Bold); richTextBoxChangeLog.AppendText(line + "\n"); richTextBoxChangeLog.SelectionFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular); } else { richTextBoxChangeLog.SelectionIndent = 10; richTextBoxChangeLog.AppendText(line + "\n"); } } } } }