diff --git a/Catswords.DataType.Client/Catswords.DataType.Client.csproj b/Catswords.DataType.Client/Catswords.DataType.Client.csproj
index 98630ef..f6237ba 100644
--- a/Catswords.DataType.Client/Catswords.DataType.Client.csproj
+++ b/Catswords.DataType.Client/Catswords.DataType.Client.csproj
@@ -108,13 +108,15 @@
-
+
+
+
@@ -194,5 +196,8 @@
+
+
+
\ No newline at end of file
diff --git a/Catswords.DataType.Client/Helper/ExifTagExtractor.cs b/Catswords.DataType.Client/Helper/ExifTagExtractor.cs
new file mode 100644
index 0000000..53df60f
--- /dev/null
+++ b/Catswords.DataType.Client/Helper/ExifTagExtractor.cs
@@ -0,0 +1,44 @@
+using Catswords.DataType.Client.Model;
+using MetadataExtractor;
+using System;
+using System.Collections.Generic;
+
+namespace Catswords.DataType.Client.Helper
+{
+ class ExifTagExtractor
+ {
+ private string FilePath;
+
+ public ExifTagExtractor(string filePath)
+ {
+ FilePath = filePath;
+ }
+
+ public List GetTags()
+ {
+ List tags = new List();
+
+ try {
+ IEnumerable directories = ImageMetadataReader.ReadMetadata(FilePath);
+ foreach (var directory in directories)
+ {
+ foreach (var tag in directory.Tags)
+ {
+ tags.Add(new ExifTag
+ {
+ Section = directory.Name,
+ Name = tag.Name,
+ Description = tag.Description.ToString()
+ });
+ }
+ }
+ }
+ catch
+ {
+ // nothing
+ }
+
+ return tags;
+ }
+ }
+}
diff --git a/Catswords.DataType.Client/Helper/LinkExtractor.cs b/Catswords.DataType.Client/Helper/LinkExtractor.cs
index 556690d..fca4347 100644
--- a/Catswords.DataType.Client/Helper/LinkExtractor.cs
+++ b/Catswords.DataType.Client/Helper/LinkExtractor.cs
@@ -73,7 +73,7 @@ namespace Catswords.DataType.Client.Helper
}
}
- public string[] GetStrings()
+ public List GetStrings()
{
List results = new List();
@@ -111,7 +111,7 @@ namespace Catswords.DataType.Client.Helper
MessageBox.Show($"An error occurred: {ex.Message}");
}
- return results.ToArray();
+ return results;
}
}
}
diff --git a/Catswords.DataType.Client/Helper/PeOrganizationExtractor.cs b/Catswords.DataType.Client/Helper/PeOrganizationExtractor.cs
new file mode 100644
index 0000000..5e29c4c
--- /dev/null
+++ b/Catswords.DataType.Client/Helper/PeOrganizationExtractor.cs
@@ -0,0 +1,103 @@
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+
+namespace Catswords.DataType.Client.Helper
+{
+ class PeOrganizationExtractor
+ {
+ private string FilePath;
+
+ public PeOrganizationExtractor(string filePath)
+ {
+ FilePath = filePath;
+ }
+
+ public string GetString()
+ {
+ // 회사 정보 추출
+ string[] companies = new string[] { GetCompanyInfo(), GetProductName(), GetCopyrightInfo(), GetOrganization() };
+ foreach (string company in companies)
+ {
+ if (company != null && !company.Equals(string.Empty))
+ {
+ return company;
+ }
+ }
+
+ return "Unknown";
+ }
+
+ private string GetOrganization()
+ {
+ string organization = string.Empty;
+
+ // 서명된 파일인 경우 인증서 정보 추출
+ X509Certificate2 certificate = GetCertificateInfo();
+ if (certificate != null)
+ {
+ // Subject 필드에서 O (Organization) 값을 찾아 회사 정보 추출
+ string[] fields = certificate.Subject.Split(',');
+
+ foreach (string field in fields)
+ {
+ string[] keyValue = field.Trim().Split('=');
+
+ if (keyValue.Length == 2 && keyValue[0].Trim().Equals("O", StringComparison.OrdinalIgnoreCase))
+ {
+ organization = keyValue[1].Trim();
+ }
+ }
+ }
+
+ return organization;
+ }
+
+ private string GetCompanyInfo()
+ {
+ FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(FilePath);
+ return versionInfo.CompanyName;
+ }
+
+ private string GetProductName()
+ {
+ FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(FilePath);
+ return versionInfo.ProductName;
+ }
+
+ private string GetCopyrightInfo()
+ {
+ FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(FilePath);
+ return versionInfo.LegalCopyright;
+ }
+
+ private X509Certificate2 GetCertificateInfo()
+ {
+ // GetCertificateInfo 구현
+ try
+ {
+ // 파일에 디지털 서명이 있는지 확인
+ Assembly assembly = Assembly.LoadFile(FilePath);
+ X509Certificate2 certificate = new X509Certificate2(assembly.Location);
+
+ // 서명이 유효한지 확인 (옵션)
+ X509Chain chain = new X509Chain();
+ chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; // 여러 인증서를 사용하는 경우 인증서 연쇄를 무시할 수 있습니다.
+
+ if (chain.Build(certificate))
+ {
+ return certificate;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ catch
+ {
+ return null;
+ }
+ }
+ }
+}
diff --git a/Catswords.DataType.Client/Model/ExifTag.cs b/Catswords.DataType.Client/Model/ExifTag.cs
new file mode 100644
index 0000000..81ecf07
--- /dev/null
+++ b/Catswords.DataType.Client/Model/ExifTag.cs
@@ -0,0 +1,9 @@
+namespace Catswords.DataType.Client.Model
+{
+ class ExifTag
+ {
+ public string Section { get; set; }
+ public string Name { get; set; }
+ public string Description { get; set; }
+ }
+}
diff --git a/Catswords.DataType.Client/Properties/Resources.Designer.cs b/Catswords.DataType.Client/Properties/Resources.Designer.cs
index c9e490d..535621c 100644
--- a/Catswords.DataType.Client/Properties/Resources.Designer.cs
+++ b/Catswords.DataType.Client/Properties/Resources.Designer.cs
@@ -139,5 +139,15 @@ namespace Catswords.DataType.Client.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
+
+ ///
+ /// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
+ ///
+ internal static System.Drawing.Bitmap tags_icon_icons_com_73382 {
+ get {
+ object obj = ResourceManager.GetObject("tags_icon_icons_com_73382", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
}
}
diff --git a/Catswords.DataType.Client/Properties/Resources.resx b/Catswords.DataType.Client/Properties/Resources.resx
index b437a14..ff48454 100644
--- a/Catswords.DataType.Client/Properties/Resources.resx
+++ b/Catswords.DataType.Client/Properties/Resources.resx
@@ -139,6 +139,9 @@
..\Resources\office_18907.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\tags_icon-icons.com_73382.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\2333410-android-os-smartphone_85588.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
diff --git a/Catswords.DataType.Client/Resources/tags_icon-icons.com_73382.png b/Catswords.DataType.Client/Resources/tags_icon-icons.com_73382.png
new file mode 100644
index 0000000..b97b21f
Binary files /dev/null and b/Catswords.DataType.Client/Resources/tags_icon-icons.com_73382.png differ
diff --git a/Catswords.DataType.Client/UserControl1.cs b/Catswords.DataType.Client/UserControl1.cs
index e30ad4b..ef4a7f4 100644
--- a/Catswords.DataType.Client/UserControl1.cs
+++ b/Catswords.DataType.Client/UserControl1.cs
@@ -1,11 +1,8 @@
using Catswords.DataType.Client.Helper;
using Catswords.DataType.Client.Model;
using System;
-using System.ComponentModel.Design;
using System.Diagnostics;
-using System.Drawing;
using System.IO;
-using System.Linq;
using System.Windows.Forms;
namespace Catswords.DataType.Client
@@ -29,6 +26,7 @@ namespace Catswords.DataType.Client
imageList.Images.Add(Properties.Resources._2333410_android_os_smartphone_85588);
imageList.Images.Add(Properties.Resources.office_18907);
imageList.Images.Add(Properties.Resources.link_symbol_icon_icons_com_56927);
+ imageList.Images.Add(Properties.Resources.tags_icon_icons_com_73382);
// set image list
listView1.SmallImageList = imageList;
@@ -77,8 +75,11 @@ namespace Catswords.DataType.Client
// Get data from timeline
FetchFromTimeline();
- // Get links from file binary
+ // Get links from file
ExtractLink();
+
+ // Get EXIF tags from file
+ ExtractExif();
}
private void FetchFromFileExtensionDB()
@@ -107,10 +108,11 @@ namespace Catswords.DataType.Client
string imphash = ImpHash.Calculate(filePath);
search.Fetch(imphash);
- string companyInfo = FileCompany.Read(filePath);
- search.Fetch(companyInfo);
+ string organization = (new PeOrganizationExtractor(filePath)).GetString();
+ search.Fetch(organization);
+ listView1.Items.Add(new ListViewItem(new string[] { DateTime.Now.ToString(), "This file are distributed by " + organization }, 4));
- textBox1.Text = "ImpHash=" + imphash + "; CompanyInfo=" + companyInfo;
+ textBox1.Text = "ImpHash=" + imphash + "; Organization=" + organization;
}
catch (Exception ex)
{
@@ -190,10 +192,20 @@ namespace Catswords.DataType.Client
private void ExtractLink()
{
var extractor = new LinkExtractor(filePath);
- string[] links = extractor.GetStrings();
- foreach (string link in links)
+ var strings = extractor.GetStrings();
+ foreach (string str in strings)
{
- listView1.Items.Add(new ListViewItem(new string[] { DateTime.Now.ToString(), link }, 4));
+ listView1.Items.Add(new ListViewItem(new string[] { DateTime.Now.ToString(), str }, 4));
+ }
+ }
+
+ private void ExtractExif()
+ {
+ var extractor = new ExifTagExtractor(filePath);
+ var tags = extractor.GetTags();
+ foreach (ExifTag tag in tags)
+ {
+ listView1.Items.Add(new ListViewItem(new string[] { DateTime.Now.ToString(), $"{tag.Name} ({tag.Section}): {tag.Description}" }, 5));
}
}