public static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("Usage: ApiParser.exe docsFolder");
Console.WriteLine();
Console.WriteLine(" docsFolder - folder that contains all versions of Unity docs");
return;
}
Directory.SetCurrentDirectory(args[0]);
var progPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
var dataPath = Path.Combine(progPath, @"Unity\Editor\Data");
var monoPath = Path.Combine(dataPath, @"Mono\lib\mono\unity");
var basePath = Path.Combine(dataPath, @"Managed");
TypeResolver.AddAssembly(typeof(string).Assembly);
TypeResolver.AddAssembly(Assembly.LoadFrom(Path.Combine(basePath, @"UnityEngine.dll")));
TypeResolver.AddAssembly(Assembly.LoadFrom(Path.Combine(monoPath, @"UnityScript.dll")));
TypeResolver.AddAssembly(Assembly.LoadFrom(Path.Combine(basePath, @"UnityEditor.dll")));
Console.WriteLine();
var unityApi = new UnityApi();
var parser = new ApiParser(unityApi, ScriptReferenceRelativePath);
parser.Progress += (s, e) =>
{
var cursorTop = Console.CursorTop;
Console.WriteLine("{0,5} / {1,5} ({2,3}%)", e.Current, e.Total, e.Percent);
Console.SetCursorPosition(0, cursorTop);
};
foreach (var doc in Docs)
{
Console.WriteLine(doc.Item1);
parser.ParseFolder(doc.Item1, doc.Item2);
AddUndocumentApis(unityApi, doc.Item2);
}
AddUndocumentedOptionalParameters(unityApi);
AddUndocumentedCoroutines(unityApi);
Fixup(unityApi);
using (var writer = new XmlTextWriter(@"api.xml", Encoding.UTF8)
{
Formatting = Formatting.Indented
})
{
parser.ExportTo(writer);
}
// Console.WriteLine( "Press <Enter> key to continue..." );
// Console.ReadLine();
}