private static async Task <int> WriteFile(Project project, string file) { string extension = Path.GetExtension(file); string template = await TemplateMap.GetTemplateFilePath(project, file); if (!string.IsNullOrEmpty(template)) { int index = template.IndexOf('$'); if (index > -1) { template = template.Remove(index, 1); } await WriteToDisk(file, template); return(index); } await WriteToDisk(file, string.Empty); return(0); }
private static async Task <int> WriteFile(Project project, string file) { Encoding encoding = new UTF8Encoding(false); string extension = Path.GetExtension(file); string template = await TemplateMap.GetTemplateFilePath(project, file); var props = new Dictionary <string, string>() { { "extension", extension.ToLowerInvariant() } }; Telemetry.TrackEvent("File added", props); if (!string.IsNullOrEmpty(template)) { int index = template.IndexOf('$'); template = template.Remove(index, 1); File.WriteAllText(file, template, encoding); return(index); } File.WriteAllText(file, string.Empty, encoding); return(0); }