2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 17:39:39 -04:00
pulsar/ObservatoryFramework/Files/Converters/MissionEffectConverter.cs
Xjph 4c1031b8f9
Reorganize all observatory core projects into monorepo (#25)
* chore: move all observatory repos to core

* only save journal folder on change, don't constantly re-check during monitoring

* chore: monorepo project changes

* chore: monorepo migration
2021-10-21 19:31:32 -02:30

40 lines
1.2 KiB
C#

using System;
using System.Text.Json;
using System.Text.Json.Serialization;
using Observatory.Framework.Files.ParameterTypes;
namespace Observatory.Framework.Files.Converters
{
public class MissionEffectConverter : JsonConverter<MissionEffect>
{
public override MissionEffect Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string effect = reader.GetString();
//TODO: Find out all possible values
switch (effect)
{
case "+":
effect = "Low";
break;
case "++":
effect = "Med";
break;
case "+++++":
effect = "High";
break;
default:
break;
}
MissionEffect missionEffect = (MissionEffect)Enum.Parse(typeof(MissionEffect), effect, true);
return missionEffect;
}
public override void Write(Utf8JsonWriter writer, MissionEffect value, JsonSerializerOptions options)
{
throw new NotImplementedException();
}
}
}