private IEnumerable Pack(AcCommonObject obj) { SetBasePath(GetBasePath(obj)); _current = obj; _subFiles = null; return(PackOverride(obj)); }
public void Pack(Stream outputZipStream, AcCommonObject obj) { var description = PackedDescription.ToString(new[] { GetDescriptionOverride(obj) }); using (var writer = WriterFactory.Open(outputZipStream, ArchiveType.Zip, CompressionType.Deflate)) { _writer = writer; _added.Clear(); Drain(Pack(obj), _cancellation); if (_cancellation.IsCancellationRequested) { return; } writer.WriteString("ReadMe.txt", description); } outputZipStream.AddZipDescription(description); }
protected void InitializeAcObjectPage([NotNull] ISelectedAcObjectViewModel model) { SelectedAcObject = model.SelectedAcObject; InputBindings.AddRange(new[] { new InputBinding(SelectedAcObject.CopyIdCommand, new KeyGesture(Key.C, ModifierKeys.Control)), new InputBinding(SelectedAcObject.CopyIdCommand, new KeyGesture(Key.C, ModifierKeys.Control | ModifierKeys.Shift)) { CommandParameter = @"name" }, new InputBinding(SelectedAcObject.CopyIdCommand, new KeyGesture(Key.C, ModifierKeys.Control | ModifierKeys.Alt)) { CommandParameter = @"path" }, new InputBinding(SelectedAcObject.ViewInExplorerCommand, new KeyGesture(Key.F, ModifierKeys.Control)), new InputBinding(SelectedAcObject.ReloadCommand, new KeyGesture(Key.R, ModifierKeys.Control)), new InputBinding(SelectedAcObject.ReloadCommand, new KeyGesture(Key.R, ModifierKeys.Control | ModifierKeys.Shift)) { CommandParameter = @"full" }, new InputBinding(SelectedAcObject.ToggleCommand, new KeyGesture(Key.D, ModifierKeys.Control)), new InputBinding(SelectedAcObject.SaveCommand, new KeyGesture(Key.S, ModifierKeys.Control)), new InputBinding(model.ChangeIdCommand, new KeyGesture(Key.F2, ModifierKeys.Control | ModifierKeys.Shift)), new InputBinding(model.CloneCommand, new KeyGesture(Key.D, ModifierKeys.Control | ModifierKeys.Shift)), new InputBinding(model.FindInformationCommand, new KeyGesture(Key.I, ModifierKeys.Control)), new InputBinding(SelectedAcObject.DeleteCommand, new KeyGesture(Key.Delete, ModifierKeys.Control)) }); DataContext = model; Loaded += OnLoaded; Unloaded += OnUnloaded; }
public AcError(AcCommonObject target, AcErrorType type, params object[] args) { Target = target; Type = type; Category = CategoryFromType(type); try { Message = string.Format(MessageFromType(type), args.Select(x => (x as Exception)?.Message ?? x).ToArray()); } catch (FormatException) { Message = Regex.Replace(MessageFromType(type), @"\{\d+\}", "?"); } BaseException = args.OfType<Exception>().FirstOrDefault(); if (Category != AcErrorCategory.CarSkin && (type != AcErrorType.Data_JsonIsMissing || !Equals(args.FirstOrDefault(), @"ui_skin.json"))) { Logging.Write(Message); } foreach (var exception in args.OfType<Exception>()) { Logging.Warning(exception); } }
public AcErrorException(AcCommonObject target, AcErrorType type, params object[] args) { AcError = new AcError(target, type, args); }
protected abstract PackedDescription GetDescriptionOverride(AcCommonObject acCommonObject);
protected abstract IEnumerable PackOverride(AcCommonObject acCommonObject);
protected abstract string GetBasePath(AcCommonObject acCommonObject);
private static string GetMapAddress(AcCommonObject obj) { return SettingsHolder.Content.SearchEngine?.GetUri(obj.Name ?? obj.Id) ?? $"https://duckduckgo.com/?q=site%3Awikipedia.org+{Uri.EscapeDataString(obj.Name ?? obj.Id)}&ia=web"; }