-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBinaryDetail.cs
More file actions
65 lines (55 loc) · 2.37 KB
/
BinaryDetail.cs
File metadata and controls
65 lines (55 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace BinaryDetailer
{
[Serializable]
public class BinaryDetail
{
public BinaryDetail(FileInfo fileInfo)
{
FileInfo = fileInfo;
}
public string Error { get; internal set; }
public FileInfo FileInfo { get; internal set; }
public ImageFileMachine ImageFileMachine { get; internal set; }
public string ImageRuntimeVersion { get; internal set; }
public PortableExecutableKinds PEKind { get; internal set; }
public ProcessorArchitecture ProcessorArchitecture { get; internal set; }
public string TargetFrameworkAttribute { get; internal set; }
public string AssemblyVersion { get; internal set; }
public string FileVersion => FileVersionInfo.GetVersionInfo(FileInfo.FullName).FileVersion;
public string ProductVersion => FileVersionInfo.GetVersionInfo(FileInfo.FullName).ProductVersion;
public string AssemblyCompanyAttribute => FileVersionInfo.GetVersionInfo(FileInfo.FullName).CompanyName;
public string AssemblyCopyrightAttribute => FileVersionInfo.GetVersionInfo(FileInfo.FullName).LegalCopyright;
public static string[] CSVHeader
{
get
{
return new[]
{
"Full Path,FileName,AssemblyCompanyAttribute,AssemblyCopyrightAttribute,AssemblyVersion,FileVersion,ProductVersion,ImageRuntimeVersion,TargetFrameworkAttribute,PortableExecutableKinds,ImageFileMachine,ProcessorArchitecture,Error"
};
}
}
public string ToCsv()
{
return
"\"" + FileInfo.FullName + "\"," +
"\"" + FileInfo.Name + "\"," +
"\"" + AssemblyCompanyAttribute + "\"," +
"\"" + AssemblyCopyrightAttribute + "\"," +
"\"" + AssemblyVersion + "\"," +
"\"" + FileVersion + "\"," +
"\"" + ProductVersion + "\"," +
"\"" + ImageRuntimeVersion + "\"," +
"\"" + TargetFrameworkAttribute + "\"," +
"\"" + PEKind + "\"," +
"\"" + ImageFileMachine + "\"," +
"\"" + ProcessorArchitecture + "\"," +
"\"" + Error + "\"";
}
}
}