예제 #1
0
        internal bool TryReadHistory(FsPath file, out HistoryState state)
        {
            state = null;
            if (!file.IsFile())
            {
                return(false);
            }
            try
            {
                using (var fileReader = file.OpenText())
                {
                    using var jsonReader = new JsonTextReader(fileReader);
                    state = _serializer.Deserialize <HistoryState>(jsonReader);
                }

                return(true);
            }
            catch (Exception ex)
            {
                _log.Error(ex, "Failed to read history");
                return(false);
            }
        }