File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ namespace Oxide.CSharp.Common
88{
99 internal static class Constants
1010 {
11- internal static readonly Serializer Serializer = new ( ) ;
1211 internal static readonly UTF8Encoding CompilerEncoding = new ( false ) ;
1312
1413 internal const string CompilerDownloadUrl = "https://downloads.oxidemod.com/artifacts/Oxide.Compiler/{0}/" ;
Original file line number Diff line number Diff line change 2020using Oxide . Plugins ;
2121using Oxide . Pooling ;
2222using References ::Mono . Unix . Native ;
23+ using System . Text . Json ;
2324
2425namespace Oxide . CSharp
2526{
@@ -343,7 +344,7 @@ private void OnMessageReceived(CompilerMessage message)
343344 }
344345 }
345346
346- CompilationResult ? compilationResult = Constants . Serializer . Deserialize < CompilationResult > ( message . Data ) ;
347+ CompilationResult ? compilationResult = JsonSerializer . Deserialize < CompilationResult > ( message . Data ) ;
347348 if ( compilationResult ? . Data == null || compilationResult . Data . Length == 0 )
348349 {
349350 compilation . Completed ( ) ;
@@ -615,7 +616,7 @@ private void EnqueueCompilation(Compilation compilation)
615616 {
616617 Id = compilation . id ,
617618 Type = MessageType . Data ,
618- Data = Constants . Serializer . Serialize ( compilerData ) ,
619+ Data = JsonSerializer . SerializeToUtf8Bytes ( compilerData ) ,
619620 } ;
620621
621622 if ( _ready )
Original file line number Diff line number Diff line change 88using Oxide . Core ;
99using Oxide . CSharp . Common ;
1010using Oxide . Pooling ;
11+ using System . Text . Json ;
1112
1213namespace Oxide . CSharp . CompilerStream
1314{
@@ -96,7 +97,7 @@ private void WriteMessage(CompilerMessage message)
9697 using StreamWriter streamWriter = new ( memoryStream , Constants . CompilerEncoding , DefaultMaxBufferSize ) ;
9798 try
9899 {
99- Constants . Serializer . GetJsonSerializer ( ) . Serialize ( streamWriter , message ) ;
100+ JsonSerializer . Serialize ( memoryStream , message ) ;
100101
101102 streamWriter . Flush ( ) ;
102103
@@ -142,7 +143,7 @@ private void WriteMessage(CompilerMessage message)
142143 read += OnRead ( messageBuffer , read , length - read ) ;
143144 }
144145
145- return Constants . Serializer . Deserialize < CompilerMessage > ( messageBuffer ) ;
146+ return JsonSerializer . Deserialize < CompilerMessage > ( messageBuffer ) ;
146147 }
147148 finally
148149 {
You can’t perform that action at this time.
0 commit comments