Esempio n. 1
0
 private static T[] FilterAndCreateComponentTag <T>(Control @base, string name, bool filterByName) where T : Control
 {
     T[] ctrls = null;
     ctrls = @base.Controls.OfType <T>().Where <T>(ctrl =>
     {
         string[] s = ctrl.Tag.ToString().Split(':');
         if (filterByName == true && !s[0].Trim().Equals(name))
         {
             return(false);
         }
         ComponentTag tag = new ComponentTag();
         string id        = null;
         double order     = 0;
         try
         {
             string sid = filterByName ? s[1] : s.Length == 1 ? s[0] : s[1];
             id         = sid;
             order      = Convert.ToDouble(sid);
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.StackTrace);
         }
         tag.Id       = id;
         tag.Order    = order;
         tag.OtherTag = null;
         ctrl.Tag     = tag;
         return(true);
     }).ToArray();
     return(ctrls);
 }
        /// <summary>
        ///  This helper checks whether the passed node is the GameObject.Tag type
        /// </summary>
        /// <param name="context">Analyzer context</param>
        /// <param name="node">node to analyze for GameObject.Tag</param>
        /// <returns>true if it is GameObject.tag, false otherwise</returns>
        private static bool IsGameObjectTagProperty(ref SyntaxNodeAnalysisContext context, ExpressionSyntax node)
        {
            const string GameObjectTag = "UnityEngine.GameObject.tag";
            const string ComponentTag  = "UnityEngine.Component.tag";
            var          prop          = context.SemanticModel.GetSymbolInfo(node).Symbol as IPropertySymbol;

            if (prop != null)
            {
                return(GameObjectTag.Equals(prop.ToString()) || ComponentTag.Equals(prop.ToString()));
            }

            return(false);
        }
        public override int GetHashCode()
        {
            var hashCode = -1095595053;

            hashCode = hashCode * -1521134295 + Importance.GetHashCode();
            hashCode = hashCode * -1521134295 + ComponentTag.GetHashCode();
            foreach (var filter in Filters)
            {
                hashCode = hashCode * -1521134295 + filter.GetHashCode();
            }

            return(hashCode);
        }