public void ExportProject(string paramFilename) { string path = paramFilename + FOCUS_TREE_PATH; Directory.CreateDirectory(path); //For each parsed focus trees foreach (KeyValuePair <string, string> item in FocusTreeParser.ParseAllTrees(fociContainerList)) { using (TextWriter tw = new StreamWriter(path + item.Key + ".txt")) { tw.Write(item.Value); } } path = paramFilename + LOCALISATION_PATH; Directory.CreateDirectory(Path.GetDirectoryName(path)); LocalisationContainer loct = null; //For each parsed localisation files foreach (KeyValuePair <string, string> item in LocalisationParser.ParseEverything(localisationList)) { //localisationList.IndexOf(loct, 0); //fork //fixed localization files save in UTF-8 with BOM format loct = localisationList[0]; using (Stream stream = File.OpenWrite(path + item.Key + "_" + loct.LanguageName + ".yml")) //save in file name eg.'test_l_english.yml' using (TextWriter tw = new StreamWriter(stream, new UTF8Encoding(true))) { tw.Write(item.Value); } } path = paramFilename + EVENTS_PATH; Directory.CreateDirectory(Path.GetDirectoryName(path)); //For each parsed event file foreach (KeyValuePair <string, string> item in EventParser.ParseAllEvents(eventList)) { //using (TextWriter tw = new StreamWriter(path + item.Key + ".txt")) //fork need to be UTF-8 with BOM using (TextWriter tw = new StreamWriter(path + item.Key + ".txt", false, new UTF8Encoding(true))) { tw.Write(item.Value); } } //For each parsed script file foreach (KeyValuePair <string, string> item in ScriptParser.ParseEverything(scriptList)) { using (TextWriter tw = new StreamWriter(paramFilename + "\\" + item.Key + ".txt")) { tw.Write(item.Value); } } }
public void ExportProject(string paramFilename) { string path = paramFilename + FOCUS_TREE_PATH; Directory.CreateDirectory(path); //For each parsed focus trees foreach (KeyValuePair <string, string> item in FocusTreeParser.ParseAllTrees(fociContainerList)) { using (TextWriter tw = new StreamWriter(path + item.Key + ".txt")) { tw.Write(item.Value); } } path = paramFilename + LOCALISATION_PATH; Directory.CreateDirectory(Path.GetDirectoryName(path)); //For each parsed localisation files foreach (KeyValuePair <string, string> item in LocalisationParser.ParseEverything(localisationList)) { using (Stream stream = File.OpenWrite(path + item.Key + ".yml")) using (TextWriter tw = new StreamWriter(stream, new UTF8Encoding())) { tw.Write(item.Value); } } path = paramFilename + EVENTS_PATH; Directory.CreateDirectory(Path.GetDirectoryName(path)); //For each parsed event file foreach (KeyValuePair <string, string> item in EventParser.ParseAllEvents(eventList)) { using (TextWriter tw = new StreamWriter(path + item.Key + ".txt")) { tw.Write(item.Value); } } //For each parsed script file foreach (KeyValuePair <string, string> item in ScriptParser.ParseEverything(scriptList)) { using (TextWriter tw = new StreamWriter(paramFilename + "\\" + item.Key + ".txt")) { tw.Write(item.Value); } } }
private void TestScriptToScript(ScriptModel model) { //Arrange ScriptContainer container = new ScriptContainer() { InternalScript = model.InternalScript, FileInfo = model.FileInfo, ContainerID = model.VisibleName }; List <ScriptContainer> list = new List <ScriptContainer> { container }; //Act Dictionary <string, string> files = ScriptParser.ParseEverything(list); string filecontent = files.FirstOrDefault().Value; string fileName = files.FirstOrDefault().Key; //Assert Assert.IsNotNull(filecontent); Assert.IsNotNull(fileName); Assert.AreEqual(fileName, "AFG - Afghanistan"); }