public static SpriteFont Read(string resName) { try { List<RectBox> xGlyphs = new List<RectBox>(), xCropping = new List<RectBox>(); List<Char> xChars = new List<Char>(); int xSpacingV; float xSpacingH; List<float[]> xKerning = new List<float[]>(); ArrayByte arrays = new ArrayByte(Resources.OpenResource(resName), ArrayByte.BIG_ENDIAN); int size = arrays.ReadInt(); LImage image = LImage.CreateImage(arrays.ReadByteArray(size)); int count = arrays.ReadInt(); while (count-- > 0) { xGlyphs.Add(new RectBox(arrays.ReadInt(), arrays.ReadInt(), arrays.ReadInt(), arrays.ReadInt())); xCropping.Add(new RectBox(arrays.ReadInt(), arrays.ReadInt(), arrays.ReadInt(), arrays.ReadInt())); xChars.Add((char)arrays.ReadInt()); } xSpacingV = arrays.ReadInt(); xSpacingH = arrays.ReadFloat(); count = arrays.ReadInt(); while (count-- > 0) { xKerning.Add(new float[] { arrays.ReadFloat(), arrays.ReadFloat(), arrays.ReadFloat() }); } arrays.Dispose(); return new SpriteFont(new LTexture(GLLoader.GetTextureData(image), Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR), xGlyphs, xCropping, xChars, xSpacingV, xSpacingH, xKerning, 'A'); } catch (Exception e) { Loon.Utils.Debugging.Log.Exception(e); } return null; }
public static LPKHeader ReadHeader(ArrayByte dis) { LPKHeader header = new LPKHeader(); header.SetPAKIdentity(dis.ReadInt()); byte[] pass = dis.ReadByteArray(LPKHeader.LF_PASSWORD_LENGTH); header.SetPassword(pass); header.SetVersion(dis.ReadFloat()); header.SetTables(dis.ReadLong()); return header; }