public bool LoadDat(string DatPath, List <string> crFiles, Color Transparency) { DatReaderError status; DAT loadedDat = DATReader.ReadDat(DatPath, out status); if (status.Error != DatError.Success) { MessageBox.Show("Error loading " + DatPath + ": " + Environment.NewLine + status.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } List <DATFile> files = new List <DATFile>(); foreach (string path in this.EditorData.GraphicsPaths) { files.AddRange(loadedDat.GetFilesByPattern(path)); // Critters to load foreach (var crType in critterData.crTypeGraphic.Values) { var file = loadedDat.GetFileByName("art\\critters\\" + crType.ToUpper() + "AA.FRM"); // Idle anim if (file == null) { file = loadedDat.GetFileByName("art\\critters\\" + crType.ToLower() + "aa.frm"); } if (file == null) { continue; } files.Add(file); } } this.BeginInvoke((MethodInvoker) delegate { frmLoading.SetNextFile(Path.GetFileName(DatPath)); frmLoading.SetResourceNum(files.Count); }); foreach (DATFile file in files) { this.BeginInvoke((MethodInvoker) delegate { frmLoading.SetNextResource(file.FileName); }); string ext = Path.GetExtension(file.FileName).ToLower(); if (!(ext == ".frm" || ext == ".png")) { continue; } byte[] data = file.GetData(); if (data == null) { WriteLog("Error opening " + file.FileName + ": " + file.ErrorMsg); continue; } if (ext == ".frm") { var frm = FalloutFRMLoader.LoadFRM(data, Transparency); frm.FileName = file.Path.ToLower(); Frms[frm.FileName] = frm; } else { System.ComponentModel.TypeConverter tc = System.ComponentModel.TypeDescriptor.GetConverter(typeof(Bitmap)); Bitmap bitmap = (Bitmap)tc.ConvertFrom(data); } } loadedDat.Close(); return(true); }
internal DATFile GetFile(string fileName) { return(dat.GetFileByName(fileName)); }