Remove useless code
This commit is contained in:
@@ -106,44 +106,6 @@ namespace PerfectWorld.Scripts.Managers
|
||||
Debug.Log($"[Inventory] CP936 fallback result: '{s}' (length: {s?.Length ?? 0})");
|
||||
if (!string.IsNullOrEmpty(s)) return s;
|
||||
}
|
||||
|
||||
var fieldReal = t.GetField("realname", BindingFlags.Public | BindingFlags.Instance);
|
||||
if (fieldReal != null && fieldReal.FieldType == typeof(byte[]))
|
||||
{
|
||||
var arr = fieldReal.GetValue(data) as byte[];
|
||||
// Debug: Log the raw byte array data
|
||||
if (arr != null && arr.Length > 0)
|
||||
{
|
||||
var rawData = string.Join(",", arr.Take(Math.Min(20, arr.Length)));
|
||||
Debug.Log($"[Inventory] Raw realname byte array data (first 20): [{rawData}]");
|
||||
}
|
||||
|
||||
// Try UTF-8 first for realname field (as per C++ code using CP_UTF8)
|
||||
var s = ByteToStringUtils.ByteArrayToUTF8String(arr);
|
||||
Debug.Log($"[Inventory] UTF-8 realname decode result: '{s}' (length: {s?.Length ?? 0})");
|
||||
if (!string.IsNullOrEmpty(s)) return s;
|
||||
|
||||
// Fallback to CP936
|
||||
s = ByteToStringUtils.ByteArrayToCP936String(arr);
|
||||
Debug.Log($"[Inventory] CP936 realname fallback result: '{s}' (length: {s?.Length ?? 0})");
|
||||
if (!string.IsNullOrEmpty(s)) return s;
|
||||
}
|
||||
|
||||
var prop = t.GetProperty("Name", BindingFlags.Public | BindingFlags.Instance);
|
||||
if (prop != null && prop.PropertyType == typeof(string))
|
||||
{
|
||||
var val = prop.GetValue(data) as string;
|
||||
Debug.Log($"[Inventory] Name property result: '{val}' (length: {val?.Length ?? 0})");
|
||||
if (!string.IsNullOrEmpty(val) && !string.IsNullOrWhiteSpace(val)) return val;
|
||||
}
|
||||
var propReal = t.GetProperty("RealName", BindingFlags.Public | BindingFlags.Instance);
|
||||
if (propReal != null && propReal.PropertyType == typeof(string))
|
||||
{
|
||||
var val = propReal.GetValue(data) as string;
|
||||
Debug.Log($"[Inventory] RealName property result: '{val}' (length: {val?.Length ?? 0})");
|
||||
if (!string.IsNullOrEmpty(val) && !string.IsNullOrWhiteSpace(val)) return val;
|
||||
}
|
||||
|
||||
// Try calling GetName method if it exists (similar to C++ pIt->GetName())
|
||||
var getNameMethod = t.GetMethod("GetName", BindingFlags.Public | BindingFlags.Instance);
|
||||
if (getNameMethod != null && getNameMethod.ReturnType == typeof(string))
|
||||
@@ -159,7 +121,6 @@ namespace PerfectWorld.Scripts.Managers
|
||||
Debug.LogWarning($"[Inventory] Error calling GetName method: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user