Example #1
0
        private void CheckForLooping(AbstractTranslationSet translations)
        {
            bool hasLoop = false;
            AbstractTranslationSet slowLoop  = translations;
            AbstractTranslationSet fastLoop1 = translations;
            AbstractTranslationSet fastLoop2 = translations;

            while (slowLoop != null && (fastLoop1 = fastLoop2.GetParentTranslations()) != null && (fastLoop2 = fastLoop1.GetParentTranslations()) != null)
            {
                if (slowLoop.Equals(fastLoop1) || slowLoop.Equals(fastLoop2))
                {
                    hasLoop = true;
                    break;
                }

                slowLoop = slowLoop.GetParentTranslations();
            }

            if (hasLoop)
            {
                throw new TranslationLoadException("Translations contained an inheritence loop");
            }
        }
Example #2
0
        private static void SetCurrentTranslations(AbstractTranslationSet newTranslations)
        {
            if (currentTranslations != newTranslations || (currentTranslations != null && !currentTranslations.Equals(newTranslations)))
            {
                currentTranslations = newTranslations;

                if (TranslationChanged != null)
                {
                    TranslationChanged();
                }
            }
        }