Skip to content

Instantly share code, notes, and snippets.

@TomasDrozdik
Created October 27, 2018 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomasDrozdik/943b8c36245cdeada2b7e20b3f83b292 to your computer and use it in GitHub Desktop.
Save TomasDrozdik/943b8c36245cdeada2b7e20b3f83b292 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
try {
using (StreamReader sr = new StreamReader(args[0])) {
using (StreamWriter sw = new StreamWriter(args[0] + ".cs.txt")) {
string line;
while ((line = sr.ReadLine()) != null) {
StringBuilder sb = new StringBuilder(line);
for (int i = 0; i < sb.Length; ++i) {
if (sb[i] == '"') {
sb.Insert(i, '\\');
++i;
}
}
sb.Insert(0, "w.WriteLine(\"");
sb.Append("\");");
sw.WriteLine(sb.ToString());
}
}
}
}
catch (IOException) {
Console.WriteLine("Argument Error!");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment