Exemple #1
0
        /// <summary>
        /// Attempts to find an equivalent overlay in the slot.
        /// </summary>
        /// <returns>The equivalent overlay (or null, if no equivalent).</returns>
        /// <param name="overlay">Overlay.</param>
        public OverlayData GetEquivalentOverlay(OverlayData overlay)
        {
            foreach (OverlayData overlay2 in overlayList)
            {
                if (OverlayData.Equivalent(overlay, overlay2))
                {
                    return(overlay2);
                }
            }

            return(null);
        }
            /// <summary>
            /// Are two overlay lists the same?
            /// </summary>
            /// <returns><c>true</c>, if lists match, <c>false</c> otherwise.</returns>
            /// <param name="list1">List1.</param>
            /// <param name="list2">List2.</param>
            public static bool OverlayListsMatch(List <OverlayData> list1, List <OverlayData> list2)
            {
                if ((list1 == null) || (list2 == null))
                {
                    return(false);
                }
                if ((list1.Count == 0) || (list1.Count != list2.Count))
                {
                    return(false);
                }

                for (int i = 0; i < list1.Count; i++)
                {
                    OverlayData overlay1 = list1[i];
                    if (!(overlay1))
                    {
                        continue;
                    }
                    bool found = false;
                    for (int j = 0; j < list2.Count; j++)
                    {
                        OverlayData overlay2 = list2[i];
                        if (!(overlay2))
                        {
                            continue;
                        }

                        if (OverlayData.Equivalent(overlay1, overlay2))
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        return(false);
                    }
                }

                return(true);
            }