Skip to content

Commit

Permalink
Load ZeroFormatter assemblies in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Thealexbarney committed Jun 5, 2018
1 parent 49fb9d5 commit b80af3c
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions PqSave/Scripting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@ namespace PqSave
{
public static class Scripting
{
public static void RufnScript(SerializeData save)
{
var items = save.itemStorage;
short count = 999;

items.SetCount(Item.RedCommon, count);
items.SetCount(Item.RedUnCommon, count);
items.SetCount(Item.BlueCommon, count);
items.SetCount(Item.BlueUnCommon, count);
items.SetCount(Item.YellowCommon, count);
items.SetCount(Item.YellowUnCommon, count);
items.SetCount(Item.GreyCommon, count);
items.SetCount(Item.GreyUnCommon, count);
items.SetCount(Item.Rare, count);
items.SetCount(Item.Legend, count);
}

public static void SetCount(this ItemStorage items, Item type, short count)
{
Expand All @@ -40,15 +24,15 @@ public static void SetCount(this ItemStorage items, Item type, short count)

public static void RunScript(SerializeData save, string filename)
{
RufnScript(save);
Console.WriteLine();
Console.WriteLine($"Running {filename}...");

try
{
var script = File.ReadAllText(filename);
var scriptOptions = ScriptOptions.Default.AddReferences(Assembly.GetExecutingAssembly())
.AddImports("System", "System.Linq", "PqSave")
var scriptOptions = ScriptOptions.Default
.AddReferences(Assembly.GetExecutingAssembly(), typeof(ZeroFormatter.DirtyTracker).Assembly, typeof(ZeroFormatter.IKeyTuple).Assembly)
.AddImports("System", "System.Linq", "PqSave", "ZeroFormatter")
.WithSourceResolver(SourceFileResolver.Default)
.WithMetadataResolver(ScriptMetadataResolver.Default)
.WithEmitDebugInformation(true);
Expand Down

0 comments on commit b80af3c

Please sign in to comment.