public static c00005b m0001c5(string p0) { int count = m000173(p0); Array.Clear(f00001d, 0, f00001d.Length); f000010 = -1; Stream stream = new MemoryStream(f000008, 0, count); if (!m0002c1(ref stream)) { throw new ArgumentException(string.Format("Argument Stream {0} does not contain a valid PNG file.", stream)); } List<struct01c6> list = new List<struct01c6>(); while (m0002bd(ref stream, ref list)) { } stream.Close(); struct01c7 structc = m0002be(ref list); struct01de structde = new struct01de(); return new c00005b((int) structc.f00001b, (int) structc.f00005f, m0002c3(m0002b9(m0002c0(list, structc, ref structde), structc), structc, structde)); }
private static byte[] m0002c0(List<struct01c6> p0, struct01c7 p1, ref struct01de p2) { int num = 0; using (List<struct01c6>.Enumerator enumerator = p0.GetEnumerator()) { Label_000B: if (!enumerator.MoveNext()) { goto Label_01D6; } struct01c6 current = enumerator.Current; enum01c5 enumc = current.f000001; if (enumc <= enum01c5.f000085) { if (enumc != enum01c5.f000001) { if (enumc == enum01c5.f000045) { goto Label_011A; } if (enumc == enum01c5.f000085) { goto Label_012C; } } goto Label_000B; } if (enumc != enum01c5.f000043) { if (enumc == enum01c5.f000044) { goto Label_00AF; } if (enumc == enum01c5.f000086) { goto Label_017C; } goto Label_000B; } throw new Exception(string.Format("List<Chunk> chunks still contains IHDR chunk info.", new object[0])); Label_00AF: if ((p1.f00001d == 0) || (p1.f00001d == 4)) { throw new Exception(string.Format("The given ColorType, {0}, does not support the use of a Palette.", p1.f00001d)); } p2.f000018 = new struct01df[(((int) 1) << (p1.f000008 + 1)) - 1]; m0002bf(current, ref p2); goto Label_000B; Label_011A: m0002c2(current, ref f000025, ref num); goto Label_000B; Label_012C: if (p0.IndexOf(current) != (p0.Count - 1)) { throw new Exception(string.Format("IEND chunk does not appear to be the last chunk in the image.", new object[0])); } MemoryStream stream = new MemoryStream(f000025, 0, num); c0000cf ccf = new c0000cf(stream); m000140(ref ccf); goto Label_000B; Label_017C: f000010 = ((int) current.f00001b) - 1; for (int i = 0; i < current.f00001b; i++) { f00001d[i] = (byte) current.f0001f4.ReadByte(); } goto Label_000B; } Label_01D6: return f000008; }
private static Color[] m0002c3(byte[] p0, struct01c7 p1, struct01de p2) { int num3; int num4; int num5; int num6; int num7; int num8; byte num9; int num10; int num12; int num13; int num14; int num = (int) (p1.f00001b * p1.f00005f); int index = 0; if (num > f000051.Length) { f000051 = new Color[num]; } MemoryStream stream = new MemoryStream(p0); switch (p1.f00001d) { case 0: if (p1.f000008 >= 8) { if (p1.f000008 != 8) { while (((num3 = stream.ReadByte()) > -1) && (index < num)) { num8 = 0; while (num8 < p1.f00001b) { num9 = (byte) stream.ReadByte(); stream.ReadByte(); f000051[index] = new Color(num9, num9, num9); index++; num8++; } } break; } while (((num3 = stream.ReadByte()) > -1) && (index < num)) { for (num8 = 0; num8 < p1.f00001b; num8++) { float num15 = stream.ReadByte(); num9 = (byte) ((num15 / ((float) ((((int) 1) << p1.f000008) - 1))) * 255f); f000051[index] = new Color(num9, num9, num9); index++; } } break; } num12 = 8 / p1.f000008; num13 = ((int) 0xff) >> (8 - p1.f000008); while (((num3 = stream.ReadByte()) > -1) && (index < num)) { num8 = 0; while (num8 < (((ulong) p1.f00001b) / ((long) num12))) { num10 = stream.ReadByte(); num14 = 8 - p1.f000008; while (num14 >= 0) { float num11 = (num10 & (num13 << (num14 & 0x1f))) >> num14; num9 = (byte) ((num11 / ((float) ((((int) 1) << p1.f000008) - 1))) * 255f); f000051[index] = new Color(num9, num9, num9); index++; num14 -= p1.f000008; } num8++; } } break; case 2: if (p1.f000008 <= 8) { while (((num3 = stream.ReadByte()) > -1) && (index < num)) { num8 = 0; while (num8 < p1.f00001b) { f000051[index] = new Color((byte) stream.ReadByte(), (byte) stream.ReadByte(), (byte) stream.ReadByte()); index++; num8++; } } break; } num4 = ((int) ((p1.f00001b * p1.f000008) * 3)) + 1; num5 = 0; num6 = 0; num7 = 0; while (((num3 = stream.ReadByte()) > -1) && (index < num)) { num8 = 0; while (num8 < p1.f00001b) { num5 = stream.ReadByte(); stream.ReadByte(); num6 = stream.ReadByte(); stream.ReadByte(); num7 = stream.ReadByte(); stream.ReadByte(); f000051[index] = new Color((byte) num5, (byte) num6, (byte) num7); index++; num8++; } } break; case 3: num12 = 8 / p1.f000008; num13 = ((int) 0xff) >> (8 - p1.f000008); while (((num3 = stream.ReadByte()) > -1) && (index < num)) { num8 = 0; while (num8 < (((ulong) p1.f00001b) / ((long) num12))) { num10 = stream.ReadByte(); for (num14 = 8 - p1.f000008; num14 >= 0; num14 -= p1.f000008) { int num16 = (num10 & (num13 << (num14 & 0x1f))) >> num14; struct01df structdf = p2.f000018[num16]; f000051[index] = new Color(structdf.f000008, structdf.f00001d, structdf.f000025); if (f000010 >= num16) { f000051[index].A = f00001d[num16]; } index++; } num8++; } } break; case 4: switch (p1.f000008) { case 8: while (((num3 = stream.ReadByte()) > -1) && (index < num)) { num8 = 0; while (num8 < p1.f00001b) { num9 = (byte) stream.ReadByte(); f000051[index] = new Color(num9, num9, num9, (byte) stream.ReadByte()); index++; num8++; } } break; case 0x10: while (((num3 = stream.ReadByte()) > -1) && (index < num)) { num8 = 0; while (num8 < p1.f00001b) { num9 = (byte) stream.ReadByte(); stream.ReadByte(); f000051[index] = new Color(num9, num9, num9, (byte) stream.ReadByte()); stream.ReadByte(); index++; num8++; } } break; } break; case 6: switch (p1.f000008) { case 8: while (((num3 = stream.ReadByte()) > -1) && (index < num)) { num8 = 0; while (num8 < p1.f00001b) { f000051[index] = new Color((byte) stream.ReadByte(), (byte) stream.ReadByte(), (byte) stream.ReadByte(), (byte) stream.ReadByte()); index++; num8++; } } break; case 0x10: { num4 = ((int) ((p1.f00001b * p1.f000008) * 3)) + 1; num5 = 0; num6 = 0; num7 = 0; int num17 = 0; while (((num3 = stream.ReadByte()) > -1) && (index < num)) { for (num8 = 0; num8 < p1.f00001b; num8++) { num5 = stream.ReadByte(); stream.ReadByte(); num6 = stream.ReadByte(); stream.ReadByte(); num7 = stream.ReadByte(); stream.ReadByte(); num17 = stream.ReadByte(); stream.ReadByte(); f000051[index] = new Color((byte) num5, (byte) num6, (byte) num7, (byte) num17); index++; } } break; } } break; } stream.Close(); return f000051; }
private static void m0002bf(struct01c6 p0, ref struct01de p1) { uint num = ((uint) p0.f0001f4.Length) / 3; if ((num * 3) == p0.f0001f4.Length) { for (int i = 0; i < num; i++) { struct01df structdf = new struct01df(); structdf.f000008 = (byte) p0.f0001f4.ReadByte(); structdf.f00001d = (byte) p0.f0001f4.ReadByte(); structdf.f000025 = (byte) p0.f0001f4.ReadByte(); p1.f000018[i] = structdf; } } }