Skip to content

Instantly share code, notes, and snippets.

@chamons chamons/- Secret
Created Jul 12, 2017

Embed
What would you like to do?
#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp
using System.Diagnostics;
using System.IO;
foreach (var directory in Directory.EnumerateDirectories ("/System/Library/Frameworks/"))
{
string name = directory.Split(new char[] {'/'}).Last().Split(new char [] {'.'}).First();
string framework = Path.Combine (directory, name);
if (File.Exists (framework))
{
Console.WriteLine (framework);
ProcessStartInfo info = new ProcessStartInfo("/usr/bin/otool", $"-L {framework}")
{
RedirectStandardError = true,
RedirectStandardOutput = true,
UseShellExecute = false,
};
Process process = Process.Start(info);
string toolOutput = process.StandardOutput.ReadToEnd();
foreach (var line in toolOutput.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
{
if (line.Contains("(compatibility"))
{
string depName = line.Split(new string [] {"(compatibility"}, StringSplitOptions.None).First().Replace("\t", "");
Console.WriteLine ("\t" + depName);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.