From 16e161d6fcded3c61358dfdcd9ea58ac786896c3 Mon Sep 17 00:00:00 2001 From: krogenth Date: Wed, 27 Dec 2023 14:07:58 -0500 Subject: [PATCH] Fix description not saving (#59) * fix required level being limited to 5 * fixed description object not saving on edit --- src/G2DataGUI.Common/Data/Common/FixedLengthDescription.cs | 6 +++--- src/G2DataGUI.Common/Data/Common/FixedLengthName.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/G2DataGUI.Common/Data/Common/FixedLengthDescription.cs b/src/G2DataGUI.Common/Data/Common/FixedLengthDescription.cs index 2d5225c..5678f81 100644 --- a/src/G2DataGUI.Common/Data/Common/FixedLengthDescription.cs +++ b/src/G2DataGUI.Common/Data/Common/FixedLengthDescription.cs @@ -15,7 +15,7 @@ public string Description string description = ""; foreach (var character in _characters) { - description += Convert.ToChar(character); + description += character > 0 ? Convert.ToChar(character) : ' '; } return description.TrimEnd(); @@ -25,7 +25,7 @@ public string Description value = value.PadRight((int)MaxLength, ' '); for (int index = 0; index < MaxLength; index++) { - _characters[index] = Convert.ToByte(_characters[index]); + _characters[index] = Convert.ToByte(value[index]); } } } @@ -43,4 +43,4 @@ public void WriteFixedLengthDescription(Stream writer) => writer.WriteRawByteArray(_characters); public static uint MaxLength { get => 40; } -} \ No newline at end of file +} diff --git a/src/G2DataGUI.Common/Data/Common/FixedLengthName.cs b/src/G2DataGUI.Common/Data/Common/FixedLengthName.cs index 38dffec..215fc8d 100644 --- a/src/G2DataGUI.Common/Data/Common/FixedLengthName.cs +++ b/src/G2DataGUI.Common/Data/Common/FixedLengthName.cs @@ -22,7 +22,7 @@ public string Name } set { - value = value.PadRight((int)MaxLength, ' '); + value = value.PadLeft((int)MaxLength, ' '); for (int index = 0; index < MaxLength; index++) { _characters[index] = Convert.ToByte(value[index]);