Files
lserp_cs_5.0/插件库/Cef3.24/Interop/Base/cef_string_map.cs
T
2026-07-10 15:25:05 +08:00

37 lines
1.2 KiB
C#

namespace Cef3.Interop
{
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
[StructLayout(LayoutKind.Sequential, Pack = libcef.ALIGN)]
internal unsafe struct cef_string_map
{
public static Dictionary<string, string> ToDictionary(cef_string_map* map)
{
if (map == null) return null;
var result = new Dictionary<string, string>();
var count = libcef.string_map_size(map);
if (count == 0) return result;
cef_string_t n_value = new cef_string_t();
for (var i = 0; i < count; i++)
{
libcef.string_map_key(map, i, &n_value); // FIXME: do not ignore return value of libcef.string_map_key
var key = cef_string_t.ToString(&n_value);
libcef.string_map_value(map, i, &n_value); // FIXME: do not ignore return value of libcef.string_map_value
var value = cef_string_t.ToString(&n_value);
result.Add(key, value);
}
libcef.string_clear(&n_value);
return result;
}
}
}