mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
22 lines
732 B
C#
22 lines
732 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Newtonsoft.Json;
|
|
using Wabbajack.Common;
|
|
|
|
namespace Wabbajack.Lib.CompilationSteps
|
|
{
|
|
public static class Serialization
|
|
{
|
|
public static string Serialize(IEnumerable<ICompilationStep> stack)
|
|
{
|
|
return stack.Select(s => s.GetState()).ToList()
|
|
.ToJSON(TypeNameHandling.Auto, TypeNameAssemblyFormatHandling.Simple);
|
|
}
|
|
|
|
public static List<ICompilationStep> Deserialize(string stack, ACompiler compiler)
|
|
{
|
|
return stack.FromJSONString<List<IState>>(TypeNameHandling.Auto, TypeNameAssemblyFormatHandling.Simple)
|
|
.Select(s => s.CreateStep(compiler)).ToList();
|
|
}
|
|
}
|
|
} |