Program.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace QuickContent
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. var lines = System.IO.File.ReadAllLines(args[0]);
  13. var foundJsonOrText = false;
  14. var currentFile = "";
  15. for (var i = 0; i < lines.Length; ++i)
  16. {
  17. var line = lines[i];
  18. if (line.StartsWith("#begin "))
  19. {
  20. currentFile = line.Substring("#begin ".Length);
  21. if (currentFile.EndsWith(".json") || currentFile.EndsWith(".txt") || currentFile.EndsWith(".conv") || currentFile.EndsWith(".font"))
  22. {
  23. foundJsonOrText = true;
  24. }
  25. }
  26. else if (line.StartsWith("/build:"))
  27. {
  28. if (foundJsonOrText)
  29. lines[i] = "/copy:" + currentFile;
  30. }
  31. else if (String.IsNullOrEmpty(line))
  32. foundJsonOrText = false;
  33. }
  34. System.IO.File.WriteAllLines(args[0], lines);
  35. }
  36. }
  37. }