Beispiel #1
0
 /// <inheritdoc cref="GetPattern"/>
 internal static MethodRewritePattern GetPatternInternal(MethodBase method)
 {
     lock (_rewritePatterns)
     {
         if (_rewritePatterns.TryGetValue(method, out DecoratedMethod pattern))
         {
             return(pattern);
         }
         var res = new DecoratedMethod(method);
         _rewritePatterns.Add(method, res);
         return(res);
     }
 }
Beispiel #2
0
        private static void DoCommit(DecoratedMethod method)
        {
            if (!method.HasChanged())
            {
                return;
            }
            method.Commit();
            int value             = Interlocked.Increment(ref _finishedPatchCount);
            var actualPercentage  = (value * 100) / _dirtyPatchCount;
            var currentPrintGroup = actualPercentage / 10;
            var prevPrintGroup    = (value - 1) * 10 / _dirtyPatchCount;

            if (currentPrintGroup != prevPrintGroup && value >= 1)
            {
                _log.Info($"Patched {value}/{_dirtyPatchCount}.  ({actualPercentage:D2}%)");
            }
        }