tables.sbn 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. using Google.Protobuf;
  2. using Google.Protobuf.Collections;
  3. using System.Reflection;
  4. {{namespace_with_grace_begin __namespace}}
  5. public partial class {{__name}}
  6. {
  7. {{~for table in __tables ~}}
  8. {{~if table.comment != '' ~}}
  9. /// <summary>
  10. /// {{escape_comment table.comment}}
  11. /// </summary>
  12. {{~end~}}
  13. public {{proto_full_name table.full_name}} {{format_property_name __code_style table.name}} { get; }
  14. {{~end~}}
  15. public {{__name}}(System.Func<string, byte[]> loader)
  16. {
  17. {{~for table in __tables ~}}
  18. {{format_property_name __code_style table.name}} = {{proto_full_name table.full_name}}.Parser.ParseFrom(loader("{{table.output_data_file}}"));
  19. {{~end~}}
  20. }
  21. public {{__name}}(System.Func<string, string> loader)
  22. {
  23. {{~for table in __tables ~}}
  24. {{format_property_name __code_style table.name}} = {{proto_full_name table.full_name}}.Parser.ParseJson(loader("{{table.output_data_file}}"));
  25. {{~end~}}
  26. }
  27. }
  28. {{namespace_with_grace_end __namespace}}