Created
November 16, 2012 00:33
-
-
Save aschearer/4082797 to your computer and use it in GitHub Desktop.
T4 template file to create code from CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#@ template debug="false" hostspecific="true" language="C#" #> | |
<#@ output extension=".cs" #> | |
<#@ import namespace="System.IO" #> | |
/* THIS FILE IS AUTOGENERATED DO NOT EDIT | |
* | |
* This file is autogenerated from Coordinates.csv. | |
* If you want to add a new user interface coordinate | |
* do so in the CSV file then rebuild. | |
*/ | |
using System.Collections.Generic; | |
namespace Scrambloid.Common.Views.Resources | |
{ | |
public static class Coordinates | |
{ | |
<# | |
var path = Host.ResolvePath(string.Empty); | |
var file = Path.Combine(path, "Coordinates.csv"); | |
using (StreamReader reader = new StreamReader(file)) | |
{ | |
reader.ReadLine(); | |
while (!reader.EndOfStream) | |
{ | |
string line = reader.ReadLine(); | |
string[] keyValue = line.Split(','); | |
string propertyName = keyValue[0]; | |
string dimensions = string.Join(",", keyValue[1].Split(' ')); | |
string horizontalAlignment = keyValue[2]; | |
string verticalAlignment = keyValue[3]; | |
string drawOrder = keyValue[4]; | |
#> | |
public static readonly ScreenPosition <#= propertyName #> = new ScreenPosition(<#= dimensions #>, Alignment.<#= horizontalAlignment #>, Alignment.<#= verticalAlignment #>, <#= drawOrder #>f); | |
<# | |
} | |
} | |
#> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment