/// <summary> /// Writes documentation to all functions in an interface at once. /// </summary> /// <param name="interface">The interface to write to.</param> /// <param name="doc">The documentation to write.</param> /// <param name="prefix">The function name's prefix.</param> public static void Write(Interface @interface, ProfileDocumentation doc, string prefix) { foreach (var function in @interface.Functions) { if (NameTrimmer.GetNameVariations(function.NativeName, prefix).Any(doc.Functions.ContainsKey)) { doc.Functions [ NameTrimmer.GetNameVariations(function.NativeName, prefix).First(doc.Functions.ContainsKey) ] .Write(function); } else { var sb = new StringBuilder(); sb.AppendLine("/// <summary>"); sb.AppendLine("/// To be added."); sb.AppendLine("/// </summary>"); foreach (var parameter in function.Parameters) { sb.AppendLine($"/// <param name=\"{parameter.Name}\">"); sb.AppendLine("/// To be added."); if (!(parameter.Count is null)) { if (parameter.Count.IsStatic) { sb.AppendLine($"/// This parameter contains {parameter.Count.StaticCount} elements."); } if (parameter.Count.IsComputed) { var parameterList = parameter.Count.ComputedFromNames.Humanize(); sb.AppendLine($"/// This parameter's element count is computed from {parameterList}."); } if (parameter.Count.IsReference) { // ReSharper disable once PossibleNullReferenceException sb.AppendLine ( $"/// This parameter's element count is taken from {parameter.Count.ValueReference}." ); } } sb.AppendLine("/// </param>"); } if (function.ReturnType.ToString() != "void") { sb.AppendLine("/// <returns>See summary.</returns>"); } function.Doc = sb.ToString(); } } }
/// <summary> /// Writes documentation to all functions in a project at once. /// </summary> /// <param name="project">The project to write to.</param> /// <param name="doc">The documentation to write.</param> /// <param name="prefix">The function name's prefix.</param> public static void Write(Project project, ProfileDocumentation doc, string prefix) { project.Interfaces.ForEach(x => Write(x.Value, doc, prefix)); }
/// <summary> /// Writes documentation to all functions in a profile at once. /// </summary> /// <param name="profile">The profile to write to.</param> /// <param name="doc">The documentation to write.</param> public static void Write(Profile profile, ProfileDocumentation doc) { profile.Projects.ForEach(x => Write(x.Value, doc, profile.FunctionPrefix)); }