Advertisement
staafl

sample T4 template

Aug 8th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <#@ template language="C#" #>
  2. <#@ import namespace="System.Text" #>
  3. <#@ parameter type="System.Text.Encoding" name="encoding" #>
  4. <html>
  5. <body>
  6. <h2>Encoding <#= encoding.EncodingName #></h2>
  7. <table>
  8. <#
  9. /****************/
  10. /* TABLE HEADER */
  11. /****************/
  12. #>
  13. <tr>
  14. <# for (int jj = 0; jj < 4; ++jj) { #>
  15. <td>HEX</td>
  16. <td>CHAR</td>
  17. <# } #>
  18. </tr>
  19. <#
  20. /********************/
  21. /* TABLE HEADER END */
  22. /********************/
  23. #>
  24. <# for (int ii = 0; ii < 64; ++ii) { #>
  25. <tr>
  26. <#
  27. /*******************/
  28. /* TABLE ROW START */
  29. /*******************/
  30. #>
  31. <# for (int jj = 0; jj < 4; ++jj) { #>
  32. <#
  33. /*******************/
  34. /* CHARACTER START */
  35. /*******************/
  36. #>
  37. <# byte charCode = (byte)(ii*4 + jj); #>
  38. <td><#= charCode.ToString("X") #></td>
  39. <td><#= encoding.GetString(new[]{ charCode }) #></td>
  40. <#
  41. /*****************/
  42. /* CHARACTER END */
  43. /*****************/
  44. #>
  45. <# } #>
  46. <#
  47. /*****************/
  48. /* TABLE ROW END */
  49. /*****************/
  50. #>
  51. </tr>
  52. <# } #>
  53. </table>
  54. </body>
  55. </html>
  56. <#+ public Encoding Encoding { set { this._encodingField = value; } } #>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement