/// <summary> /// Opens a file without the use of a OpenFileDialog /// </summary> /// <param name="rtbIn"></param> /// <param name="filePath"></param> /// <returns></returns> public string silentOpen(RichTextBoxPrintCtrl.RichTextBoxPrintCtrl rtbIn, string filePath) { //getCurrentDocument.AppendText(File.ReadAllText(filePath)); if (filePath.EndsWith(".rtf")) { rtbIn.LoadFile(filePath, RichTextBoxStreamType.RichText); } else { rtbIn.LoadFile(filePath, RichTextBoxStreamType.PlainText); } addFileToMap(filePath, filePath); console.Append(Asys.GetTime() + "Opening file (SilentOpen)"); return filePath; }
/// <summary> /// Open a file from the filesystem and adds it to the Map. /// </summary> /// <param name="rtbIn"></param> /// <returns>The filename returned by the OpenFileDialog</returns> public string open(RichTextBoxPrintCtrl.RichTextBoxPrintCtrl rtbIn) { if (openDialog.ShowDialog() == DialogResult.OK) { if (openDialog.FileName.Length > 0) { string fileName = Path.GetFileName(openDialog.FileName); if (fileName.EndsWith(".rtf")) { rtbIn.LoadFile(openDialog.FileName, RichTextBoxStreamType.RichText); } else { rtbIn.LoadFile(openDialog.FileName, RichTextBoxStreamType.PlainText); } addFileToMap(openDialog.FileName, openDialog.FileName); console.Append(Asys.GetTime() + "Opening file"); return fileName; } else { return ""; } } else { return ""; } }