Exemplo n.º 1
0
    private static void ProcessDll(string dllPath)
    {
        var watch = Stopwatch.StartNew();

        if (TryToOpenFile(dllPath, FileMode.Open, FileAccess.ReadWrite, WaitMillisecondsForFileHandle, out var stream))
        {
            try
            {
                var pdbPath = Path.ChangeExtension(Path.GetFullPath(stream.Name), ".pdb");

                if (CodeWeaver.WeaveDllStream(stream, File.Exists(pdbPath)))
                {
                    watch.Stop();
                    Debug.Log($"Processed {dllPath} in {watch.Elapsed.TotalMilliseconds} milliseconds.");
                }
            }
            finally
            {
                stream.Close();
            }
        }
        else
        {
            throw new Exception(dllPath + "  was used by other process and could not be prepared for serialization.");
        }
    }
Exemplo n.º 2
0
 static InstanceMethodCallProcessor()
 {
     CodeWeaver.AddProcessor(new InstanceMethodCallProcessor());
 }