상속: AcObjectNew
예제 #1
0
            private IEnumerable Pack(AcCommonObject obj)
            {
                SetBasePath(GetBasePath(obj));
                _current  = obj;
                _subFiles = null;

                return(PackOverride(obj));
            }
예제 #2
0
            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);
            }
예제 #3
0
        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;
        }
예제 #4
0
파일: AcError.cs 프로젝트: gro-ove/actools
        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);
            }
        }
예제 #5
0
 public AcErrorException(AcCommonObject target, AcErrorType type, params object[] args) {
     AcError = new AcError(target, type, args);
 }
예제 #6
0
 protected abstract PackedDescription GetDescriptionOverride(AcCommonObject acCommonObject);
예제 #7
0
 protected abstract IEnumerable PackOverride(AcCommonObject acCommonObject);
예제 #8
0
 protected abstract string GetBasePath(AcCommonObject acCommonObject);
예제 #9
0
 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";
 }