Exemplo n.º 1
0
 //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();
 }
Exemplo n.º 2
0
        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;
            }
        }