Data 패키지 개선

This commit is contained in:
logonkhi
2025-06-10 20:16:35 +09:00
parent 649a359ab4
commit 7ef6825368
22 changed files with 1416 additions and 248 deletions

View File

@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using UVC.Log;
namespace UVC.Data
{
@@ -393,7 +394,25 @@ namespace UVC.Data
return new DataObject(jObject);
if (value is Dictionary<string, object> dict)
return new DataObject(dict);
}
// propertyName으로 직접 객체를 찾지 못했거나, 찾았지만 적절한 타입이 아닌 경우,
// 현재 DataObject의 값들 중 DataObject 타입인 것들을 순회하며 내부에서 propertyName을 다시 검색합니다.
foreach (KeyValuePair<string, object> keyValue in this)
{
if (keyValue.Value is DataObject nestedDataObject)
{
// 중첩된 DataObject에서 propertyName을 검색합니다.
// 여기서 defaultValue로 null을 전달하여, 이 탐색 단계에서 찾지 못하면
// 외부 호출의 defaultValue가 사용되도록 합니다.
DataObject? foundInNested = nestedDataObject.GetDataObject(propertyName, null);
if (foundInNested != null)
{
return foundInNested; // 중첩된 객체에서 찾았으면 반환
}
}
}
return defaultValue;
}