public static pyString Load(BinaryReader read, PyCodeObjectType type) { UInt32 length = 0; try { length = read.ReadUInt32(); } catch (EndOfStreamException) { return(null); } if (length < 0) { return(null); } pyString tmp_str = new pyString(type); if (length > 0) { try { tmp_str.raw_value = read.ReadBytes((int)length); } catch (EndOfStreamException) { return(null); } } return(tmp_str); }
private void write_code(BinaryWriter bw) { pyString _code = (pyString)code; bw.Write((byte)code.pyType); bw.Write((UInt32)_code.raw_value.Length); int f_pos = 0; while (f_pos < code.raw_value.Length) { byte b = remap_code(code.raw_value[f_pos++]); bw.Write(b); if (OpHasArgs(b)) { bw.Write(code.raw_value[f_pos++]); bw.Write(code.raw_value[f_pos++]); } } }