static void LoadResToMemory() { Stream stream = null; ArrayByte resStream = null; try { stream = XNAConfig.LoadStream(LSystem.FRAMEWORK_IMG_NAME + "font.zip"); resStream = new ArrayByte(new GZipInputStream(stream), ArrayByte.BIG_ENDIAN); realsize = resStream.ReadByte(); offy = resStream.ReadByte(); fontSpace = (realsize + offy) * 2; if (realsize > 0x10) { fontSpace *= 2; } int num = resStream.ReadInt(); int num2 = resStream.ReadByte(); byte[] bufferData = new byte[resStream.Available()]; resStream.Read(bufferData); fontData = bufferData; } catch (Exception) { fontData = null; } finally { if (stream != null) { stream.Dispose(); stream.Close(); stream = null; } if (resStream != null) { resStream = null; } } }
public static byte[] ReadFileFromPak(ArrayByte dis, int size, LPKTable fileTable) { dis.Skip(fileTable.GetOffSet() - size); int fileLength = (int) fileTable.GetFileSize(); byte[] fileBuff = new byte[fileLength]; int readLength = dis.Read(fileBuff, 0, fileLength); if (readLength < fileLength) { return null; } else { NativeSupport.MakeBuffer(fileBuff, readLength, 0xF7); return fileBuff; } }