public void GetPlanetMaps(string folder, MyModContext context, MyPlanetMapTypeSet mapsToUse, out MyCubemap[] maps) { int num; int num2; maps = new MyCubemap[4]; MyCubemapData <byte>[] dataArray = new MyCubemapData <byte> [0x18]; byte[][] streams = new byte[4][]; if (mapsToUse == 0) { goto TR_000A; } else { num = 0; } goto TR_0026; TR_000A: num2 = 0; while (num2 < 4) { if (dataArray[num2] != null) { MyCubemapData <byte>[] faces = new MyCubemapData <byte> [6]; int index = 0; while (true) { if (index >= 6) { maps[num2] = new MyCubemap(faces); break; } faces[index] = dataArray[num2 + (index * 4)]; index++; } } num2++; } return; TR_000D: num++; TR_0026: while (true) { if (num >= 6) { break; } string name = Path.Combine(folder, MyCubemapHelpers.GetNameForFace(num)); try { string str; Image image = this.TryGetPlanetTexture(name, context, "_mat", out str); if (image == null) { this.ClearMatValues(dataArray); break; } using (image) { PixelBuffer buffer = image.GetPixelBuffer(0, 0, 0); if ((buffer.Format != Format.B8G8R8A8_UNorm) && (buffer.Format != Format.R8G8B8A8_UNorm)) { object[] args = new object[] { buffer.Format, str }; MyLog.Default.Error("While loading maps from {1}: Unsupported planet map format: {0}.", args); break; } if (buffer.Width == buffer.Height) { if (mapsToUse.HasFlag(MyPlanetMapTypeSet.Material)) { dataArray[num * 4] = new MyCubemapData <byte>(buffer.Width, null); streams[0] = dataArray[num * 4].Data; } if (mapsToUse.HasFlag(MyPlanetMapTypeSet.Biome)) { dataArray[(num * 4) + 1] = new MyCubemapData <byte>(buffer.Width, null); streams[1] = dataArray[(num * 4) + 1].Data; } if (mapsToUse.HasFlag(MyPlanetMapTypeSet.Ore)) { dataArray[(num * 4) + 2] = new MyCubemapData <byte>(buffer.Width, null); streams[2] = dataArray[(num * 4) + 2].Data; } if (buffer.Format == Format.B8G8R8A8_UNorm) { streams[2] = streams[0]; streams[0] = streams[2]; } this.ReadChannelsFromImage(streams, buffer); image.Dispose(); goto TR_000D; } else { object[] args = new object[] { str }; MyLog.Default.Error("While loading maps from {0}: Width and height must be the same.", args); } break; } } catch (Exception exception) { MyLog.Default.Error(exception.ToString(), Array.Empty <object>()); break; } goto TR_000D; } goto TR_000A; }