예제 #1
0
        public bool AddOrModify(GameObjectMetadata metadata)
        {
            if (_collection.FirstOrDefault(or => or.Equals(metadata)) is GameObjectMetadata existing)
            {
                bool modified = false;
                if (existing.Name != metadata.Name)
                {
                    existing.Name = metadata.Name;
                    modified      = true;
                }
                if (existing.Keywords.SequenceEqual(metadata.Keywords))
                {
                    existing.UpdateKeywords(metadata.Keywords);
                    modified = true;
                }

                return(modified);
            }
            else
            {
                _collection.Add(metadata);
                return(true);
            }
        }