in tools/apiParser/src/ApiParser.cs [41:111]
public void ParseFolder(string path, Version apiVersion, RiderSupportedLanguages langCode)
{
var currentDirectory = Directory.GetCurrentDirectory();
try
{
Directory.SetCurrentDirectory(path);
var links = LoadTypes(Path.Combine(ScriptReferenceRelativePath, "docdata/toc.json"), apiVersion)
.Select(f => (file: Path.Combine(ScriptReferenceRelativePath, f.link) + ".html", f.fullName)).ToArray();
Console.WriteLine("Number of types: {0}", links.Length);
var messages = new List<TypeDocument>();
var progress = 1;
for (int i = 0; i < links.Length; ++i)
{
// Some of the links in toc.json aren't valid...
if (!File.Exists(links[i].file))
{
Console.WriteLine($"Cannot find file {links[i].file}");
progress++;
continue;
}
var document = TypeDocument.Load(links[i].file, links[i].fullName, langCode);
progress++;
if (document != null)
{
if (document.IsRemoved)
{
myTypeResolver.MarkObsolete(document.FullName, apiVersion);
if (document.Messages.Length != 0)
{
Console.WriteLine(
$"{document.FullName} is documented but no longer available in {apiVersion}");
}
}
else if (document.Messages.Length > 0)
{
messages.Add(document);
progress--;
}
}
ReportProgress(progress, links.Length);
}
foreach (var document in messages)
{
ReportProgress(progress++, links.Length);
var unityApiType =
myApi.AddType(document.Namespace, document.ShortName, document.Kind, document.DocPath, apiVersion);
foreach (var message in document.Messages)
{
var eventFunction =
ParseMessage(document.ShortName, message, apiVersion, document.Namespace, langCode);
if (eventFunction == null)
continue;
unityApiType.MergeEventFunction(eventFunction, apiVersion);
}
}
}
finally
{
Directory.SetCurrentDirectory(currentDirectory);
}
Console.WriteLine();
}