Skip to content
Snippets Groups Projects
Commit 207f8fcd authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Parser.cs: Remove warnings and change nullable

parent a4c37500
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,8 @@ interface Parser
void Init(StatusBar _bar, Module _module, ConfigSection section);
}
#nullable disable
[ParserName("text")]
class ParserText: Parser
{
......@@ -161,8 +163,8 @@ class ParserICENextStop: Parser
{
try
{
JsonObject? json = JsonObject.Parse(data).AsObject();
JsonObject? nextStop = null;
JsonObject json = JsonObject.Parse(data).AsObject();
JsonObject nextStop = null;
string nextStopID = json["trip"].AsObject()["stopInfo"].AsObject()["actualNext"].GetValue<string>();
foreach(var s in json["trip"].AsObject()["stops"].AsArray())
{
......
......@@ -98,8 +98,12 @@ abstract class StatusBar
foreach(var s in p)
{
#pragma warning disable 8600
string type = s["_type"] ?? s.SectionName;
#pragma warning restore 8600
#pragma warning disable 8604
var constructor = moduleTypes[type].GetConstructor(constructorSignature);
#pragma warning restore 8604
if(constructor == null)
throw new Exception($"Missing constructor of {type} module");
Module module = (Module) constructor.Invoke(new object[]{});
......@@ -227,7 +231,7 @@ class StatusBarPlainText: RootStatusBar
class StatusBarTerminal: RootStatusBar
{
Thread inputThread;
Thread? inputThread;
public StatusBarTerminal(FileInfo configFile, bool doInput):base(configFile)
{
if(doInput)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment