コード例 #1
0
        private static void ResetAppInfoFile()
        {
            if (ActionGuid.IsUpdateInstance || !File.Exists(CachePaths.AppInfo))
            {
                goto Reset;
            }

            try
            {
                var appInfo = FileEx.Deserialize <List <AppData> >(CachePaths.AppInfo, true);
                if (appInfo == default(List <AppData>))
                {
                    throw new ArgumentNullException(nameof(appInfo));
                }
                if (appInfo.Count < 430)
                {
                    throw new ArgumentOutOfRangeException(nameof(appInfo));
                }

                var fileInfo = new FileInfo(CachePaths.AppInfo);
                if ((DateTime.Now - fileInfo.LastWriteTime).TotalHours >= 1d)
                {
                    goto Reset;
                }

                _appInfo = appInfo;
                return;
            }
            catch (Exception ex)
            {
                Log.Write(ex);
            }

Reset:
            _appInfo = new List <AppData>();
            FileEx.TryDelete(CachePaths.AppInfo);
        }