Skip to content

Commit

Permalink
기능 보강 및 버그 수정
Browse files Browse the repository at this point in the history
- 카탈로그 불러오기 + 스트링테이블에 URL 정보 추가
- 리소스 매크로 심볼 추가
- 버전 식별 정보 추가
  • Loading branch information
rkttu committed Aug 26, 2024
2 parents a7c7688 + 212a93f commit 33a39ea
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/TableCloth.CatalogBuilder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,20 +323,33 @@ static void GenerateWin32RCFile(XDocument catalog, TextWriter logWriter, string
""");

for (int i = 0, count = 0; i < icoFiles.Length; i++)
{
rcWriter.WriteLine($"#define ICON_{(i + 1)} {++count}");
rcWriter.WriteLine($"#define ID_{(i + 1)} {++count}");
rcWriter.WriteLine($"#define URL_{(i + 1)} {++count}");
}

for (int i = 0; i < icoFiles.Length; i++)
{
var eachIcoFile = icoFiles[i];
var identifier = Path.GetFileNameWithoutExtension(eachIcoFile)!.ToUpperInvariant();
var relativePath = Path.GetRelativePath(targetDirectory, eachIcoFile);
rcWriter.WriteLine($"{(i + 1)} ICON \"{relativePath}\"");
var relativePath = Path.GetRelativePath(targetDirectory, eachIcoFile).Replace('\\', '/');
rcWriter.WriteLine($"ICON_{(i + 1)} ICON \"{relativePath}\"");
}

var now = DateTime.UtcNow;
var major = now.Year;
var minor = now.Month;
var build = now.Day;
var rev = now.Hour * 60 + now.Minute;

rcWriter.WriteLine(
"""
$$"""
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEVERSION {{major}},{{minor}},{{build}},{{rev}}
PRODUCTVERSION {{major}},{{minor}},{{build}},{{rev}}
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
Expand All @@ -349,12 +362,12 @@ FILESUBTYPE 0x0L
BEGIN
VALUE "CompanyName", "rkttu.com\0"
VALUE "FileDescription", "Catalog Icon Library for Win32 applications\0"
VALUE "FileVersion", "1.0.0.0\0"
VALUE "FileVersion", "{{major}},{{minor}},{{build}},{{rev}}\0"
VALUE "InternalName", "Catalog.dll\0"
VALUE "LegalCopyright", "(c) rkttu.com, All rights reserved.\0"
VALUE "OriginalFilename", "Catalog.dll\0"
VALUE "ProductName", "TableCloth\0"
VALUE "ProductVersion", "1.0.0.0\0"
VALUE "ProductVersion", "{{major}},{{minor}},{{build}},{{rev}}\0"
END
END
BLOCK "VarFileInfo"
Expand All @@ -372,15 +385,15 @@ FILESUBTYPE 0x0L
var eachIcoFile = icoFiles[i];
var identifier = Path.GetFileNameWithoutExtension(eachIcoFile)!.ToUpperInvariant();

rcWriter.WriteLine($" ID_{(i + 1)}, \"{identifier}\"");
rcWriter.WriteLine($" ID_{(i + 1)} \"{identifier}\"");

var targetElement = catalog.XPathSelectElement($"/TableClothCatalog/InternetServices/Service[translate(@Id, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') = '{identifier}']");
var url = targetElement?.Attribute("Url")?.Value;

if (string.IsNullOrWhiteSpace(url))
url = "https://yourtablecloth.app/";

rcWriter.WriteLine($" URL_{(i + 1)}, \"{url}\"");
rcWriter.WriteLine($" URL_{(i + 1)} \"{url}\"");
}
rcWriter.WriteLine("END");
}
Expand Down

0 comments on commit 33a39ea

Please sign in to comment.