public void SetString(CharacterSetBase characterSet, string text) { if (characterSet == null) { throw new SystemException("Character set must not be null."); } if (text == null || text.Length <= 0) { return; } var bytes = characterSet.TranslateString(text); foreach (var b in bytes) { SetByte(b); } }
public string GetString(CharacterSetBase characterSet, Word length) { if (characterSet == null) { throw new SystemException("Character set must not be null."); } if (length <= 0) { throw new SystemException("Length must be > 0."); } var bytes = new byte[length.Value]; for (var i = 0; i < length.Value; i++) { bytes[i] = GetByte(); } return(characterSet.TranslateString(bytes)); }