void _read(FileStream stream) { _filePath = stream.Name; //System.Diagnostics.Debug.WriteLine("Creating " + FileName); if (Resource.GetType(stream, 0) == Resource.ResourceType.Rmap) { _rmp = new Rmap(stream); //System.Diagnostics.Debug.WriteLine("Rmap created"); _resources = new ResourceCollection(_rmp.NumberOfHeaders); for (int i = 0; i < _resources.Count; i++) { //System.Diagnostics.Debug.WriteLine("Create " + _rmp.SubHeaders[i].Type.ToString() + " " + _rmp.SubHeaders[i].Name + " (" + (i+1) + "/" + _rmp.NumberOfHeaders + ")"); _assignResource(i, _rmp.SubHeaders[i].Type, stream, _rmp.SubHeaders[i].Offset); } if (_resources.Count == 2 && _resources[0].Name.StartsWith("battle") && _resources[1].Name.EndsWith("gal")) { _lfdCategory = LfdCategory.Battle; } } else if (Resource.GetType(stream, 0) == Resource.ResourceType.Panl) { //System.Diagnostics.Debug.WriteLine("cockpit LFD"); _lfdCategory = LfdCategory.Cockpit; _resources = new ResourceCollection(3); _resources[0] = new Panl(stream, 0); _resources[1] = new Mask(stream, Resource.HeaderLength + _resources[0].Length); _resources[2] = new Pltt(stream, Resource.HeaderLength * 2 + _resources[0].Length + _resources[1].Length); } else { _resources = new ResourceCollection(1); _assignResource(0, Resource.GetType(stream, 0), stream, 0); //System.Diagnostics.Debug.WriteLine("Solo resource " + _resources[0].Type + " " + _resources[0].Name); } }
void _assignResource(int index, Resource.ResourceType type, FileStream stream, long offset) { // commented out types redirect to Resource to read and capture _rawData if (type == Resource.ResourceType.Anim) { _resources[index] = new Anim(stream, offset); } else if (type == Resource.ResourceType.Blas || type == Resource.ResourceType.Voic) { _resources[index] = new Blas(stream, offset); } //TODO: else if (type == Resource.ResourceType.Bmap) _resources[index] = new Bmap(stream, offset); //TODO: else if (type == Resource.ResourceType.Cust) _resources[index] = new Cust(stream, offset); else if (type == Resource.ResourceType.Delt) { _resources[index] = new Delt(stream, offset); } else if (type == Resource.ResourceType.Film) { _resources[index] = new Film(stream, offset); } else if (type == Resource.ResourceType.Font) { _resources[index] = new Font(stream, offset); } //TODO: else if (type == Resource.ResourceType.Gmid) _resources[index] = new Gmid(stream, offset); else if (type == Resource.ResourceType.Mask) { _resources[index] = new Mask(stream, offset); } //TODO: else if (type == Resource.ResourceType.Mtrx) _resources[index] = new Mtrx(stream, offset); else if (type == Resource.ResourceType.Panl) { _resources[index] = new Panl(stream, offset); } else if (type == Resource.ResourceType.Pltt) { _resources[index] = new Pltt(stream, offset); } // skip Rmap //TODO: else if (type == Resource.ResourceType.Ship) _resources[index] = new Ship(stream, offset); else if (type == Resource.ResourceType.Text) { _resources[index] = new Text(stream, offset); } else if (type == Resource.ResourceType.Xact) { _resources[index] = new Xact(stream, offset); } else { _resources[index] = new Resource(stream, offset); } }
/// <summary>Initializes the indexer</summary> /// <param name="parent">The parent resource</param> internal ImageIndexer(Panl parent) { _parent = parent; _items = _parent._images; }
void _read(FileStream stream) { _filePath = stream.Name; //System.Diagnostics.Debug.WriteLine("Creating " + FileName); if (Resource.GetType(stream, 0) == Resource.ResourceType.Rmap) { _rmp = new Rmap(stream); //System.Diagnostics.Debug.WriteLine("Rmap created"); _resources = new ResourceCollection(_rmp.NumberOfHeaders); for (int i = 0; i < _resources.Count; i++) { //System.Diagnostics.Debug.WriteLine("Create " + _rmp.SubHeaders[i].Type.ToString() + " " + _rmp.SubHeaders[i].Name + " (" + (i+1) + "/" + _rmp.NumberOfHeaders + ")"); _assignResource(i, _rmp.SubHeaders[i].Type, stream, _rmp.SubHeaders[i].Offset); } if (_resources.Count == 2 && _resources[0].Name.StartsWith("battle") && _resources[1].Name.EndsWith("gal")) _lfdCategory = LfdCategory.Battle; } else if (Resource.GetType(stream, 0) == Resource.ResourceType.Panl) { //System.Diagnostics.Debug.WriteLine("cockpit LFD"); _lfdCategory = LfdCategory.Cockpit; _resources = new ResourceCollection(3); _resources[0] = new Panl(stream, 0); _resources[1] = new Mask(stream, Resource.HeaderLength + _resources[0].Length); _resources[2] = new Pltt(stream, Resource.HeaderLength * 2 + _resources[0].Length + _resources[1].Length); } else { _resources = new ResourceCollection(1); _assignResource(0, Resource.GetType(stream, 0), stream, 0); //System.Diagnostics.Debug.WriteLine("Solo resource " + _resources[0].Type + " " + _resources[0].Name); } }
void _assignResource(int index, Resource.ResourceType type, FileStream stream, long offset) { // commented out types redirect to Resource to read and capture _rawData if (type == Resource.ResourceType.Anim) _resources[index] = new Anim(stream, offset); else if (type == Resource.ResourceType.Blas || type == Resource.ResourceType.Voic) _resources[index] = new Blas(stream, offset); //TODO: else if (type == Resource.ResourceType.Bmap) _resources[index] = new Bmap(stream, offset); //TODO: else if (type == Resource.ResourceType.Cust) _resources[index] = new Cust(stream, offset); else if (type == Resource.ResourceType.Delt) _resources[index] = new Delt(stream, offset); else if (type == Resource.ResourceType.Film) _resources[index] = new Film(stream, offset); else if (type == Resource.ResourceType.Font) _resources[index] = new Font(stream, offset); //TODO: else if (type == Resource.ResourceType.Gmid) _resources[index] = new Gmid(stream, offset); else if (type == Resource.ResourceType.Mask) _resources[index] = new Mask(stream, offset); //TODO: else if (type == Resource.ResourceType.Mtrx) _resources[index] = new Mtrx(stream, offset); else if (type == Resource.ResourceType.Panl) _resources[index] = new Panl(stream, offset); else if (type == Resource.ResourceType.Pltt) _resources[index] = new Pltt(stream, offset); // skip Rmap //TODO: else if (type == Resource.ResourceType.Ship) _resources[index] = new Ship(stream, offset); else if (type == Resource.ResourceType.Text) _resources[index] = new Text(stream, offset); else if (type == Resource.ResourceType.Xact) _resources[index] = new Xact(stream, offset); else _resources[index] = new Resource(stream, offset); }