protected override void WriteTarget(BinaryWriter writer, DanceMotion target, IWritingSession session) { writer.WriteMoostaString(target.Name); writer.Write(target.BeatCount); writer.Write((target.SourceDanceModel == null) ? 0 : session.GetKey(target.SourceDanceModel)); writer.Write(target.Tags.Length); string[] tags = target.Tags; for (int i = 0; i < tags.Length; i++) { string str = tags[i]; writer.WriteMoostaString(str); } string[] boneNames = target.FirstPose.BoneNames; writer.Write(boneNames.Length); string[] array = boneNames; for (int j = 0; j < array.Length; j++) { string str2 = array[j]; writer.WriteMoostaString(str2); } string[] skinNames = target.FirstPose.SkinNames; writer.Write(skinNames.Length); string[] array2 = skinNames; for (int k = 0; k < array2.Length; k++) { string str3 = array2[k]; writer.WriteMoostaString(str3); } writer.Write(target.Poses.Length); DancePose[] poses = target.Poses; for (int l = 0; l < poses.Length; l++) { DancePose dancePose = poses[l]; writer.Write(dancePose.BodyPosition.X); writer.Write(dancePose.BodyPosition.Y); writer.Write(dancePose.BodyPosition.Z); writer.Write((int)dancePose.FootState); string[] array3 = boneNames; for (int m = 0; m < array3.Length; m++) { string boneName = array3[m]; CtQuaternion rotate = dancePose[boneName].Rotate; writer.Write(rotate.X); writer.Write(rotate.Y); writer.Write(rotate.Z); writer.Write(rotate.W); } string[] array4 = skinNames; for (int n = 0; n < array4.Length; n++) { string skinName = array4[n]; writer.Write(dancePose.GetSkinState(skinName).Weight); } } }
public void Execute(BinaryWriter writer, IWritingSession session) { using (writer.BeginMoostaBlock()) { try { writer.Write(this._serializer.TargetGuid.ToByteArray()); writer.Write(this._serializer.FormatVersion); writer.Write(session.GetKey(this._target)); this._serializer.Write(writer, this._target, session); } catch (Exception) { } } }
public static void WriteMoostaObject(this BinaryWriter writer, object obj, IWritingSession session) { using (writer.BeginMoostaBlock()) { ISerializer[] array; if (obj != null && Serialization._type2serializers.TryGetValue(obj.GetType(), out array)) { try { ISerializer serializer = array[array.Length - 1]; writer.Write(serializer.TargetGuid.ToByteArray()); writer.Write(serializer.FormatVersion); writer.Write(session.GetKey(obj)); serializer.Write(writer, obj, session); } catch (Exception) { } } } }