public void Import(int position, TERF terf, MMAP custom) { Filetype user = new Filetype(terf, custom); if (position == -1) { this.DataFiles.Add(user); terf.Dir1.Import(terf, position, false, user.size); terf.Comp.Import(terf, position, false, user.size, 0); } changed = true; }
public void Read(DAT dat, TERF terf) { if (this.Data_id != dat.binreader.ReadUInt32()) { dat.binreader.BaseStream.Position -= 4; dat.errormsg = "Problem with DIR1 / COMP"; return; } this.datalength = dat.binreader.ReadUInt32(); dat.binreader.BaseStream.Position += (terf.GetPad(8)); // Advance through any needed padding #region Read Data files this.DataFiles = new List <Filetype>(); for (int c = 0; c < terf.files; c++) { bool compressed = false; int size = -1; size = (int)terf.Dir1.DirTable[c].filelength; // set size from dir info if (terf.Comp.length > 0) // If there is a comp table { if (terf.Comp.CompTable[c].file_complevel == 5) // If this file is compressed { compressed = true; } } Filetype ft = new Filetype(); // Set up new instance of data type ft.Read(dat, terf, compressed, size); // Read in this data file if (dat.errormsg != "") { return; } DataFiles.Add(ft); // Add to datafiles list if (size == 0) { ft.nullfile = true; } int pad = terf.GetPad(size); dat.binreader.BaseStream.Position += pad; // Skip through padding for this file } #endregion }