1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-01 10:13:30 +00:00

Fixed debug log removing wrong line at >50 lines

Wrapped LUA loading in try-catch
This commit is contained in:
SpoinkyNL 2016-11-12 19:42:08 +01:00
parent c172ec4c6a
commit c9481d4442
3 changed files with 15 additions and 9 deletions

View File

@ -16,8 +16,8 @@
<!--<GridViewColumn DisplayMemberBinding="{Binding LoggerName}" Header="Logger"/>--> <!--<GridViewColumn DisplayMemberBinding="{Binding LoggerName}" Header="Logger"/>-->
<GridViewColumn DisplayMemberBinding="{Binding Level}" Header="Level" /> <GridViewColumn DisplayMemberBinding="{Binding Level}" Header="Level" />
<GridViewColumn DisplayMemberBinding="{Binding TimeStamp, StringFormat=HH:mm:ss.ffffff}" Header="Time" /> <GridViewColumn DisplayMemberBinding="{Binding TimeStamp, StringFormat=HH:mm:ss.ffffff}" Header="Time" />
<GridViewColumn DisplayMemberBinding="{Binding FormattedMessage}" Width="600" Header="Message" /> <GridViewColumn DisplayMemberBinding="{Binding FormattedMessage}" Width="500" Header="Message" />
<GridViewColumn DisplayMemberBinding="{Binding Exception}" Width="Auto" Header="Exception" /> <GridViewColumn DisplayMemberBinding="{Binding Exception.Message}" Width="300" Header="Exception" />
</GridView.Columns> </GridView.Columns>
</GridView> </GridView>
</ListView.View> </ListView.View>

View File

@ -28,7 +28,7 @@ namespace Artemis.Controls.Log
await Dispatcher.InvokeAsync(() => await Dispatcher.InvokeAsync(() =>
{ {
if (LogCollection.Count >= 50) if (LogCollection.Count >= 50)
LogCollection.RemoveAt(LogCollection.Count - 1); LogCollection.RemoveAt(0);
LogCollection.Add(message); LogCollection.Add(message);
}); });

View File

@ -97,12 +97,18 @@ namespace Artemis.Profiles.Lua
LuaKeyboardWrapper?.Dispose(); LuaKeyboardWrapper?.Dispose();
LuaKeyboardWrapper = null; LuaKeyboardWrapper = null;
LuaScript.Globals.Clear(); try
LuaScript.Registry.Clear(); {
LuaScript.Registry.RegisterConstants(); LuaScript.Registry.RegisterConstants();
LuaScript.Registry.RegisterCoreModules(CoreModules.Preset_SoftSandbox); LuaScript.Registry.RegisterCoreModules(CoreModules.Preset_SoftSandbox);
LuaScript.Globals.RegisterConstants(); LuaScript.Globals.RegisterConstants();
LuaScript.Globals.RegisterCoreModules(CoreModules.Preset_SoftSandbox); LuaScript.Globals.RegisterCoreModules(CoreModules.Preset_SoftSandbox);
}
catch (NullReferenceException)
{
// Can be missing if the user script screwed up the globals
}
} }
} }