protected virtual void Prepare() { if (_prepared) { return; } _prepared = true; if (AcRoot == null) { throw new Exception("AcRoot is null"); } if (CarId == null) { throw new Exception("CarId is null"); } if (ShowroomId == null) { throw new Exception("ShowroomId is null"); } if (!Directory.Exists(AcPaths.GetShowroomDirectory(AcRoot, ShowroomId))) { throw new ShotingCancelledException("Showroom not found"); } if (UseBmp) { _changes.Add(new ScreenshotFormatChange(AcRoot, "BMP")); } if (DisableWatermark) { _changes.Add(new DisableShowroomWatermarkChange(AcRoot)); } if (DisableSweetFx) { _changes.Add(new DisableSweetFxChange(AcRoot)); } _changes.Add(new VideoIniChange(Filter, Fxaa, SpecialResolution, MaximizeVideoSettings)); if (TemporaryDirectory == null) { TemporaryDirectory = Path.GetTempPath(); } OutputDirectory = Path.Combine(TemporaryDirectory, "AcToolsShot_" + CarId + "_" + DateTime.Now.Ticks); Directory.CreateDirectory(OutputDirectory); }
private static string GetShowroomKn5([NotNull] string acRoot, [CanBeNull] string showroomValue) { try { if (showroomValue == null || File.Exists(showroomValue)) { return(showroomValue); } var kn5 = Path.Combine(AcPaths.GetShowroomDirectory(acRoot, showroomValue), $"{showroomValue}.kn5"); return(File.Exists(kn5) ? kn5 : null); } catch { // In case showroomValue is not a valid file path or something return(null); } }