コード例 #1
0
        private void SelectPhase(Phase phase, string errorMessage = null, WhatsGoingOn whatsGoingOn = null)
        {
            CurrentPhase = phase;

            switch (phase)
            {
            case Phase.Options:
                Resize(740d, 460d, false);
                var manual = CreateExtraDialogButton(AppStrings.CarPreviews_Manual,
                                                     new AsyncCommand(() => RunShootingProcess(true), () => CanBeSaved).ListenOnWeak(this, nameof(CanBeSaved)));
                manual.ToolTip = AppStrings.CarPreviews_Manual_Tooltip;
                Buttons        = new[] {
                    CreateExtraStyledDialogButton("Go.Button", AppStrings.Common_Go,
                                                  new AsyncCommand(() => RunShootingProcess(), () => CanBeSaved).ListenOnWeak(this, nameof(CanBeSaved))),
                    ApplyImmediately ? null : manual,
                    CreateExtraDialogButton("Switch To CM Showroom",
                                            new DelegateCommand(() => {
                        Close();
                        SettingsHolder.CustomShowroom.CustomShowroomPreviews = true;
                        _toUpdate.Run(UpdatePreviewMode.Options);
                    }).ListenOnWeak(this, nameof(CanBeSaved)),
                                            toolTip: "It’s faster, more reliable and has some additional effects such as SSLR or PCSS"),
                    CloseButton
                };
                break;

            case Phase.Waiting:
                Resize(540d, 400d, false);
                Buttons = new[] { CancelButton };
                break;

            case Phase.Result:
                Resize(540d, 400d, true);
                Buttons = new[] { OkButton, CancelButton };
                break;

            case Phase.ResultSummary:
                Resize(540d, Errors.Count > 0 ? 600d : 400d, true);
                Buttons = new[] { OkButton };
                break;

            case Phase.Error:
                Resize(null, null, false);
                ErrorMessage = (whatsGoingOn?.GetDescription() ?? errorMessage)?.ToSentence();
                if (whatsGoingOn?.Fix != null)
                {
                    Buttons = new[] {
                        this.CreateFixItButton(whatsGoingOn.Solution),
                        OkButton
                    };
                }
                else
                {
                    Buttons = new[] { OkButton };
                }

                break;
            }
        }
コード例 #2
0
 public UpdatePreviewError([NotNull] ToUpdatePreview toUpdate, [NotNull] string message, [CanBeNull] WhatsGoingOn whatsGoingOn)
 {
     ToUpdate     = toUpdate;
     Message      = message;
     WhatsGoingOn = whatsGoingOn;
 }
コード例 #3
0
ファイル: CommonFixes.cs プロジェクト: windygu/actools
            public WhatsGoingOn Detect(string log, string crash)
            {
                if (log.Contains(@"Flame V1: texture not found"))
                {
                    return(new WhatsGoingOn(WhatsGoingOnType.FlamesV1TextureNotFound)
                    {
                        Fix = FixOldFlames(WhatsGoingOn.GetCarsIds(log)),
                        FixAffectingDataOriginalLog = log
                    });
                }

                if (log.Contains(@": AIDriver::updateTyres") && log.Contains("getVKMForMult"))
                {
                    var ids = WhatsGoingOn.GetCarsIds(log).ToList();
                    if (IsDefaultTyresIndexWrong(ids))
                    {
                        return(new WhatsGoingOn(WhatsGoingOnType.DefaultTyresIndexMightBeWrong)
                        {
                            Fix = FixDefaultTyresIndex(ids),
                            FixAffectingDataOriginalLog = log
                        });
                    }

                    return(new WhatsGoingOn(WhatsGoingOnType.TyresMightBeWrong));
                }

                if (log.Contains(@"FlameStart : Flash textures are missing!"))
                {
                    return(new WhatsGoingOn(WhatsGoingOnType.FlamesFlashTexturesAreMissing)
                    {
                        Fix = FixMissingFlamesTextures(WhatsGoingOn.GetCarsIds(log))
                    });
                }

                if (log.Contains(@"COULD NOT FIND SUSPENSION OBJECT SUSP_"))
                {
                    return(new WhatsGoingOn(WhatsGoingOnType.SuspensionIsMissing)
                    {
                        Fix = FixMissingSuspNodes(WhatsGoingOn.GetCarsIds(log))
                    });
                }

                if (log.Contains(@"Error, cannot initialize Post Processing, system/cfg/ppfilters/default.ini not found"))
                {
                    return(new WhatsGoingOn(WhatsGoingOnType.DefaultPpFilterIsMissing)
                    {
                        Fix = FixMissingDefaultPpFilter
                    });
                }

                {
                    var match = Regex.Match(log, @"ERROR: Shader (.+) NOT FOUND, RETURNING NULL");
                    if (match.Success)
                    {
                        var shader = match.Groups[1].Value;
                        Func <CancellationToken, Task> fix = null;

                        if (shader == @"ksSkyBox" && AcRootDirectory.Instance.Value != null)
                        {
                            var model = Regex.Matches(log, @"LOADING MODEL (.+\.kn5)").OfType <Match>().LastOrDefault();
                            if (model?.Success == true)
                            {
                                var filename = Path.Combine(AcRootDirectory.Instance.Value, model.Groups[1].Value);
                                fix = c => FixMissingKsSkyBoxShader(filename, c);
                            }
                        }
                        else
                        {
                            // If more shaders will be removed in the future, extend
                            return(null);
                        }

                        return(new WhatsGoingOn(WhatsGoingOnType.ShaderIsMissing, match.Groups[1].Value)
                        {
                            Fix = fix
                        });
                    }
                }

                return(null);
            }