From 538ba06221272015d79b32a445bb852af3dc1d6e Mon Sep 17 00:00:00 2001 From: phantomix Date: Sun, 27 Mar 2022 18:21:08 +0200 Subject: [PATCH] 2022-03-27 Fixed Windows \r\n TextBox issues by replacing \n->\r\n and back to \n when handling TextBox contents --- Program.cs | 2 +- view/frmCommentChanges.cs | 2 +- view/frmEditEntry.cs | 4 ++-- view/frmMoneyTransfer.cs | 4 ++-- view/frmMv.cs | 15 ++++++++------- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Program.cs b/Program.cs index 28e7db2..c651764 100644 --- a/Program.cs +++ b/Program.cs @@ -23,7 +23,7 @@ namespace dezentrale { public class Program { - public static uint VersionNumber { get; private set; } = 0x22010700; + public static uint VersionNumber { get; private set; } = 0x22032700; public static string VersionString { get; private set; } = $"{VersionNumber:x}"; public static string AppData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); diff --git a/view/frmCommentChanges.cs b/view/frmCommentChanges.cs index 6ee83e0..43661e7 100644 --- a/view/frmCommentChanges.cs +++ b/view/frmCommentChanges.cs @@ -34,7 +34,7 @@ namespace dezentrale.view private void btnOk_Click(object sender, EventArgs e) { - Comment = tbComment.Text; + Comment = tbComment.Text.Replace("\r\n", "\n"); this.Close(); } } diff --git a/view/frmEditEntry.cs b/view/frmEditEntry.cs index 69a1c7a..36bf7b5 100644 --- a/view/frmEditEntry.cs +++ b/view/frmEditEntry.cs @@ -611,7 +611,7 @@ namespace dezentrale.view cbPaymentNotification.Checked = member.PaymentNotify; tbBankTransferRegEx.ReadOnly = !cbEvaluateAccountInCharge.Checked; tbBankTransferRegEx.Text = member.BankTransferRegEx; - tbRemarks.Text = member.Remarks; + tbRemarks.Text = member.Remarks.Replace("\n", "\r\n"); this.ResumeLayout(false); } @@ -693,7 +693,7 @@ namespace dezentrale.view member.BankAccountInCharge = tbBankAccountInCharge.Text; member.PaymentNotify = cbPaymentNotification.Checked; member.BankTransferRegEx = tbBankTransferRegEx.Text; - member.Remarks = tbRemarks.Text; + member.Remarks = tbRemarks.Text = member.Remarks.Replace("\r\n", "\n"); //member.FinishLogEvent(); //implicit in SaveToFile() this.DialogResult = DialogResult.OK; diff --git a/view/frmMoneyTransfer.cs b/view/frmMoneyTransfer.cs index 68a8837..01caae6 100644 --- a/view/frmMoneyTransfer.cs +++ b/view/frmMoneyTransfer.cs @@ -431,7 +431,7 @@ namespace dezentrale.view cbCurrency.SelectedIndex = 1; } typeVal = mt.TransferType; - tbTransferReason.Text = mt.TransferReason; + tbTransferReason.Text = mt.TransferReason.Replace("\n", "\r\n"); } foreach (MoneyTransfer.eTransferType type in Enum.GetValues(typeof(MoneyTransfer.eTransferType))) @@ -495,7 +495,7 @@ namespace dezentrale.view mt.ValutaDate = valutaDate.Value; mt.Amount = core.Utils.StringToInt64FP(tbAmount.Text); mt.Currency = cbCurrency.Text; - mt.TransferReason = tbTransferReason.Text; + mt.TransferReason = tbTransferReason.Text.Replace("\r\n", "\n"); if (mt.GetType() == typeof(CashTransfer)) { diff --git a/view/frmMv.cs b/view/frmMv.cs index d01962b..fca98fc 100644 --- a/view/frmMv.cs +++ b/view/frmMv.cs @@ -294,11 +294,11 @@ namespace dezentrale.view mv.EventDate = dt; mv.Place = tbPlace.Text; - mv.Agenda = tbMvAgenda.Text; + mv.Agenda = tbMvAgenda.Text.Replace("\r\n", "\n"); mv.InviteHeadline = tbInviteHeadline.Text; - mv.InviteBody = tbInviteBody.Text; + mv.InviteBody = tbInviteBody.Text.Replace("\r\n", "\n"); - mv.Protocol = tbMvProtocol.Text; + mv.Protocol = tbMvProtocol.Text.Replace("\r\n", "\n"); } private void BuildPageInvitationSettings(Control parent) @@ -500,12 +500,13 @@ namespace dezentrale.view if (e.KeyChar != 13) return; e.KeyChar = (char)0; bool foundAuthCode = false; + string searchText = tbAuthCodePaste.Text.ToUpper(); foreach(MvInvitedMember mvi in mv.Members) { if (string.IsNullOrEmpty(mvi.AuthCode)) continue; - if (tbAuthCodePaste.Text.Contains(mvi.AuthCode)) + if (searchText.Contains(mvi.AuthCode.ToUpper())) { foundAuthCode = true; mvi.AttendedMv = true; @@ -607,11 +608,11 @@ namespace dezentrale.view mvDate.Value = mv.EventDate; mvTime.Value = mv.EventDate; tbPlace.Text = mv.Place; - tbMvAgenda.Text = mv.Agenda; + tbMvAgenda.Text = mv.Agenda.Replace("\n", "\r\n"); tbInviteHeadline.Text = mv.InviteHeadline; - tbInviteBody.Text = mv.InviteBody; + tbInviteBody.Text = mv.InviteBody.Replace("\n", "\r\n"); - tbMvProtocol.Text = mv.Protocol; + tbMvProtocol.Text = mv.Protocol.Replace("\n", "\r\n"); UpdateGui();