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); } }
/// <summary>Creates an empty file with the appropriate file structure</summary> /// <param name="category">Preset type</param> /// <remarks><see cref="Rmap"/> and <see cref="Resources"/> are initialized accordingly.</remarks> public LfdFile(LfdCategory category) { _resources = new ResourceCollection(category); if (category == LfdCategory.Battle) { _rmp = new Rmap(category); } _lfdCategory = category; }
/// <summary>Creates an empty file with the appropriate file structure</summary> /// <param name="category">Preset type</param> /// <remarks><see cref="Rmap"/> and <see cref="Resources"/> are initialized accordingly.</remarks> public LfdFile(LfdCategory category) { _resources = new ResourceCollection(category); if (category == LfdCategory.Battle) _rmp = new Rmap(category); _lfdCategory = category; }
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); } }