2019-10-31 02:24:42 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-03 16:45:49 +00:00
|
|
|
|
public static List<ICompilationStep> Deserialize(string stack, ACompiler compiler)
|
2019-10-31 02:24:42 +00:00
|
|
|
|
{
|
|
|
|
|
return stack.FromJSONString<List<IState>>(TypeNameHandling.Auto, TypeNameAssemblyFormatHandling.Simple)
|
|
|
|
|
.Select(s => s.CreateStep(compiler)).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|