daily pastebin goal
42%
SHARE
TWEET

T4 Template

a guest Sep 26th, 2015 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#@ template debug="false" hostspecific="true" language="C#" #>
  2. <#@ assembly name="System.Core" #>
  3. <#@ import namespace="System.Linq" #>
  4. <#@ import namespace="System.IO" #>
  5. <#@ output extension=".cs" #>
  6.  
  7. namespace MyNamespace
  8. {
  9.         public enum SoundNames
  10.         {
  11. <#
  12.                 string path = this.Host.ResolvePath("");
  13.                 Directory.SetCurrentDirectory(path);
  14.  
  15.                 string soundFilesPath = @".\Sounds\";
  16.                 var soundNames = Directory
  17.                                                                 .GetFiles(soundFilesPath, "*.*", SearchOption.AllDirectories)
  18.                                                                 .Where(file => file.ToLower().EndsWith("wav") || file.ToLower().EndsWith("mp3"))
  19.                                                                 .Select(soundFilePath => Path.GetFileNameWithoutExtension(soundFilePath))
  20.                                                                 .ToList();
  21.  
  22.                 foreach (var name in soundNames)
  23.                 {
  24. #>
  25.                 <#= name #>,
  26. <#
  27.                 }
  28. #>
  29.         }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top