答案是肯定;
的,您可以使用以下方法逃脱;;
:
/// <summary>
/// Escapes a value string by doubling any data-separator (semicolon) characters.
/// </summary>
/// <param name="value"></param>
/// <returns>Escaped value string</returns>
private static string Escape(string value)
{
value = value.Replace(String.Empty + CustomActionData.DataSeparator, String.Empty + CustomActionData.DataSeparator + CustomActionData.DataSeparator);
return value;
}
(https://github.com/wixtoolset/wix3/blob/wix311rtm/src/DTF/Libraries/WindowsInstaller/customactiondata.cs#L391-L400Unescape
;另见Parse
下文。)
可能更好的消息,您可以将数据作为原始字符串访问,并完全控制它的反序列化方式:
var rawString = session["CustomActionData"];
这就是所有Session.CustomActionData
正在做的事情:
/// <summary>
/// Gets custom action data for the session that was supplied by the caller.
/// </summary>
/// <seealso cref="DoAction(string,CustomActionData)"/>
public CustomActionData CustomActionData
{
get
{
if (this.customActionData == null)
{
this.customActionData = new CustomActionData(this[CustomActionData.PropertyName]);
}
return this.customActionData;
}
}
https://github.com/wixtoolset/wix3/blob/wix311rtm/src/DTF/Libraries/WindowsInstaller/Session.cs#L859-L874