mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-22 23:45:37 +00:00
Add internal Config support (#5)
* Add internal Logging support
Add class Logging.
Replace all Console.WriteLine() to looks better.
Add informations inside Windows Titles.
* Revert "Add internal Logging support"
This reverts commit 275d363aaf
.
* Add internal Logging support
Add Logging Class.
Replace all Console.WriteLine() to looks better.
Add debug informations of IpcMessage.
Add informations inside Windows Titles.
* Add internal Logging support2
Add Logging Class.
Replace all Console.WriteLine() to looks better.
Add debug informations of IpcMessage.
Add informations inside Windows Titles.
* Add internal Config support
Add Config Class.
Add Ryujinx.conf file (Ini file).
Use the Config Class inside Logging.
* Add internal Config support
Add Config Class.
Add Ryujinx.conf file (Ini file).
Use the Config Class inside Logging.
This commit is contained in:
parent
aba75186e9
commit
5ecfb5c657
|
@ -9,6 +9,8 @@ namespace Ryujinx
|
|||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Config.Read();
|
||||
|
||||
Console.Title = "Ryujinx Console";
|
||||
|
||||
IGalRenderer Renderer = new OpenGLRenderer();
|
||||
|
|
20
Ryujinx.conf
Normal file
20
Ryujinx.conf
Normal file
|
@ -0,0 +1,20 @@
|
|||
#Enabled print informations logs
|
||||
Logging_Enable_Info = true
|
||||
|
||||
#Enabled print trace logs
|
||||
Logging_Enable_Trace = true
|
||||
|
||||
#Enabled print debug logs
|
||||
Logging_Enable_Debug = true
|
||||
|
||||
#Enabled print warning logs
|
||||
Logging_Enable_Warn = true
|
||||
|
||||
#Enabled print error logs
|
||||
Logging_Enable_Error = true
|
||||
|
||||
#Enabled print fatal logs
|
||||
Logging_Enable_Fatal = true
|
||||
|
||||
#Saved logs into Ryujinx.log
|
||||
Logging_Enable_LogFile = false
|
54
Ryujinx/Config.cs
Normal file
54
Ryujinx/Config.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ryujinx
|
||||
{
|
||||
public static class Config
|
||||
{
|
||||
public static bool LoggingEnableInfo { get; private set; }
|
||||
public static bool LoggingEnableTrace { get; private set; }
|
||||
public static bool LoggingEnableDebug { get; private set; }
|
||||
public static bool LoggingEnableWarn { get; private set; }
|
||||
public static bool LoggingEnableError { get; private set; }
|
||||
public static bool LoggingEnableFatal { get; private set; }
|
||||
public static bool LoggingEnableLogFile { get; private set; }
|
||||
|
||||
public static void Read()
|
||||
{
|
||||
IniParser Parser = new IniParser("Ryujinx.conf");
|
||||
|
||||
LoggingEnableInfo = Convert.ToBoolean(Parser.Value("Logging_Enable_Info"));
|
||||
LoggingEnableTrace = Convert.ToBoolean(Parser.Value("Logging_Enable_Trace"));
|
||||
LoggingEnableDebug = Convert.ToBoolean(Parser.Value("Logging_Enable_Debug"));
|
||||
LoggingEnableWarn = Convert.ToBoolean(Parser.Value("Logging_Enable_Warn"));
|
||||
LoggingEnableError = Convert.ToBoolean(Parser.Value("Logging_Enable_Error"));
|
||||
LoggingEnableFatal = Convert.ToBoolean(Parser.Value("Logging_Enable_Fatal"));
|
||||
LoggingEnableLogFile = Convert.ToBoolean(Parser.Value("Logging_Enable_LogFile"));
|
||||
}
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/37772571
|
||||
public class IniParser
|
||||
{
|
||||
private Dictionary<string, string> Values;
|
||||
|
||||
public IniParser(string Path)
|
||||
{
|
||||
Values = File.ReadLines(Path)
|
||||
.Where(Line => (!String.IsNullOrWhiteSpace(Line) && !Line.StartsWith("#")))
|
||||
.Select(Line => Line.Split(new char[] { '=' }, 2, 0))
|
||||
.ToDictionary(Parts => Parts[0].Trim(), Parts => Parts.Length > 1 ? Parts[1].Trim() : null);
|
||||
}
|
||||
|
||||
public string Value(string Name, string Value = null)
|
||||
{
|
||||
if (Values != null && Values.ContainsKey(Name))
|
||||
{
|
||||
return Values[Name];
|
||||
}
|
||||
return Value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,13 +10,13 @@ namespace Ryujinx
|
|||
private static Stopwatch ExecutionTime = new Stopwatch();
|
||||
private static string LogFileName = "Ryujinx.log";
|
||||
|
||||
public static bool EnableInfo = true;
|
||||
public static bool EnableTrace = true;
|
||||
public static bool EnableDebug = true;
|
||||
public static bool EnableWarn = true;
|
||||
public static bool EnableError = true;
|
||||
public static bool EnableFatal = true;
|
||||
public static bool EnableLogFile = false;
|
||||
public static bool EnableInfo = Config.LoggingEnableInfo;
|
||||
public static bool EnableTrace = Config.LoggingEnableTrace;
|
||||
public static bool EnableDebug = Config.LoggingEnableDebug;
|
||||
public static bool EnableWarn = Config.LoggingEnableWarn;
|
||||
public static bool EnableError = Config.LoggingEnableError;
|
||||
public static bool EnableFatal = Config.LoggingEnableFatal;
|
||||
public static bool EnableLogFile = Config.LoggingEnableLogFile;
|
||||
|
||||
static Logging()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue