public static void Main(string[] args) { string samplesPath = args[0]; string inDir = args[1]; if (!File.Exists(samplesPath)) { Console.WriteLine("Couldn't find samples repository at {0}"); return; } if (!Directory.Exists(inDir)) { Console.WriteLine("Couldn't find input snippet directory"); return; } var langExtensions = new Dictionary <string, string> () { { ".xml", "XML" }, { ".cs", "C#" } }; SampleRepository samples = SampleRepository.LoadFrom(samplesPath); foreach (var file in Directory.EnumerateFiles(inDir, "*", SearchOption.AllDirectories)) { var extension = Path.GetExtension(file); var id = Path.GetFileNameWithoutExtension(file); if (string.IsNullOrEmpty(extension) || string.IsNullOrEmpty(id)) { continue; } string lang; if (!langExtensions.TryGetValue(extension, out lang) || !samples.IsValidID(id)) { Console.WriteLine("Not processed: {0}", Path.GetFileName(file)); continue; } SampleDesc oldDesc = samples.GetSampleDescFromID(id); samples.OverwriteSample(id, File.ReadAllText(file), new SampleDesc { ID = id, Language = lang, DocumentationFilePath = oldDesc.DocumentationFilePath, FullTypeName = oldDesc.FullTypeName }); Console.WriteLine("Done: {0}", id); } samples.Close(false); }