C# 如何从文件加载到我的应用程序(如blender文件)
如何在此代码中使用parse类C# 如何从文件加载到我的应用程序(如blender文件),c#,opengl,C#,Opengl,如何在此代码中使用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 f
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);
}
}
}
如何在此代码中使用parse类
您在此处发布的代码段没有解析器。它所做的只是显示一个“打开文件对话框”,就这样。解析文件需要读取并解释其内容。您刚刚读取的代码就是一个文件。而且搅拌机文件很难解释。这不是不可能的,但一般来说,从Blender导出为易于处理的格式,然后使用类似于ASIMP的现成库阅读更容易。请编辑问题。不清楚你在问什么。检查如何提问这里有问题吗?