public void SetCompatibilityType(
            CompatibilityType Compatibility)
        {
            if (Compatibility == CompatibilityType.None)
                throw new ArgumentException("Invalid parameter value.");

            this.m_compat = Compatibility;
        }
Exemple #2
0
        public override CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason)
        {
            if (targetEntity is Group)
            {
                Group targetGroup = (Group)targetEntity;

                Theme sourceTheme = this.Theme;
                Theme targetTheme = targetGroup.Theme;

                if (sourceTheme.GetCompatibilityType(targetTheme, out reason) == CompatibilityType.logically_impossible)
                {
                    return(CompatibilityType.logically_impossible);
                }
                else
                {
                    if (ManuallyBlockedGroups.Contains(targetGroup))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return(CompatibilityType.blocked_manually);
                    }
                    else if (ManuallyLinkedGroups.Contains(targetGroup))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return(CompatibilityType.allowed_manually);
                    }
                    else
                    {
                        CompatibilityType themeCompatibility = Theme.GetCompatibilityType(targetGroup.Theme, out reason);
                        {
                            switch (themeCompatibility)
                            {
                            case CompatibilityType.blocked_manually:
                            {
                                reason = CompatibilityReason.manual_setting_of_parent_entity;
                                return(CompatibilityType.blocked_implicitly);
                            }


                            case CompatibilityType.allowed_manually:
                            {
                                reason = CompatibilityReason.manual_setting_of_parent_entity;
                                return(CompatibilityType.allowed_implicitly);
                            }

                            default:
                                reason = CompatibilityReason.inherited_from_parent_hierarchy;
                                return(themeCompatibility);
                            }
                        }
                    }
                }
            }

            reason = CompatibilityReason.not_set;
            return(CompatibilityType.undefined);
        }
        public void SetCompatibilityType(
            CompatibilityType Compatibility)
        {
            if (Compatibility == CompatibilityType.None)
            {
                throw new ArgumentException("Invalid parameter value.");
            }

            this.m_compat = Compatibility;
        }
Exemple #4
0
 public HotkeyRegistration(Guid instanceId, string hotkeyName, ShortcutDefinition shortcut = null,
                           CompatibilityType compatibilityType = CompatibilityType.General, int instanceState = 0,
                           Func <int, int> getInstanceState    = null)
 {
     InstanceId        = instanceId;
     HotkeyName        = hotkeyName;
     Shortcut          = shortcut;
     CompatibilityType = compatibilityType;
     InstanceState     = instanceState;
     GetInstanceState  = getInstanceState;
 }
Exemple #5
0
        // This method will create the HashSet of compatibleSnippets based on the ManuallyBlocked / ManuallyLinked entities.
        // The CompatibleSnippets HashSet is only needed for import, or to build the .pcb file.
        public void BuildCompatibleSegmentsSet(PsaiProject project)
        {
            HashSet <Segment> allSegments = project.GetSegmentsOfAllThemes();

            CompatibleSnippetsIds.Clear();
            foreach (Segment targetSegment in allSegments)
            {
                bool compatible                       = false;
                CompatibilityReason reason            = CompatibilityReason.not_set;
                CompatibilityType   compatibilityType = this.GetCompatibilityType(targetSegment, out reason);

                switch (compatibilityType)
                {
                /*
                 * case CompatibilityType.allowed_always:
                 *  compatible = true;
                 *  break;
                 */

                case CompatibilityType.allowed_implicitly:
                    compatible = true;
                    break;

                case CompatibilityType.allowed_manually:
                    compatible = true;
                    break;

                default:
                    compatible = false;
                    break;
                }

                if (compatible)
                {
                    float compatibility;
                    if (targetSegment.Group == this.Group)
                    {
                        compatibility = COMPATIBILITY_PERCENTAGE_SAME_GROUP;
                    }
                    else
                    {
                        compatibility = COMPATIBILITY_PERCENTAGE_OTHER_GROUP;
                    }

                    this.AddCompatibleSnippet(targetSegment, compatibility);
                }
            }
        }
Exemple #6
0
 public XmlDocIdGenerator()
 {
     this.m_compat = CompatibilityType.Net35;
 }
