Fix serialization of custom exceptions.
This commit is contained in:
@@ -16,6 +16,7 @@ using System.Drawing.Imaging;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
@@ -24,6 +25,7 @@ namespace OpenRA
|
||||
{
|
||||
public static class FieldLoader
|
||||
{
|
||||
[Serializable]
|
||||
public class MissingFieldsException : YamlException
|
||||
{
|
||||
public readonly string[] Missing;
|
||||
@@ -42,6 +44,13 @@ namespace OpenRA
|
||||
Header = missing.Length > 1 ? header : headerSingle ?? header;
|
||||
Missing = missing;
|
||||
}
|
||||
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
base.GetObjectData(info, context);
|
||||
info.AddValue("Missing", Missing);
|
||||
info.AddValue("Header", Header);
|
||||
}
|
||||
}
|
||||
|
||||
public static Func<string, Type, string, object> InvalidValueAction = (s, t, f) =>
|
||||
|
||||
@@ -125,6 +125,7 @@ namespace OpenRA.Mods.Common.Commands
|
||||
world.IssueOrder(new Order(command, world.LocalPlayer.PlayerActor, false));
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
class DevException : Exception { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace OpenRA.Utility
|
||||
{
|
||||
[Serializable]
|
||||
public class NoSuchCommandException : Exception
|
||||
{
|
||||
public readonly string Command;
|
||||
@@ -22,6 +24,12 @@ namespace OpenRA.Utility
|
||||
{
|
||||
Command = command;
|
||||
}
|
||||
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
base.GetObjectData(info, context);
|
||||
info.AddValue("Command", Command);
|
||||
}
|
||||
}
|
||||
|
||||
class Program
|
||||
|
||||
Reference in New Issue
Block a user