如何在此代码中使用parse类
private void openModelToolStripMenuItem_Click_1(object sender, EventArgs e)
{
Stream myStream = null;
OpenFileDialog theDialog = new OpenFileDialog();
theDialog.Title = "Open Text File";
theDialog.Filter = "TXT files|*.txt";
theDialog.InitialDirectory = @"C:\";
if (theDialog.ShowDialog() == DialogResult.OK)
{
try
{
if ((myStream = theDialog.OpenFile()) != null)
{
using (myStream)
{
// Insert code to read the stream here.
string FileString = theDialog.FileName;
string FileText = File.ReadAllText(FileString);
glcontrol_1.Text = FileText;
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
}
}
}
答案 0 :(得分:0)
如何在此代码中使用parse类
您在那里发布的代码段没有解析器。它只是显示一个“打开文件对话框”,就是这样。解析文件涉及阅读,然后解释其内容。您刚刚读取的代码文件就是这样。 Blender文件也很难解释。并非不可能,但总的来说,从Blender导出为易于处理的格式更容易,然后使用像Assimp这样的现成库来阅读。