示例#1
0
        /// <summary>Merges annotations</summary>
        /// <param name="attributes">The list of <see cref="HarmonyMethod"/> to merge</param>
        /// <returns>The merged <see cref="HarmonyMethod"/></returns>
        ///
        public static HarmonyMethod Merge(List <HarmonyMethod> attributes)
        {
            var result = new HarmonyMethod();

            if (attributes == null)
            {
                return(result);
            }
            var resultTrv = Traverse.Create(result);

            attributes.ForEach(attribute =>
            {
                var trv = Traverse.Create(attribute);
                HarmonyFields().ForEach(f =>
                {
                    var val = trv.Field(f).GetValue();
                    if (val != null)
                    {
                        HarmonyMethodExtensions.SetValue(resultTrv, f, val);
                    }
                });
            });
            return(result);
        }
示例#2
0
 /// <summary>Creates a traverse instance from an existing instance</summary>
 /// <param name="traverse">The existing <see cref="Traverse"/> instance</param>
 ///
 public Traverse(Traverse traverse)
 {
     this.traverse = traverse;
 }