Browse Source

Fix `ResXResourceWriter` support for `MemoryStream` resource element

In newer runtime versions, MemoryStream is no longer a serializable type like it was in .NET Framework. This means explicit support has to be implemented for it.
pull/2895/head
ElektroKill 2 years ago
parent
commit
3e385bfc0a
No known key found for this signature in database
GPG Key ID: 7E3C5C084E40E3EC
  1. 7
      ICSharpCode.Decompiler/Util/ResXResourceWriter.cs

7
ICSharpCode.Decompiler/Util/ResXResourceWriter.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) 2018 Daniel Grunwald
// Copyright (c) 2018 Daniel Grunwald
// This file is based on the Mono implementation of ResXResourceWriter.
// It is modified to add support for "ResourceSerializedObject" values.
//
@ -263,6 +263,11 @@ namespace ICSharpCode.Decompiler.Util @@ -263,6 +263,11 @@ namespace ICSharpCode.Decompiler.Util
WriteBytes(name, value.GetType(), (byte[])value, comment);
return;
}
if (value is MemoryStream memoryStream)
{
WriteBytes(name, null, memoryStream.ToArray(), comment);
return;
}
if (value is ResourceSerializedObject rso)
{
var bytes = rso.GetBytes();

Loading…
Cancel
Save