1
0
Fork 0
forked from aly/qstbak

json writing

This commit is contained in:
Simon Latusek 2025-11-03 11:51:35 +01:00
parent f4b807679b
commit b6b2980285
4 changed files with 134 additions and 1 deletions

View file

@ -1,4 +1,8 @@
using System;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using Dalamud.Extensions.MicrosoftLogging;
using Dalamud.Game;
using Dalamud.Game.ClientState.Objects;
@ -23,6 +27,7 @@ using Questionable.Controller.Utils;
using Questionable.Data;
using Questionable.External;
using Questionable.Functions;
using Questionable.QuestPaths;
using Questionable.Validation;
using Questionable.Validation.Validators;
using Questionable.Windows;
@ -38,7 +43,10 @@ public sealed class QuestionablePlugin : IDalamudPlugin, IDisposable
private readonly ServiceProvider? _serviceProvider;
public QuestionablePlugin(IDalamudPluginInterface pluginInterface, IClientState clientState, ITargetManager targetManager, IFramework framework, IGameGui gameGui, IDataManager dataManager, ISigScanner sigScanner, IObjectTable objectTable, IPluginLog pluginLog, ICondition condition, IChatGui chatGui, ICommandManager commandManager, IAddonLifecycle addonLifecycle, IKeyState keyState, IContextMenu contextMenu, IToastGui toastGui, IGameInteropProvider gameInteropProvider, IAetheryteList aetheryteList)
{
{
File.WriteAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Quests.json"), JsonSerializer.Serialize(AssemblyQuestLoader.GetQuests().Select(pair => (pair.Key.GetType().Name + ": " + pair.Key.ToString(), pair.Value)).ToList(), new JsonSerializerOptions()
{ WriteIndented = true, IgnoreReadOnlyProperties = true, IncludeFields = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault, }));
ArgumentNullException.ThrowIfNull(pluginInterface, "pluginInterface");
ArgumentNullException.ThrowIfNull(chatGui, "chatGui");
try