Example #1
0
        static string GetRunStepDisplayName(Type type)
        {
            var name     = RunStep.GetName(type);
            var category = RunStep.GetCategory(type);

            return(!string.IsNullOrEmpty(category) ? $"{category}/{name}" : name);
        }
Example #2
0
 void OnRunStepSelectorClicked(EventBase @event)
 {
     SearcherWindow.Show(
         EditorWindow.focusedWindow,
         new Searcher(
             TypeSearcherDatabase.GetRunStepDatabase(new HashSet <Type>(RunStep.GetAvailableTypes(type => !RunStep.GetIsShown(type))), GetRunStepDisplayName),
             new AddTypeSearcherAdapter("Select Run Script")),
         UpdateRunStep,
         @event.originalMousePosition + Vector2.up * 35.0f,
         a => { },
         new SearcherWindow.Alignment(SearcherWindow.Alignment.Vertical.Top,
                                      SearcherWindow.Alignment.Horizontal.Left)
         );
 }
Example #3
0
        void OnRunStepSelectorClicked(EventBase @event)
        {
            var database = TypeSearcherDatabase.Populate <RunStep>(
                type => !type.HasAttribute <HideInInspector>(),
                type => RunStep.GetName(type),
                type => RunStep.GetCategory(type));

            SearcherWindow.Show(
                EditorWindow.focusedWindow,
                new Searcher(database, new AddTypeSearcherAdapter("Select Run Script")),
                UpdateRunStep,
                @event.originalMousePosition + Vector2.up * 35.0f,
                a => { },
                new SearcherWindow.Alignment(SearcherWindow.Alignment.Vertical.Top,
                                             SearcherWindow.Alignment.Horizontal.Left)
                );
        }
        internal static void DoAutoRunProfileDiscovery(PartitionConfiguration config, ManagementAgent ma)
        {
            logger.Trace($"{ma.Name}: Performing run profile auto-discovery for partition {config.Name}");

            bool match = false;

            foreach (RunConfiguration profile in ma.RunProfiles.Values)
            {
                if (profile.RunSteps.Count == 0)
                {
                    continue;
                }

                if (profile.RunSteps.Count > 1)
                {
                    logger.Trace($"{ma.Name}: Ignoring multi-step run profile {profile.Name}");
                    continue;
                }

                if (profile.RunSteps.Any(t => t.IsTestRun))
                {
                    logger.Trace($"{ma.Name}: Ignoring test run profile {profile.Name}");
                    continue;
                }

                if (profile.RunSteps.Any(t => t.IsCombinedStep))
                {
                    logger.Trace($"{ma.Name}: Ignoring combined step profile {profile.Name}");
                    continue;
                }

                RunStep step = profile.RunSteps.First();

                if (step.ObjectLimit > 0)
                {
                    logger.Trace($"{ma.Name}: Ignoring limited step run profile {profile.Name}");
                    continue;
                }

                if (config.ID != step.Partition)
                {
                    logger.Trace($"{ma.Name}: Ignoring profile for other partition {profile.Name}");
                    continue;
                }

                switch (step.Type)
                {
                case RunStepType.Export:
                    config.ExportRunProfileName = profile.Name;
                    break;

                case RunStepType.FullImport:
                    config.FullImportRunProfileName = profile.Name;
                    break;

                case RunStepType.DeltaImport:
                    config.ScheduledImportRunProfileName = profile.Name;
                    config.DeltaImportRunProfileName     = profile.Name;
                    break;

                case RunStepType.DeltaSynchronization:
                    config.DeltaSyncRunProfileName = profile.Name;
                    break;

                case RunStepType.FullSynchronization:
                    config.FullSyncRunProfileName = profile.Name;
                    break;

                default:
                case RunStepType.Unknown:
                    continue;
                }

                logger.Trace($"{ma.Name}: Found {step.Type} profile {profile.Name}");
                match = true;
            }

            if (match)
            {
                if (!string.IsNullOrWhiteSpace(config.ScheduledImportRunProfileName))
                {
                    config.ConfirmingImportRunProfileName = config.ScheduledImportRunProfileName;
                }
                else
                {
                    config.ConfirmingImportRunProfileName = config.FullImportRunProfileName;
                    config.ScheduledImportRunProfileName  = config.FullImportRunProfileName;
                    config.DeltaImportRunProfileName      = config.FullImportRunProfileName;
                }
            }
        }