public static void SaveEmbeddedResourceTo()

in src/dotnet/ReSharperPlugin.DotNetDisassembler/JitDisasm/TextUtils.cs [8:20]


    public static void SaveEmbeddedResourceTo(string resource, string folder, 
        Func<string, string> contentProcessor = null)
    {
        string filePath = Path.Combine(folder, resource.Replace("_template", ""));
        if (File.Exists(filePath))
            return;

        using Stream stream = typeof(TextUtils).Assembly
            .GetManifestResourceStream("ReSharperPlugin.DotNetDisassembler.Resources."  + resource);
        using StreamReader reader = new StreamReader(stream);
        var content = reader.ReadToEnd();
        File.WriteAllText(filePath, contentProcessor is { } ? contentProcessor(content) : content);
    }