Last active
April 17, 2017 01:05
-
-
Save KageShiron/a8d4e6379fa895a1b995121e94827098 to your computer and use it in GitHub Desktop.
blog/dotnet-name .NET Frameworkのライブラリのpublicな名前を探求する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
string[] dirNames = { @"C:\WINDOWS\Microsoft.NET\assembly", @"C:\WINDOWS\assembly" }; | |
SearchMemberNames(dirNames, t => t.Name.Length > 100); | |
} | |
void SearchMemberNames(string[] dirNames, System.Func<MemberInfo, bool> judge) | |
{ | |
foreach (var dir in dirNames) | |
System.Threading.Tasks.Parallel.ForEach(Directory.EnumerateFiles(dir, "*.dll", SearchOption.AllDirectories), f => | |
{ | |
try | |
{ | |
var a = Assembly.LoadFrom(f); | |
foreach (var t in a.GetTypes()) | |
{ | |
//非publicとCOM由来は弾く | |
if(!t.IsPublic || t.IsImport)continue; | |
var mem = t.FindMembers(MemberTypes.All,BindingFlags.Public | BindingFlags.Instance|BindingFlags.Static, (info,obj) => judge(info) , null); | |
foreach( var m in mem)Console.WriteLine("{0} : {1}.{2}",m.Name.Length , t.FullName , m.Name); | |
} | |
} | |
catch { } | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
string[] dirNames = { @"C:\WINDOWS\Microsoft.NET\assembly", @"C:\WINDOWS\assembly" }; | |
SearchClassNames(dirNames, t => !t.IsImport && t.IsPublic && t.Name.Length > 50); | |
} | |
void SearchClassNames(string[] dirNames, System.Func<Type, bool> judge) | |
{ | |
foreach (var dir in dirNames) | |
System.Threading.Tasks.Parallel.ForEach(Directory.EnumerateFiles(dir, "*.dll", SearchOption.AllDirectories), f => | |
{ | |
try | |
{ | |
var a = Assembly.LoadFrom(f); | |
foreach (var t in a.GetTypes()) | |
{ | |
if (judge(t)) Console.WriteLine("{0} : {1}", t.Name.Length, t.FullName); | |
} | |
} | |
catch { } | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies(); | |
foreach (Assembly a in asms) | |
{ | |
foreach( var t in a.GetTypes() ) | |
{ | |
if( t.IsPublic && t.Name.Length > 50)Console.WriteLine(t.Name); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
string[] dirNames = { @"C:\WINDOWS\Microsoft.NET\assembly", @"C:\WINDOWS\assembly" }; | |
SearchClassNames(dirNames, t => t.IsPublic && !t.IsImport && t.Name.Contains("Hwnd") && !t.Name.Contains("_")); | |
SearchMemberNames(dirNames, t => t.Name.Contains("Hwnd") && !t.Name.Contains("_")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment