From f2b9a9c2b0a3d7af3b56df9ae09db8a3b2d8506c Mon Sep 17 00:00:00 2001 From: emmauss Date: Thu, 6 Feb 2020 11:25:47 +0000 Subject: Render Profiler in GUI (#854) * move profiler output to gui * addressed commits, rebased * removed whitespaces --- Ryujinx.Profiler/ProfilerConfiguration.cs | 70 ------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 Ryujinx.Profiler/ProfilerConfiguration.cs (limited to 'Ryujinx.Profiler/ProfilerConfiguration.cs') diff --git a/Ryujinx.Profiler/ProfilerConfiguration.cs b/Ryujinx.Profiler/ProfilerConfiguration.cs deleted file mode 100644 index 4fe616fa..00000000 --- a/Ryujinx.Profiler/ProfilerConfiguration.cs +++ /dev/null @@ -1,70 +0,0 @@ -using OpenTK.Input; -using System; -using System.IO; -using Utf8Json; -using Utf8Json.Resolvers; - -namespace Ryujinx.Profiler -{ - public class ProfilerConfiguration - { - public bool Enabled { get; private set; } - public string DumpPath { get; private set; } - public float UpdateRate { get; private set; } - public int MaxLevel { get; private set; } - public int MaxFlags { get; private set; } - public float History { get; private set; } - - public ProfilerKeyboardHandler Controls { get; private set; } - - /// - /// Loads a configuration file from disk - /// - /// The path to the JSON configuration file - public static ProfilerConfiguration Load(string path) - { - var resolver = CompositeResolver.Create( - new[] { new ConfigurationEnumFormatter() }, - new[] { StandardResolver.AllowPrivateSnakeCase } - ); - - if (!File.Exists(path)) - { - throw new FileNotFoundException($"Profiler configuration file {path} not found"); - } - - using (Stream stream = File.OpenRead(path)) - { - return JsonSerializer.Deserialize(stream, resolver); - } - } - - private class ConfigurationEnumFormatter : IJsonFormatter - where T : struct - { - public void Serialize(ref JsonWriter writer, T value, IJsonFormatterResolver formatterResolver) - { - formatterResolver.GetFormatterWithVerify() - .Serialize(ref writer, value.ToString(), formatterResolver); - } - - public T Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver) - { - if (reader.ReadIsNull()) - { - return default(T); - } - - string enumName = formatterResolver.GetFormatterWithVerify() - .Deserialize(ref reader, formatterResolver); - - if (Enum.TryParse(enumName, out T result)) - { - return result; - } - - return default(T); - } - } - } -} -- cgit v1.2.3