public TextEditor(TextContainer c, TextEditorMode mode) { InitializeComponent(); TextData = c; Mode = mode; for (int i = 0; i < TextData.Length; i++) { CB_Entry.Items.Add(c.GetFileName(i)); } CB_Entry.SelectedIndex = 0; dgv.EditMode = DataGridViewEditMode.EditOnEnter; }
public static void ExportTextFile(string fileName, bool newline, TextContainer lineData) { using MemoryStream ms = new MemoryStream(); ms.Write(new byte[] { 0xFF, 0xFE }, 0, 2); // Write Unicode BOM using (TextWriter tw = new StreamWriter(ms, new UnicodeEncoding())) { for (int i = 0; i < lineData.Length; i++) { // Get Strings for the File string[] data = lineData[i]; string fn = lineData.GetFileName(i); WriteTextFile(tw, fn, data, newline); } } File.WriteAllBytes(fileName, ms.ToArray()); }