public override void Write(BinaryOutputStream s) { properties.WriteToStream(s); s.WriteInt32(elements.Count); s.WriteInt32(is_short ? 24 : 40); s.WriteSerializableArray(elements, (bs, i) => { }); }
public void Write(BinaryOutputStream s) { s.WriteInt32(chipID); s.WriteInt32(resourceID); s.WriteInt16(src_x); s.WriteInt16(src_y); s.WriteInt16(width); s.WriteInt16(height); s.WriteInt32(0); s.WriteInt32(0); s.WriteInt32(0); s.WriteInt32(0); s.WriteInt16(0); s.WriteInt16(collision_flag); s.WriteInt16(collision_x); s.WriteInt16(collision_y); s.WriteInt16(collision_w); s.WriteInt16(collision_h); s.WriteInt32(0); s.WriteInt32(0); }
public void Write(BinaryOutputStream s) { properties.WriteToStream(s); s.WriteObjectArray(keys); s.WriteInt32(0); code.Write(s); }
public static bool SaveActToFile(this ActObject obj, string filename) { try { using (FileStream f = File.Open(filename, FileMode.Create)) { using (BinaryWriter bw = new BinaryWriter(f)) { BinaryOutputStream bs = new BinaryOutputStream(bw); bs.WriteInt32(0x31544341); bs.WriteInt32(1); bs.WriteInt32(0); obj.Write(bs); } } return true; } catch { return false; } }
public void WriteToStream(BinaryOutputStream s, bool is_short_version = false) { if (!is_short_version) { s.WriteBool(true); } List<KeyValuePair<string, int>> name_list = new List<KeyValuePair<string, int>>(); List<Action> write_desc = new List<Action>(); List<Action> write_values = new List<Action>(); foreach (PropertyInfo pi in this.GetType().GetTypeInfo().GetProperties()) { string name = pi.Name; int type = GetTypeId(pi.PropertyType.GetTypeInfo()); int raw_type = type; var atts = pi.GetCustomAttributes(typeof(ExplicitTypeAttribute)); if (atts.Count() == 1) { type = ((ExplicitTypeAttribute) atts.First()).value; } name_list.Add(new KeyValuePair<string, int>(name, name_list.Count)); write_desc.Add(() => { s.WriteString(name); s.WriteInt32(type); }); write_values.Add(() => { type_handlers[raw_type].WriteField(this, pi, s); }); } name_list.Sort((a, b) => a.Key.CompareTo(b.Key)); s.WriteInt32(name_list.Count); foreach (var n in name_list) { write_desc[n.Value](); } foreach (var n in name_list) { write_values[n.Value](); } }
public void Write(BinaryOutputStream s) { s.WriteInt32(resourceID); s.WriteInt32(x); s.WriteInt32(y); s.WriteFloat(scale_x); s.WriteFloat(scale_y); s.WriteFloat(rotate); s.WriteInt32(aabb_x); s.WriteInt32(aabb_y); s.WriteInt32(aabb_w); s.WriteInt32(aabb_h); }