/// <summary> /// Generate log map information, in XML. /// </summary> /// <param name="ctx"> /// The <see cref="RegistryContext"/> holding the OpenGL specification information. /// </param> /// <param name="path"> /// A <see cref="String"/> that specifies the log map file path. /// </param> public void GenerateLogMap(RegistryContext ctx, string path) { KhronosLogMap logMap = new KhronosLogMap(); List <KhronosLogMap.Command> logCommands = new List <KhronosLogMap.Command>(); foreach (Command command in _Registry.Commands) { if (command.Parameters.Exists(delegate(CommandParameter item) { return(item.IsEnum); }) == false) { continue; } KhronosLogMap.Command logCommand = new KhronosLogMap.Command(); List <KhronosLogMap.CommandParam> logCommandParams = new List <KhronosLogMap.CommandParam>(); foreach (CommandParameter commandParameter in command.Parameters) { KhronosLogMap.CommandParam logParameter = new KhronosLogMap.CommandParam(); logParameter.Name = commandParameter.Name; logParameter.Flags = KhronosLogCommandParameterFlags.None; if (commandParameter.IsEnum) { logParameter.Flags |= KhronosLogCommandParameterFlags.Enum; } logCommandParams.Add(logParameter); } logCommand.Name = command.Prototype.Name; logCommand.Params = logCommandParams.ToArray(); logCommands.Add(logCommand); } logMap.Commands = logCommands.ToArray(); KhronosLogMap.Save(path, logMap); }
public void KhronosLogMap_Save() { KhronosLogMap m = new KhronosLogMap { Commands = new[] { new KhronosLogMap.Command { Name = "command", Params = new[] { new KhronosLogMap.CommandParam { Name = "arg0", Flags = KhronosLogCommandParameterFlags.Enum }, new KhronosLogMap.CommandParam { Name = "arg1", Flags = KhronosLogCommandParameterFlags.None }, new KhronosLogMap.CommandParam { Name = "arg2", /* Flags defaults to None */ } } } } }; Assert.DoesNotThrow(() => KhronosLogMap.Save("KhronosLogMap_Save.xml", m)); }