-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
20 changed files
with
290 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace org.dmxc.wkdt.Tests | ||
{ | ||
public static class Tools | ||
{ | ||
public static byte[] Serialize(object value) | ||
{ | ||
#if !NET8_0_OR_GREATER | ||
byte[]? data = null; | ||
using (MemoryStream ms = new MemoryStream()) | ||
{ | ||
//Format the object as Binary | ||
|
||
BinaryFormatter formatter = new BinaryFormatter(); | ||
//It serialize the employee object | ||
#pragma warning disable SYSLIB0011 // Typ oder Element ist veraltet | ||
formatter.Serialize(ms, value); | ||
#pragma warning restore SYSLIB0011 // Typ oder Element ist veraltet | ||
data = ms.GetBuffer(); | ||
|
||
ms.Close(); | ||
} | ||
return data; | ||
#else | ||
return JsonSerializer.SerializeToUtf8Bytes(value); | ||
#endif | ||
} | ||
public static T? Deserialize<T>(byte[] data) | ||
{ | ||
|
||
#if !NET8_0_OR_GREATER | ||
using (MemoryStream ms = new MemoryStream(data)) | ||
{ | ||
BinaryFormatter formatter = new BinaryFormatter(); | ||
#pragma warning disable SYSLIB0011 // Typ oder Element ist veraltet | ||
return (T)formatter.Deserialize(ms); | ||
#pragma warning restore SYSLIB0011 // Typ oder Element ist veraltet | ||
} | ||
#else | ||
return JsonSerializer.Deserialize<T>(new ReadOnlySpan<byte>(data)); | ||
#endif | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,4 @@ | ||
global using NUnit.Framework; | ||
|
||
/* Nicht gemergte Änderung aus Projekt "WellKnownDataTypes-Tests (net7.0)" | ||
Vor: | ||
global using org.dmxc.wkdt; | ||
Nach: | ||
global using System; | ||
*/ | ||
|
||
/* Nicht gemergte Änderung aus Projekt "WellKnownDataTypes-Tests (net8.0)" | ||
Vor: | ||
global using org.dmxc.wkdt; | ||
Nach: | ||
global using System; | ||
*/ | ||
global using System.Buffers.Text; | ||
global using System.Runtime.Serialization.Formatters.Binary; | ||
global using System.Text.Json; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.