public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { Manifest manifest = value as Manifest; writer.WriteStartObject(); writer.WritePropertyName("AssemblyName"); writer.WriteValue(manifest.AssemblyName); HookRef[] refs = new HookRef[manifest.Hooks.Count]; for (int i = 0; i < refs.Length; i++) { refs[i].Hook = manifest.Hooks[i]; refs[i].Type = refs[i].Hook.GetType().Name; refs[i].Hook.BaseHookName = refs[i].Hook.BaseHook != null ? refs[i].Hook.BaseHook.Name : null; } writer.WritePropertyName("Hooks"); serializer.Serialize(writer, refs); writer.WritePropertyName("Modifiers"); serializer.Serialize(writer, manifest.Modifiers); writer.WriteEndObject(); }
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { Manifest manifest = value as Manifest; writer.WriteStartObject(); writer.WritePropertyName("AssemblyName"); writer.WriteValue(Path.GetExtension(manifest.AssemblyName).Equals(".dll") ? Path.GetFileNameWithoutExtension(manifest.AssemblyName) : manifest.AssemblyName); HookRef[] refs = new HookRef[manifest.Hooks.Count]; for (int i = 0; i < refs.Length; i++) { refs[i].Hook = manifest.Hooks[i]; refs[i].Type = refs[i].Hook.GetType().Name; refs[i].Hook.BaseHookName = refs[i].Hook.BaseHook != null ? refs[i].Hook.BaseHook.Name : null; } writer.WritePropertyName("Hooks"); serializer.Serialize(writer, refs); writer.WriteEndObject(); }