private bool LoadFile() { ofd = ofd ?? new OpenFileDialog { Multiselect = false, Title = "选择脚本文件", Filter = "脚本文件(*.psc)|*.psc|二进制文件(*.bin)|*.bin", InitialDirectory = AppDomain.CurrentDomain.BaseDirectory, RestoreDirectory = false }; if (ofd.ShowDialog(this) == DialogResult.OK) { filePath = ofd.FileName; this.context = ContextUtil.FromFile(filePath); return(this.context != null); } return(false); }