/// <summary> /// Sets a string property. If value is null, the string property is deleted. /// </summary> public void SetStrPropValue(int tpt, string bstrVal) { if (bstrVal == null) { StringProperties.Remove(tpt); } else { StringProperties[tpt] = bstrVal.Length == 0 ? null : bstrVal; } }
/// <summary> /// Set a string property. If value is null and the length is 0, the string property is deleted. /// </summary> public void SetStrPropValueRgch(int tpt, byte[] rgchVal, int nValLength) { if (rgchVal == null && nValLength == 0) { StringProperties.Remove(tpt); } else { if (rgchVal == null) { throw new ArgumentNullException("rgchVal"); } var sb = new StringBuilder(); for (int i = 0; i < nValLength; i += 2) { sb.Append((char)(rgchVal[i + 1] << 8 | rgchVal[i])); } StringProperties[tpt] = sb.Length == 0 ? null : sb.ToString(); } }