in utils/SkiaSharpGenerator/BaseTool.cs [243:298]
protected string CleanName(string type)
{
var prefix = "";
var suffix = "";
type = type.TrimStart('_');
if (type.EndsWith("_t"))
type = type[0..^2];
if (type.EndsWith("_proc") || type.EndsWith("_func"))
{
type = type[0..^5];
suffix = "ProxyDelegate";
}
foreach (var ns in config.Namespaces)
{
var nsPrefix = ns.Key;
if (type.StartsWith(nsPrefix))
{
var mapping = ns.Value;
if (mapping.Prefix != null)
{
prefix = mapping.Prefix;
type = type[nsPrefix.Length..];
}
}
}
string[] parts;
if (type.Any(c => char.IsLower(c)) && type.Any(c => char.IsUpper(c)))
{
// there is a mix of cases, so split on the uppercase, then underscores
parts = Regex.Split(type, @"(?<!^)(?=[A-Z])");
parts = parts.SelectMany(p => p.Split('_')).ToArray();
// remove the initial "f" prefix
if (parts[0] == "f" && char.IsUpper(parts[1][0]))
parts = parts[1..];
}
else
{
// this is either an fully uppercase enum or lowercase type
parts = type.ToLowerInvariant().Split('_');
}
for (var i = 0; i < parts.Length; i++)
{
var part = parts[i];
parts[i] = part[0].ToString().ToUpperInvariant() + part[1..];
}
return prefix + string.Concat(parts) + suffix;
}