static bool CheckFiles(List <string> files) { foreach (var file in files) { if (!CorFlags.IsAnycpuOrX64(file)) { return(false); } } return(true); }
static bool CheckDllOrExe(List <string> filesList) { bool result = true; foreach (var file in filesList) { if (!CorFlags.IsAnycpuOrX64(file)) { Console.WriteLine(file); result = false; } } return(result); }
static bool CheckNuget(List <string> filesList) { bool result = true; foreach (var packageFile in filesList) { var tempDir = Path.GetTempPath() + Path.GetRandomFileName(); try { ZipFile.ExtractToDirectory(packageFile, tempDir); var files = new List <string>(); FileOperation.GetFiles(tempDir, "*.dll", ref files); foreach (var file in files) { if (!CorFlags.IsAnycpuOrX64(file)) { var x32File = packageFile + " " + file.Replace(tempDir, ""); Console.WriteLine(x32File); result = false; } } } catch (Exception e) { Console.WriteLine(packageFile + " " + e); result = false; } try { DirectoryInfo di = new DirectoryInfo(tempDir); di.Delete(true); } catch (Exception e) { } } return(result); }
static void Main(string[] args) { string file32 = @"C:\Work\NugetCheck\x32\bin\Debug\x32.dll"; string file64 = @"C:\Work\NugetCheck\x64\bin\Debug\x64.dll"; string fileanycpu = @"C:\Work\NugetCheck\anycpu\bin\Debug\anycpu.dll"; var c1 = CorFlags.IsAnycpuOrX64(file32); var c2 = CorFlags.IsAnycpuOrX64(file64); var c3 = CorFlags.IsAnycpuOrX64(fileanycpu); var a1 = Check.GetCharacteristics(file32); var a2 = Check.GetCharacteristics(file64); var a3 = Check.GetCharacteristics(fileanycpu); var b1 = Check.IsAnycpuOrX64(file32); var b2 = Check.IsAnycpuOrX64(file64); var b3 = Check.IsAnycpuOrX64(fileanycpu); Console.ReadKey(); }