Пример #1
0
        private ShipsData LoadData(bool forceApi = false)
        {
            ShipsData results = null;
            if (!forceApi)
            {
                results = DeserializeShips();
            }
            //set range for max data age
            if (forceApi ||
               results == null ||
               results.DataCreatedAt == DateTime.MaxValue)
            {
                //put this somewhere safe sometime
                string key = File.ReadAllText("api.secret");
                ApiDAO api = new ApiDAO(key);
                results = api.GetAllShips();

            }
            return results;
        }