teigha 오류 수정

This commit is contained in:
2025-07-22 10:45:51 +09:00
parent 5282927833
commit b13e981d04
7 changed files with 1244 additions and 86 deletions

View File

@@ -15,15 +15,22 @@ namespace DwgExtractorManual.Models
/// </summary>
internal sealed class SqlDatas : IDisposable
{
Services appServices; // ODA 제품 활성화용
Services appServices; // ODA 제품 활성화용 (managed by singleton)
readonly string connectionString = "Host=localhost;Database=postgres;Username=postgres;Password=Qwer1234";
void ActivateAndInitializeODA()
void InitializeTeighaServices()
{
var userInfo = "c2FtYW4gZW5naW5lZXJpbmc=";
var userSignature = "F0kuQTmtVpHtvl/TgaFVGE92/YqGmYR9SLoXckEjnOk8NoAQh7Sg6GQruVC04JqD4C/IipxJYqpqvMfMc2auRMG+cAJCKqKUE2djIMdkUdb+C5IVx2c97fcK5ba3n8DDvB54Upokajl+6j12yD8h8MKGOR3Z3zysObeXD62bFpQgp00GCYTqlxEZtTIRjHIPAfJfix8Y0jtXWWYyVJ3LYOu86as5xtx+hY1aakpYIJiQk/6pGd84qSn/9K1w8nxR7UrFzieDeQ/xM58BHSD4u/ZxVJwvv6Uy10tsdBFBTvfJMAFp05Y7yeyeCNr100tA3iOfmWoXAVRHfxnkPfiYR54aK04QI+R6OGkI+yd1oR5BtmN6BdDt3z8KYK5EpFGJGiJIGoUy5PvkYdJ2VV6xe9JWBiIJuI/tDn1Y+uyTQFA9qaDHnOURriXsRGfy8reDPf1eejybSJxWKkpilG6RXhq3xHlCkjZzh1Q45S+xYXNGatcWMm9nkn20M8Ke5JEVaI9w/p2GE36CHRtRQbt8kfPmsbWNXJCFr4svHW2MPbCKWoyn5XEyMWBnuAKi74zvczB13DKjf29SqSIgF5k/hwy2QrgvnaKzY1k8bw8w2/k0vJXcS3GKOB/ZYDle1tf/lkAD1HtnF9zE18TiXhVnqwAVjwg4ui1RPLn/LMs6b5Y=";
Services.odActivate(userInfo, userSignature);
appServices = new Services();
try
{
Debug.WriteLine("[SqlDatas] TeighaServicesManager를 통한 Services 획득 중...");
appServices = TeighaServicesManager.Instance.AcquireServices();
Debug.WriteLine($"[SqlDatas] Services 획득 성공. Reference Count: {TeighaServicesManager.Instance.ReferenceCount}");
}
catch (Teigha.Runtime.Exception ex)
{
Debug.WriteLine($"[SqlDatas] Teigha Services 초기화 실패: {ex.Message}");
throw;
}
}
void CreateTables()
@@ -78,7 +85,7 @@ namespace DwgExtractorManual.Models
public SqlDatas()
{
ActivateAndInitializeODA();
InitializeTeighaServices();
CreateTables();
}
@@ -301,8 +308,20 @@ namespace DwgExtractorManual.Models
{
if (appServices != null)
{
appServices.Dispose();
appServices = null;
try
{
Debug.WriteLine("[SqlDatas] Teigha Services 해제 중...");
TeighaServicesManager.Instance.ReleaseServices();
Debug.WriteLine($"[SqlDatas] Teigha Services 해제 완료. Remaining ref count: {TeighaServicesManager.Instance.ReferenceCount}");
}
catch (Teigha.Runtime.Exception ex)
{
Debug.WriteLine($"[SqlDatas] Teigha Services 해제 중 오류 (무시됨): {ex.Message}");
}
finally
{
appServices = null;
}
}
}
}