public string ReadLine() { if (ins == null) { return(LSystem.EMPTY); } if (ins.Available() <= 0) { return(null); } StrBuilder sbr = new StrBuilder(); int c = -1; bool keepReading = true; do { c = ins.ReadByte(); switch (c) { case N: keepReading = false; break; case R: continue; case -1: return(null); default: sbr.Append((char)c); break; } if (ins.Available() <= 0) { keepReading = false; } } while (keepReading); return(sbr.ToString()); }
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; } } }