GlueViewOfficialPlugins.Scripting.ExpressionParser.TryToGetStateCategoryFromElement C# (CSharp) Method

TryToGetStateCategoryFromElement() private static method

private static TryToGetStateCategoryFromElement ( string memberName, IElement element ) : object
memberName string
element IElement
return object
        private static object TryToGetStateCategoryFromElement(string memberName, IElement element)
        {
            object foundObject = null;
            StateSaveCategory existingCategory = element.GetStateCategoryRecursively(memberName);
            bool isUncategorizedCategory = memberName == "VariableState";
            if (!isUncategorizedCategory)
            {
                if (existingCategory != null)
                {
                    if (existingCategory.SharesVariablesWithOtherCategories == false)
                    {
                        foundObject = existingCategory;
                    }
                    else
                    {
                        isUncategorizedCategory = true;
                    }
                }
            }
            if (isUncategorizedCategory)
            {
                StateSaveCategory stateSaveCategory = new StateSaveCategory();

                foreach (StateSave stateSave in element.States)
                {
                    stateSaveCategory.States.Add(stateSave);
                }
                foundObject = stateSaveCategory;
            }
            return foundObject;
        }