Exemple #7
0
        // this method returns the compatibility type of this Snippet to a following Snippet, based
        // on the compatibility flowchart in the "doc_internal" folder of this project.
        public override CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason)
        {
            reason = CompatibilityReason.not_set;

            if (targetEntity is Segment)
            {
                Segment targetSegment = (Segment)targetEntity;
                Group   sourceGroup   = this.Group;
                Group   targetGroup   = targetSegment.Group;


                if (sourceGroup.GetCompatibilityType(targetGroup, out reason) == CompatibilityType.logically_impossible)
                {
                    return(CompatibilityType.logically_impossible);
                }
                else
                {
                    // step 1
                    // a pure END-Segment can never follow another pure END-Segment
                    if (this.HasOnlyEndSuitability())
                    {
                        if (targetSegment.HasOnlyEndSuitability())
                        {
                            reason = CompatibilityReason.target_segment_and_source_segment_are_both_only_usable_at_end;
                            return(CompatibilityType.logically_impossible);
                        }
                    }


                    // step 2
                    // transitioning to a pure END-Segment (which is no BridgeSnippet) of some other Group will never happen
                    if (sourceGroup != targetGroup &&
                        targetSegment.HasOnlyEndSuitability() &&
                        !targetSegment.IsAutomaticBridgeSegment &&
                        !targetSegment.IsManualBridgeSegmentForSourceGroup(sourceGroup)
                        )
                    {
                        reason = CompatibilityReason.target_segment_is_of_a_different_group_and_is_only_usable_at_end;
                        return(CompatibilityType.logically_impossible);
                    }


                    // step 3
                    // transitioning to a pure Bridge-Snippet within the same Group is not allowed
                    if (sourceGroup == targetGroup)
                    {
                        if (!targetSegment.IsUsableInMiddle && !targetSegment.IsUsableAtEnd &&
                            (targetSegment.IsAutomaticBridgeSegment || targetSegment.IsManualBridgeSegmentForSourceGroup(sourceGroup)))
                        {
                            reason = CompatibilityReason.target_segment_is_a_pure_bridge_segment_within_the_same_group;
                            return(CompatibilityType.blocked_implicitly);
                        }
                    }


                    // step 4
                    if (ManuallyLinkedSnippets.Contains(targetSegment))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return(CompatibilityType.allowed_manually);
                    }

                    // step 5
                    if (ManuallyBlockedSnippets.Contains(targetSegment))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return(CompatibilityType.blocked_manually);
                    }


                    // step 6
                    // In case of group-transitions: Is there a BridgeSnippet in the targetGroup for the SourceGroup? Then block the TargetSnippet implicitly, if it is no BridgSnippet from the SourceGroup to TargetGroup.
                    // Otherwise allow.
                    if (sourceGroup != null && sourceGroup != targetGroup)
                    {
                        //if (EditorModel.Instance.Project.CheckIfThereIsAtLeastOneBridgeSnippetFromSourceGroupToTargetGroup(sourceGroup, targetGroup))
                        if (targetGroup.ContainsAtLeastOneAutomaticBridgeSegment() || targetGroup.ContainsAtLeastOneManualBridgeSegmentForSourceGroup(sourceGroup))
                        {
                            if (targetSegment.IsManualBridgeSegmentForSourceGroup(sourceGroup))
                            {
                                reason = CompatibilityReason.target_segment_is_a_manual_bridge_segment_for_the_source_group;
                                return(CompatibilityType.allowed_manually);
                            }

                            if (targetSegment.IsAutomaticBridgeSegment)
                            {
                                reason = CompatibilityReason.target_segment_is_an_automatic_bridge_segment;
                                return(CompatibilityType.allowed_implicitly);
                            }

                            // block all non-bridge-snippets:
                            reason = CompatibilityReason.target_group_contains_at_least_one_bridge_segment;
                            return(CompatibilityType.blocked_implicitly);
                        }
                    }


                    // step
                    // Anything is implicitly allowed after a pure END-Segment
                    if (this.HasOnlyEndSuitability())
                    {
                        reason = CompatibilityReason.anything_may_be_played_after_a_pure_end_segment;
                        return(CompatibilityType.allowed_implicitly);
                    }


                    // step
                    // if the default compatibility of the targetSegment is allowed_implicitly, continue evaluation by regarding the parent group
                    if (targetSegment.DefaultCompatibiltyAsFollower == CompatibilityType.allowed_implicitly)
                    {
                        CompatibilityType groupCompatibility = this.Group.GetCompatibilityType(targetSegment.Group, out reason);
                        {
                            switch (groupCompatibility)
                            {
                            case CompatibilityType.blocked_manually:
                                reason = CompatibilityReason.manual_setting_of_parent_entity;
                                return(CompatibilityType.blocked_implicitly);

                            case CompatibilityType.blocked_implicitly:
                                return(CompatibilityType.blocked_implicitly);

                            case CompatibilityType.allowed_manually:
                                reason = CompatibilityReason.manual_setting_of_parent_entity;
                                return(CompatibilityType.allowed_implicitly);

                            default:
                                reason = CompatibilityReason.inherited_from_parent_hierarchy;
                                return(CompatibilityType.allowed_implicitly);
                            }
                        }
                    }
                    else
                    {
                        reason = CompatibilityReason.default_compatibility_of_the_target_segment_as_a_follower;
                        return(targetSegment.DefaultCompatibiltyAsFollower);
                    }
                }
            }

            return(CompatibilityType.undefined);
        }