コード例 #1
0
        public CharacterAttrib GetAttributeByName(string abbrev)
        {
            bool            blnGetShifterAttribute = _objCharacter.MetatypeCategory == "Shapeshifter" && _objCharacter.Created && _objCharacter.AttributeSection.AttributeCategory == CharacterAttrib.AttributeCategory.Shapeshifter;
            CharacterAttrib objReturn = AttributeList.FirstOrDefault(att => att.Abbrev == abbrev && (att.MetatypeCategory == CharacterAttrib.AttributeCategory.Shapeshifter) == blnGetShifterAttribute) ?? SpecialAttributeList.FirstOrDefault(att => att.Abbrev == abbrev);

            return(objReturn);
        }
コード例 #2
0
        /// <summary>
        /// This is used to see if an API member is hidden via the <c>BrowsableAttribute</c>
        /// </summary>
        /// <param name="attributes">The attribute list to check</param>
        /// <returns>Return true if the attribute is not present.  If present, it returns the attribute setting.</returns>
        private static bool IsBrowsable(AttributeList attributes)
        {
            var browsable = attributes.FirstOrDefault(attr => attr.Type.FullName ==
                                                      "System.ComponentModel.BrowsableAttribute");

            if (browsable != null && browsable.Expressions.Count != 0)
            {
                var l = browsable.Expressions[0] as Literal;

                if (l != null)
                {
                    return((bool)l.Value);
                }
            }

            return(true);
        }
コード例 #3
0
 private void UpdateResourceManager()
 {
     foreach (var cpd in propertyDescriptorList)
     {
         IResourceAttribute attr = (PropertyResourceAttribute)cpd.AllAttributes.FirstOrDefault(a => a is PropertyResourceAttribute);
         if (attr == null)
         {
             var ac = GetAttributes();
             var al = new AttributeList(ac);
             attr = (ClassResourceAttribute)al.FirstOrDefault(a => a is ClassResourceAttribute);
         }
         if (attr == null)
         {
             cpd.ResourceManager = null;
             continue;
         }
         cpd.KeyPrefix = attr.KeyPrefix;
         var rm = hashRM[attr] as ResourceManager;
         if (rm != null)
         {
             cpd.ResourceManager = rm;
             continue;
         }
         try
         {
             if (String.IsNullOrWhiteSpace(attr.AssemblyFullName) == false)
             {
                 rm = new ResourceManager(attr.BaseName, Assembly.ReflectionOnlyLoad(attr.AssemblyFullName));
             }
             else
             {
                 rm = new ResourceManager(attr.BaseName, GetPropertyOwner(cpd).GetType().Assembly);
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
             continue;
         }
         hashRM.Add(attr, rm);
         cpd.ResourceManager = rm;
     }
 }
コード例 #4
0
 private void UpdateResourceManager()
 {
     foreach (var cpd in propertyDescriptorList)
     {
         IResourceAttribute attr = (PropertyResourceAttribute)cpd.AllAttributes.FirstOrDefault(a => a is PropertyResourceAttribute);
         if (attr == null)
         {
             var ac = GetAttributes();
             var al = new AttributeList(ac);
             attr = (ClassResourceAttribute)al.FirstOrDefault(a => a is ClassResourceAttribute);
         }
         if (attr == null)
         {
             cpd.ResourceManager = null;
             continue;
         }
         cpd.KeyPrefix = attr.KeyPrefix;
         var rm = hashRM[attr] as ResourceManager;
         if (rm != null)
         {
             cpd.ResourceManager = rm;
             continue;
         }
         try
         {
             if (String.IsNullOrEmpty(attr.AssemblyFullName) == false)
             {
                 rm = new ResourceManager(attr.BaseName, Assembly.ReflectionOnlyLoad(attr.AssemblyFullName));
             }
             else
             {
                 rm = new ResourceManager(attr.BaseName, base.GetPropertyOwner(cpd).GetType().Assembly);
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
             continue;
         }
         hashRM.Add(attr, rm);
         cpd.ResourceManager = rm;
     }
 }