//This creates a new instance of a text file. //This creates the text file with the from the input of the string from the google translate. //The text files is then put in the internal session audio list through the information of the audio_node. public void Create_Translate_Text_File(string message) { string Text_File_Name_Path = ""; count = count + 1; string final_Text_File_Name; final_Text_File_Name = Text_File_Name + count.ToString(); Text_File_Name_Path = Root_Text_Url + final_Text_File_Name + ".txt"; Text_Translate_Node temp = new Text_Translate_Node(); temp.Set_Text_Number(count); temp.Set_Text_Location(Text_File_Name_Path); temp.Set_Translated_Message(message); Text_Translation_List.AddLast(temp); using (System.IO.StreamWriter sw = System.IO.File.CreateText(Text_File_Name_Path)) { sw.WriteLine(message); temp.Set_Writer_Stream(sw); } }
//This creates a text file that has all the message at once for the user to look at. //There is a special directory that is created as well as a unique text file with all the speech translations. public void Create_Master_Translation_Text_File() { string Final_Message; string Combined_Session_text_Path = "\\Final_Session_Output"; Combined_Session_text_Path = Root_Text_Url + Combined_Session_text_Path; if (System.IO.Directory.Exists(Combined_Session_text_Path)) { System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(Combined_Session_text_Path); foreach (System.IO.FileInfo file in di.GetFiles()) { file.Delete(); } foreach (System.IO.DirectoryInfo dir in di.GetDirectories()) { dir.Delete(true); } } System.IO.Directory.CreateDirectory(Combined_Session_text_Path); string Combined_Session_Text_File = Combined_Session_text_Path + "\\Final_Translated_Text.txt"; Final_Message = Print_Text_Info(); count = count + 1; Text_Translate_Node temp = new Text_Translate_Node(); temp.Set_Text_Number(count); temp.Set_Text_Location(Combined_Session_Text_File); temp.Set_Translated_Message(Final_Message); Text_Translation_List.AddLast(temp); using (System.IO.StreamWriter sw = System.IO.File.CreateText(Combined_Session_Text_File)) { sw.WriteLine(Final_Message); temp.Set_Writer_Stream(sw); } }