Esempio n. 1
0
 public override void VisitObjectMember(object container, ObjectDescriptor containerDescriptor, IMemberDescriptor member, object value)
 {
     if (sourceFiles != null)
     {
         if (member.Type == typeof(UFile) && value != null)
         {
             var file = (UFile)value;
             if (!string.IsNullOrWhiteSpace(file.ToString()))
             {
                 var attribute = member.GetCustomAttributes <SourceFileMemberAttribute>(true).SingleOrDefault();
                 if (attribute != null)
                 {
                     if (!sourceFiles.ContainsKey(file))
                     {
                         sourceFiles.Add(file, attribute.UpdateAssetIfChanged);
                     }
                     else if (attribute.UpdateAssetIfChanged)
                     {
                         // If the file has already been collected, just update whether it should update the asset when changed
                         sourceFiles[file] = true;
                     }
                 }
             }
         }
     }
     if (compilationInputFiles != null)
     {
         if (member.Type == typeof(UFile) && value != null)
         {
             var file = (UFile)value;
             if (!string.IsNullOrWhiteSpace(file.ToString()))
             {
                 var attribute = member.GetCustomAttributes <SourceFileMemberAttribute>(true).SingleOrDefault();
                 if (attribute != null && !attribute.Optional)
                 {
                     compilationInputFiles.Add(file);
                 }
             }
         }
     }
     if (sourceMembers != null)
     {
         if (member.Type == typeof(UFile))
         {
             var attribute = member.GetCustomAttributes <SourceFileMemberAttribute>(true).SingleOrDefault();
             if (attribute != null)
             {
                 sourceMembers[CurrentPath.Clone()] = value as UFile;
             }
         }
     }
     base.VisitObjectMember(container, containerDescriptor, member, value);
 }
Esempio n. 2
0
        public override void VisitObjectMember(object container, ObjectDescriptor containerDescriptor, IMemberDescriptor member, object value)
        {
            // Don't visit base parts as they are visited at the top level.
            if (typeof(Asset).IsAssignableFrom(member.DeclaringType) && (member.Name == Asset.BasePartsProperty))
            {
                return;
            }

            if (sourceFiles != null)
            {
                if (member.Type == typeof(UFile) && value != null)
                {
                    var file = (UFile)value;
                    if (!string.IsNullOrWhiteSpace(file.ToString()))
                    {
                        var attribute = member.GetCustomAttributes <SourceFileMemberAttribute>(true).SingleOrDefault();
                        if (attribute != null)
                        {
                            if (!sourceFiles.ContainsKey(file))
                            {
                                sourceFiles.Add(file, attribute.UpdateAssetIfChanged);
                            }
                            else if (attribute.UpdateAssetIfChanged)
                            {
                                // If the file has already been collected, just update whether it should update the asset when changed
                                sourceFiles[file] = true;
                            }
                        }
                    }
                }
            }
            if (sourceMembers != null)
            {
                if (member.Type == typeof(UFile))
                {
                    var attribute = member.GetCustomAttributes <SourceFileMemberAttribute>(true).SingleOrDefault();
                    if (attribute != null)
                    {
                        sourceMembers[CurrentPath.Clone()] = value as UFile;
                    }
                }
            }
            base.VisitObjectMember(container, containerDescriptor, member, value);
        }
Esempio n. 3
0
        public bool EnterNode(IMemberDescriptor member)
        {
            var assetPartContainedAttribute = member.GetCustomAttributes <AssetPartContainedAttribute>(true).FirstOrDefault();

            if (assetPartContainedAttribute != null)
            {
                states.Push(new State(null, assetPartContainedAttribute.ContainedTypes));
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
 public override void VisitObjectMember(object container, ObjectDescriptor containerDescriptor, IMemberDescriptor member, object value)
 {
     if (member.GetCustomAttributes<NonIdentifiableCollectionItemsAttribute>(true).Any())
     {
         // Value types (collection that are struct) will automatically be considered as non-identifiable.
         if (value?.GetType().IsValueType == false)
         {
             nonIdentifiableCollection = nonIdentifiableCollection ?? new HashSet<object>();
             nonIdentifiableCollection.Add(value);
         }
     }
     base.VisitObjectMember(container, containerDescriptor, member, value);
 }
 public override void VisitObjectMember(object container, ObjectDescriptor containerDescriptor, IMemberDescriptor member, object value)
 {
     if (sourceFiles != null)
     {
         if (member.Type == typeof(UFile) && value != null)
         {
             var file = (UFile)value;
             if (!string.IsNullOrWhiteSpace(file.ToString()))
             {
                 var attribute = member.GetCustomAttributes<SourceFileMemberAttribute>(true).SingleOrDefault();
                 if (attribute != null)
                 {
                     if (!sourceFiles.ContainsKey(file))
                     {
                         sourceFiles.Add(file, attribute.UpdateAssetIfChanged);
                     }
                     else if (attribute.UpdateAssetIfChanged)
                     {
                         // If the file has already been collected, just update whether it should update the asset when changed
                         sourceFiles[file] = true;
                     }
                 }
             }
         }
     }
     if (sourceMembers != null)
     {
         if (member.Type == typeof(UFile))
         {
             var attribute = member.GetCustomAttributes<SourceFileMemberAttribute>(true).SingleOrDefault();
             if (attribute != null)
             {
                 sourceMembers[CurrentPath.Clone()] = value as UFile;
             }
         }
     }
     base.VisitObjectMember(container, containerDescriptor, member, value);
 }