//Default Constructor public PinballData() { //Populate Default Objects to avoid null exceptions SystemList = new ObservableCollection <PinballSystem>(); TableList = new ObservableCollection <PinballTable>(); MediaLocation = new MediaLocation(); BIND = new Keybindings(); }
public void LoadDatabase(string databasepath) { logger.Info($"Loading Database {databasepath}"); try { //Load if database exists if (System.IO.File.Exists(databasepath)) { var temp = JsonConvert.DeserializeObject <PinballData>(System.IO.File.ReadAllText(databasepath)); if (temp.BIND != null) { BIND = temp.BIND; } if (temp.SystemList != null) { SystemList = temp.SystemList; } if (temp.TableList != null) { TableList = temp.TableList; } if (temp.MediaLocation != null) { MediaLocation = temp.MediaLocation; } } //Sort Database SortSystemsTables(); } catch (Exception e) { logger.Error(e, "LoadDatabase Error"); throw; } }