/// <inheritdoc /> public override void OnUpdate() { // Check if has no requests to process if (_requests.Count == 0) { return; } lock (_requests) { try { // Get entries List <ImportFileEntry> entries = new List <ImportFileEntry>(_requests.Count); bool needSettingsDialog = false; for (int i = 0; i < _requests.Count; i++) { var request = _requests[i]; var entry = ImportFileEntry.CreateEntry(ref request); if (entry != null) { if (request.Settings != null && entry.TryOverrideSettings(request.Settings)) { // Use overridden settings } else if (!request.SkipSettingsDialog) { needSettingsDialog |= entry.HasSettings; } entries.Add(entry); } } _requests.Clear(); // Check if need to show importing dialog or can just pass requests if (needSettingsDialog) { var dialog = new ImportFilesDialog(entries); dialog.Show(Editor.Windows.MainWindow); dialog.Focus(); } else { LetThemBeImportedxD(entries); } } catch (Exception ex) { // Error Editor.LogWarning(ex); Editor.LogError("Failed to process files import request."); } } }
/// <inheritdoc /> public override void OnInit() { ImportFileEntry.RegisterDefaultTypes(); }