/// <summary> /// Makes a layout from a layout guess. /// </summary> /// <param name="layout">The layout guess.</param> /// <param name="name">The name of the final layout.</param> /// <param name="groupTag">The group tag of the final layout. Can be <c>null</c>.</param> /// <returns></returns> public static TagLayout MakeLayout(TagLayoutGuess layout, string name, Tag groupTag) { var result = new TagLayout(name, layout.Size, groupTag); var finalizer = new LayoutGuessFinalizer(result, 0); finalizer.ProcessLayout(layout); return result; }
public override void WriteLayout(TagLayout layout, TextWriter writer) { WriteHeader(writer); var name = NamingConvention.ToPascalCase(layout.Name); var builder = new ClassBuilder(writer, 2); builder.Begin(name, layout.Size, layout.GroupTag); layout.Accept(builder); builder.End(); WriteFooter(writer); }
public override void WriteLayout(TagLayout layout, TextWriter writer) { WriteHeader(writer); var name = NamingConvention.ToPascalCase(layout.Name); var builder = new ClassBuilder(writer, 1); builder.Begin(name, layout.Size, 0, layout.GroupTag); layout.Accept(builder); builder.End(); WriteFooter(writer); }
public void Visit(uint offset, TagBlockGuess guess) { var name = string.Format("Tag Block {0}", _nextTagBlock); _nextTagBlock++; var elementLayout = new TagLayout(name, guess.ElementLayout.Size, new Tag(0)); var finalizer = new LayoutGuessFinalizer(elementLayout, _nextTagBlock); finalizer.ProcessLayout(guess.ElementLayout); var align = guess.Align; if ((guess.ElementLayout.Size & (guess.Align - 1)) != 0) align = 0; _nextTagBlock = finalizer._nextTagBlock; _result.Add(new TagBlockTagLayoutField(MakeName(offset), elementLayout) { DataAlign = align }); }
public override string GetSuggestedFileName(TagLayout layout) { return(string.Format("{0}.cs", NamingConvention.ToPascalCase(layout.Name))); }
private LayoutGuessFinalizer(TagLayout result, int nextTagBlock) { _result = result; _nextTagBlock = nextTagBlock; }
/// <summary> /// Writes a layout to a file. /// </summary> /// <param name="layout">The layout to write.</param> /// <param name="path">The path to write to.</param> public void WriteLayout(TagLayout layout, string path) { using (var writer = new StreamWriter(File.Open(path, FileMode.Create, FileAccess.Write))) WriteLayout(layout, writer); }
/// <summary> /// Writes a layout to a stream. /// </summary> /// <param name="layout">The layout to write.</param> /// <param name="writer">The writer to write to.</param> public abstract void WriteLayout(TagLayout layout, TextWriter writer);
/// <summary> /// Gets the suggested filename for a layout. /// </summary> /// <param name="layout">The layout.</param> /// <returns>A suggested filename to write the layout to.</returns> public abstract string GetSuggestedFileName(TagLayout layout);
public override string GetSuggestedFileName(TagLayout layout) { return string.Format("{0}.hpp", NamingConvention.ToPascalCase(layout.Name)); }
public TagBlockTagLayoutField(string name, TagLayout elementLayout) : base(name) { ElementLayout = elementLayout; }