string filename = "";
private void openToolStripMenuItem1_Click(object sender, EventArgs e)
{
OpenFileDialog theDialog = new OpenFileDialog();
theDialog.Title = "Open Text File";
theDialog.Filter = "TXT files|*.txt";
theDialog.InitialDirectory = @"C:\";
if (theDialog.ShowDialog() == DialogResult.OK)
{
lines = File.ReadAllLines(RecentFiles);
filename = theDialog.FileName;
if (!lines.Any(line => line.Equals(filename)))
{
recentfiles = new StreamWriter(RecentFiles, true);
recentfiles.WriteLine(theDialog.FileName);
recentfiles.Close();
}
items = File
.ReadLines(RecentFiles)
.Select(line => new ToolStripMenuItem()
{
Text = line
})
.ToArray();
recentFilesToolStripMenuItem.DropDownItems.Clear();
recentFilesToolStripMenuItem.DropDownItems.AddRange(items);
TextFileContentToRichtextbox(filename);
}
}
When i open a text file and add it to the richTextBox in cases i copied the website page source view content to a text file first and then open the text file how do i know if the content is html code or just regular text ?
Same when i make paste to the richTextBox window directly i want to know if the text is html code or regular text and then to decide how to continue.