private UnityApiEventFunction ParseMessage(ApiNode message, Version apiVersion, string hintNamespace)
{
var link = message.SelectOne(@"td.lbl/a");
var desc = message.SelectOne(@"td.desc");
if (link == null || desc == null)
{
return(null);
}
var detailsPath = link[@"href"];
if (string.IsNullOrWhiteSpace(detailsPath))
{
return(null);
}
var path = Path.Combine(myScriptReferenceRelativePath, detailsPath);
if (!File.Exists(path))
{
return(null);
}
var detailsDoc = ApiNode.Load(path);
var details = detailsDoc?.SelectOne(@"//div.content/div.section");
var signature = details?.SelectOne(@"div.mb20.clear/h1.heading.inherit");
var staticNode = details?.SelectOne(@"div.subsection/p/code.varname[text()='static']");
if (signature == null)
{
return(null);
}
var isCoroutine = CoroutineRegex.IsMatch(details.Text);
var messageName = link.Text;
var returnType = ApiType.Void;
string[] argumentNames = null;
var isStaticFromExample = false;
var example = PickExample(details);
if (example != null)
{
var tuple = ParseDetailsFromExample(messageName, example, hintNamespace);
returnType = tuple.Item1;
argumentNames = tuple.Item2;
isStaticFromExample = tuple.Item3;
}
var docPath = Path.Combine(myScriptReferenceRelativePath, detailsPath);
var eventFunction = new UnityApiEventFunction(messageName, staticNode != null || isStaticFromExample, isCoroutine,
returnType, apiVersion, desc.Text, docPath);
ParseParameters(eventFunction, signature, details, hintNamespace, argumentNames);
return(eventFunction);
}