Ejemplo n.º 1
0
 private static void RevertFileChanges()
 {
     PresetsPerModeBackup.Revert();
     WeatherSpecificCloudsHelper.Revert();
     WeatherSpecificTyreSmokeHelper.Revert();
     WeatherSpecificVideoSettingsHelper.Revert();
     CarSpecificControlsPresetHelper.Revert();
     CopyFilterToSystemForOculusHelper.Revert();
 }
Ejemplo n.º 2
0
 private static void RevertFileChanges()
 {
     PresetsPerModeBackup.Revert();
     WeatherSpecificCloudsHelper.Revert();
     WeatherSpecificTyreSmokeHelper.Revert();
     WeatherSpecificVideoSettingsHelper.Revert();
     WeatherSpecificLightingHelper.Revert();
     CarSpecificControlsPresetHelper.Revert();
     CarSpecificFanatecSettingsHelper.Revert();
     CarCustomDataHelper.Revert();
     CopyFilterToSystemForOculusHelper.Revert();
     AcShadowsPatcher.Revert();
 }
Ejemplo n.º 3
0
        private async void BackgroundInitialization()
        {
            try {
                await Task.Delay(1000);

                if (AppArguments.Has(AppFlag.TestIfAcdAvailable) && !Acd.IsAvailable())
                {
                    NonfatalError.NotifyBackground(@"This build can’t work with encrypted ACD-files");
                }

                if (AppUpdater.JustUpdated && SettingsHolder.Common.ShowDetailedChangelog)
                {
                    List <ChangelogEntry> changelog;
                    try {
                        changelog =
                            await Task.Run(() => AppUpdater.LoadChangelog().Where(x => x.Version.IsVersionNewerThan(AppUpdater.PreviousVersion)).ToList());
                    } catch (WebException e) {
                        NonfatalError.NotifyBackground(AppStrings.Changelog_CannotLoad, ToolsStrings.Common_MakeSureInternetWorks, e);
                        return;
                    } catch (Exception e) {
                        NonfatalError.NotifyBackground(AppStrings.Changelog_CannotLoad, e);
                        return;
                    }

                    Logging.Debug("Changelog entries: " + changelog.Count);
                    if (changelog.Any())
                    {
                        Toast.Show(AppStrings.App_AppUpdated, AppStrings.App_AppUpdated_Details, () => {
                            ModernDialog.ShowMessage(changelog.Select(x => $@"[b]{x.Version}[/b]{Environment.NewLine}{x.Changes}")
                                                     .JoinToString(Environment.NewLine.RepeatString(2)), AppStrings.Changelog_RecentChanges_Title,
                                                     MessageBoxButton.OK);
                        });
                    }
                }

                await Task.Delay(1500);

                PresetsPerModeBackup.Revert();
                WeatherSpecificCloudsHelper.Revert();
                WeatherSpecificTyreSmokeHelper.Revert();
                WeatherSpecificVideoSettingsHelper.Revert();
                CarSpecificControlsPresetHelper.Revert();
                CopyFilterToSystemForOculusHelper.Revert();

                await Task.Delay(1500);

                CustomUriSchemeHelper.EnsureRegistered();

                await Task.Delay(5000);

                await Task.Run(() => {
                    foreach (var f in from file in Directory.GetFiles(FilesStorage.Instance.GetDirectory("Logs"))
                             where file.EndsWith(@".txt") || file.EndsWith(@".log") || file.EndsWith(@".json")
                             let info = new FileInfo(file)
                                        where info.LastWriteTime < DateTime.Now - TimeSpan.FromDays(3)
                                        select info)
                    {
                        f.Delete();
                    }
                });
            } catch (Exception e) {
                Logging.Error(e);
            }
        }