public byte[] ToBytes() { List <byte> list = new List <byte>(); byte[] array = new byte[15]; BytesStringProc.SetString(array, Name, 0, 253); list.AddRange(array); list.AddRange(BitConverter.GetBytes(FrameIndex)); list.AddRange(BitConverter.GetBytes(Position.X)); list.AddRange(BitConverter.GetBytes(Position.Y)); list.AddRange(BitConverter.GetBytes(Position.Z)); list.AddRange(BitConverter.GetBytes(Rotate.X)); list.AddRange(BitConverter.GetBytes(Rotate.Y)); list.AddRange(BitConverter.GetBytes(Rotate.Z)); list.AddRange(BitConverter.GetBytes(Rotate.W)); byte[] array2 = new byte[IPL.ByteCount * 4]; byte[] array3 = IPL.ToBytes(); int num = array3.Length; for (int i = 0; i < num; i++) { array2[i * 4] = array3[i]; } if (PhysicsOff) { byte[] bytes = BitConverter.GetBytes((ushort)3939); array2[2] = bytes[0]; array2[3] = bytes[1]; } list.AddRange(array2); return(list.ToArray()); }
// Token: 0x0600035D RID: 861 RVA: 0x00018070 File Offset: 0x00016270 public byte[] ToBytes() { List <byte> list = new List <byte>(); byte[] array = new byte[15]; BytesStringProc.SetString(array, this.Name, 0, 253); list.AddRange(array); list.AddRange(BitConverter.GetBytes(this.FrameIndex)); list.AddRange(BitConverter.GetBytes(this.Position.x)); list.AddRange(BitConverter.GetBytes(this.Position.y)); list.AddRange(BitConverter.GetBytes(this.Position.z)); list.AddRange(BitConverter.GetBytes(this.Rotate.x)); list.AddRange(BitConverter.GetBytes(this.Rotate.y)); list.AddRange(BitConverter.GetBytes(this.Rotate.z)); list.AddRange(BitConverter.GetBytes(this.Rotate.w)); byte[] array2 = new byte[this.IPL.ByteCount * 4]; byte[] array3 = this.IPL.ToBytes(); int num = array3.Length; for (int i = 0; i < num; i++) { array2[i * 4] = array3[i]; } bool physicsOff = this.PhysicsOff; if (physicsOff) { byte[] bytes = BitConverter.GetBytes(3939); array2[2] = bytes[0]; array2[3] = bytes[1]; } list.AddRange(array2); return(list.ToArray()); }
public static void WriteString_v1(Stream s, string str) { byte[] array = BytesStringProc.StringToBuf_SJIS(str); byte[] bytes = BitConverter.GetBytes(array.Length); s.Write(bytes, 0, bytes.Length); if (array.Length != 0) { s.Write(array, 0, array.Length); } }
// Token: 0x06000356 RID: 854 RVA: 0x00017F24 File Offset: 0x00016124 public void FromBytes(byte[] bytes, int startIndex) { byte[] array = new byte[15]; Array.Copy(bytes, startIndex, array, 0, 15); this.Name = BytesStringProc.GetString(array, 0); int num = startIndex + 15; this.FrameIndex = BitConverter.ToInt32(bytes, num); num += 4; this.Value = BitConverter.ToSingle(bytes, num); }
// Token: 0x06000355 RID: 853 RVA: 0x00017EBC File Offset: 0x000160BC public byte[] ToBytes() { List <byte> list = new List <byte>(); byte[] array = new byte[15]; BytesStringProc.SetString(array, this.Name, 0, 253); list.AddRange(array); list.AddRange(BitConverter.GetBytes(this.FrameIndex)); list.AddRange(BitConverter.GetBytes(this.Value)); return(list.ToArray()); }
// Token: 0x06000322 RID: 802 RVA: 0x000167AC File Offset: 0x000149AC public byte[] ToBytes() { this.NormalizeList(Vmd.NormalizeDataType.All); List <byte> list = new List <byte>(); byte[] array = new byte[30]; BytesStringProc.SetString(array, this.VMDHeader, 0, 0); list.AddRange(array); byte[] array2 = new byte[this.ModelNameBytes]; BytesStringProc.SetString(array2, this.ModelName, 0, 253); list.AddRange(array2); int count = this.MotionList.Count; list.AddRange(BitConverter.GetBytes(count)); for (int i = 0; i < count; i++) { list.AddRange(this.MotionList[i].ToBytes()); } count = this.MorphList.Count; list.AddRange(BitConverter.GetBytes(count)); for (int j = 0; j < count; j++) { list.AddRange(this.MorphList[j].ToBytes()); } count = this.VisibleIKList.Count; list.AddRange(BitConverter.GetBytes(count)); for (int k = 0; k < count; k++) { list.AddRange(this.VisibleIKList[k].ToBytes()); } count = this.CameraList.Count; list.AddRange(BitConverter.GetBytes(count)); for (int l = 0; l < count; l++) { list.AddRange(this.CameraList[l].ToBytes()); } count = this.LightList.Count; list.AddRange(BitConverter.GetBytes(count)); for (int m = 0; m < count; m++) { list.AddRange(this.LightList[m].ToBytes()); } count = this.SelfShadowList.Count; list.AddRange(BitConverter.GetBytes(count)); for (int n = 0; n < count; n++) { list.AddRange(this.SelfShadowList[n].ToBytes()); } return(list.ToArray()); }
// Token: 0x06000371 RID: 881 RVA: 0x00018908 File Offset: 0x00016B08 public byte[] ToBytes() { List <byte> list = new List <byte>(); list.AddRange(BitConverter.GetBytes(this.FrameIndex)); list.Add(this.Visible ? 1 : 0); list.AddRange(BitConverter.GetBytes(this.IKList.Count)); for (int i = 0; i < this.IKList.Count; i++) { byte[] array = new byte[20]; BytesStringProc.SetString(array, this.IKList[i].IKName, 0, 253); list.AddRange(array); list.Add(this.IKList[i].Enable ? 1 : 0); } return(list.ToArray()); }
// Token: 0x06000233 RID: 563 RVA: 0x000126E0 File Offset: 0x000108E0 public static string ReadString_v1(Stream s) { string result = ""; byte[] array = new byte[4]; s.Read(array, 0, 4); int num = BitConverter.ToInt32(array, 0); bool flag = num > 0; if (flag) { array = new byte[num]; s.Read(array, 0, num); result = BytesStringProc.BufToString_SJIS(array); } return(result); }
// Token: 0x06000372 RID: 882 RVA: 0x000189CC File Offset: 0x00016BCC public void FromBytes(byte[] bytes, int startIndex) { this.FrameIndex = BitConverter.ToInt32(bytes, startIndex); int num = startIndex + 4; this.Visible = (bytes[num++] > 0); int num2 = BitConverter.ToInt32(bytes, num); num += 4; byte[] array = new byte[20]; for (int i = 0; i < num2; i++) { VmdVisibleIK.IK ik = new VmdVisibleIK.IK(); Array.Copy(bytes, num, array, 0, 20); ik.IKName = BytesStringProc.GetString(array, 0); num += 20; ik.Enable = (bytes[num++] > 0); this.IKList.Add(ik); } }
public void FromBytes(byte[] bytes, int startIndex) { int num = startIndex; FrameIndex = BitConverter.ToInt32(bytes, num); num += 4; Visible = (bytes[num++] != 0); int num2 = BitConverter.ToInt32(bytes, num); num += 4; byte[] array = new byte[20]; for (int i = 0; i < num2; i++) { IK iK = new IK(); Array.Copy(bytes, num, array, 0, 20); iK.IKName = BytesStringProc.GetString(array, 0); num += 20; iK.Enable = (bytes[num++] != 0); IKList.Add(iK); } }
public void FromBytes(byte[] bytes, int startIndex) { int num = startIndex; byte[] array = new byte[15]; Array.Copy(bytes, num, array, 0, 15); Name = BytesStringProc.GetString(array, 0); num += 15; FrameIndex = BitConverter.ToInt32(bytes, num); num += 4; Position.X = BitConverter.ToSingle(bytes, num); num += 4; Position.Y = BitConverter.ToSingle(bytes, num); num += 4; Position.Z = BitConverter.ToSingle(bytes, num); num += 4; Rotate.X = BitConverter.ToSingle(bytes, num); num += 4; Rotate.Y = BitConverter.ToSingle(bytes, num); num += 4; Rotate.Z = BitConverter.ToSingle(bytes, num); num += 4; Rotate.W = BitConverter.ToSingle(bytes, num); num += 4; int byteCount = IPL.ByteCount; byte[] array2 = new byte[byteCount * 4]; byte[] array3 = new byte[IPL.ByteCount]; Array.Copy(bytes, num, array2, 0, array2.Length); ushort num2 = BitConverter.ToUInt16(array2, 2); PhysicsOff = (num2 == 3939); for (int i = 0; i < byteCount; i++) { array3[i] = array2[i * 4]; } IPL.FromBytes(array3, 0); }
public static string ReadString_v1(Stream s) { string result = ""; byte[] array = new byte[4]; s.Read(array, 0, 4); int num = BitConverter.ToInt32(array, 0); if (num > 0) { array = new byte[num]; s.Read(array, 0, num); try { return(BytesStringProc.BufToString_SJIS(array)); } catch (Exception) { return(""); } } return(result); }
// Token: 0x0600035E RID: 862 RVA: 0x000181E0 File Offset: 0x000163E0 public void FromBytes(byte[] bytes, int startIndex) { byte[] array = new byte[15]; Array.Copy(bytes, startIndex, array, 0, 15); this.Name = BytesStringProc.GetString(array, 0); int num = startIndex + 15; this.FrameIndex = BitConverter.ToInt32(bytes, num); num += 4; this.Position.x = BitConverter.ToSingle(bytes, num); num += 4; this.Position.y = BitConverter.ToSingle(bytes, num); num += 4; this.Position.z = BitConverter.ToSingle(bytes, num); num += 4; this.Rotate.x = BitConverter.ToSingle(bytes, num); num += 4; this.Rotate.y = BitConverter.ToSingle(bytes, num); num += 4; this.Rotate.z = BitConverter.ToSingle(bytes, num); num += 4; this.Rotate.w = BitConverter.ToSingle(bytes, num); num += 4; int byteCount = this.IPL.ByteCount; byte[] array2 = new byte[byteCount * 4]; byte[] array3 = new byte[this.IPL.ByteCount]; Array.Copy(bytes, num, array2, 0, array2.Length); ushort num2 = BitConverter.ToUInt16(array2, 2); this.PhysicsOff = (num2 == 3939); for (int i = 0; i < byteCount; i++) { array3[i] = array2[i * 4]; } this.IPL.FromBytes(array3, 0); }
// Token: 0x06000323 RID: 803 RVA: 0x000169D8 File Offset: 0x00014BD8 public void FromBytes(byte[] bytes, int startIndex) { byte[] array = new byte[30]; Array.Copy(bytes, startIndex, array, 0, 30); this.VMDHeader = BytesStringProc.GetString(array, 0); bool flag = string.Compare(this.VMDHeader, "Vocaloid Motion Data file", true) == 0; int num; if (flag) { this.ModelNameBytes = 10; num = 1; this.m_ver = Vmd.VmdVersion.v1; } else { bool flag2 = string.Compare(this.VMDHeader, "Vocaloid Motion Data 0002", true) != 0; if (flag2) { throw new Exception("対応したVMDファイルではありません"); } this.ModelNameBytes = 20; num = 2; this.m_ver = Vmd.VmdVersion.v2; } int num2 = startIndex + 30; Array.Copy(bytes, num2, array, 0, this.ModelNameBytes); this.ModelName = BytesStringProc.GetString(array, 0); num2 += this.ModelNameBytes; int num3 = BitConverter.ToInt32(bytes, num2); num2 += 4; this.MotionList.Clear(); this.MotionList.Capacity = num3; for (int i = 0; i < num3; i++) { VmdMotion vmdMotion = new VmdMotion(); vmdMotion.FromBytes(bytes, num2); num2 += vmdMotion.ByteCount; this.MotionList.Add(vmdMotion); } bool flag3 = bytes.Length > num2; if (flag3) { num3 = BitConverter.ToInt32(bytes, num2); num2 += 4; this.MorphList.Clear(); this.MorphList.Capacity = num3; for (int j = 0; j < num3; j++) { VmdMorph vmdMorph = new VmdMorph(); vmdMorph.FromBytes(bytes, num2); num2 += vmdMorph.ByteCount; this.MorphList.Add(vmdMorph); } bool flag4 = bytes.Length > num2; if (flag4) { num3 = BitConverter.ToInt32(bytes, num2); num2 += 4; this.CameraList.Clear(); this.CameraList.Capacity = num3; bool flag5 = num == 1; if (flag5) { for (int k = 0; k < num3; k++) { VmdCamera_v1 vmdCamera_v = new VmdCamera_v1(); vmdCamera_v.FromBytes(bytes, num2); num2 += vmdCamera_v.ByteCount; this.CameraList.Add(vmdCamera_v.ToVmdCamera()); } } else { bool flag6 = num == 2; if (flag6) { for (int l = 0; l < num3; l++) { VmdCamera vmdCamera = new VmdCamera(); vmdCamera.FromBytes(bytes, num2); num2 += vmdCamera.ByteCount; this.CameraList.Add(vmdCamera); } } } bool flag7 = bytes.Length > num2; if (flag7) { num3 = BitConverter.ToInt32(bytes, num2); num2 += 4; this.LightList.Clear(); this.LightList.Capacity = num3; for (int m = 0; m < num3; m++) { VmdLight vmdLight = new VmdLight(); vmdLight.FromBytes(bytes, num2); num2 += vmdLight.ByteCount; this.LightList.Add(vmdLight); } bool flag8 = bytes.Length > num2; if (flag8) { num3 = BitConverter.ToInt32(bytes, num2); num2 += 4; this.SelfShadowList.Clear(); this.SelfShadowList.Capacity = num3; for (int n = 0; n < num3; n++) { VmdSelfShadow vmdSelfShadow = new VmdSelfShadow(); vmdSelfShadow.FromBytes(bytes, num2); num2 += vmdSelfShadow.ByteCount; this.SelfShadowList.Add(vmdSelfShadow); } bool flag9 = bytes.Length > num2; if (flag9) { num3 = BitConverter.ToInt32(bytes, num2); num2 += 4; this.VisibleIKList.Clear(); this.VisibleIKList.Capacity = num3; for (int num4 = 0; num4 < num3; num4++) { VmdVisibleIK vmdVisibleIK = new VmdVisibleIK(); vmdVisibleIK.FromBytes(bytes, num2); num2 += vmdVisibleIK.ByteCount; this.VisibleIKList.Add(vmdVisibleIK); } } } } } } }
public void FromBytes(byte[] bytes, int startIndex) { int num = startIndex; byte[] array = new byte[30]; Array.Copy(bytes, num, array, 0, 30); VMDHeader = BytesStringProc.GetString(array, 0); int num2 = 0; if (string.Compare(VMDHeader, "Vocaloid Motion Data file", ignoreCase: true) == 0) { ModelNameBytes = 10; num2 = 1; m_ver = VmdVersion.v1; } else { if (string.Compare(VMDHeader, "Vocaloid Motion Data 0002", ignoreCase: true) != 0) { throw new Exception("対応したVMDファイルではありません"); } ModelNameBytes = 20; num2 = 2; m_ver = VmdVersion.v2; } num += 30; _ = new byte[ModelNameBytes]; Array.Copy(bytes, num, array, 0, ModelNameBytes); ModelName = BytesStringProc.GetString(array, 0); num += ModelNameBytes; int num3 = BitConverter.ToInt32(bytes, num); num += 4; MotionList.Clear(); MotionList.Capacity = num3; for (int i = 0; i < num3; i++) { VmdMotion vmdMotion = new VmdMotion(); vmdMotion.FromBytes(bytes, num); num += vmdMotion.ByteCount; MotionList.Add(vmdMotion); } if (bytes.Length <= num) { return; } num3 = BitConverter.ToInt32(bytes, num); num += 4; MorphList.Clear(); MorphList.Capacity = num3; for (int j = 0; j < num3; j++) { VmdMorph vmdMorph = new VmdMorph(); vmdMorph.FromBytes(bytes, num); num += vmdMorph.ByteCount; MorphList.Add(vmdMorph); } if (bytes.Length <= num) { return; } num3 = BitConverter.ToInt32(bytes, num); num += 4; CameraList.Clear(); CameraList.Capacity = num3; switch (num2) { case 1: { for (int l = 0; l < num3; l++) { VmdCamera_v1 vmdCamera_v = new VmdCamera_v1(); vmdCamera_v.FromBytes(bytes, num); num += vmdCamera_v.ByteCount; CameraList.Add(vmdCamera_v.ToVmdCamera()); } break; } case 2: { for (int k = 0; k < num3; k++) { VmdCamera vmdCamera = new VmdCamera(); vmdCamera.FromBytes(bytes, num); num += vmdCamera.ByteCount; CameraList.Add(vmdCamera); } break; } } if (bytes.Length <= num) { return; } num3 = BitConverter.ToInt32(bytes, num); num += 4; LightList.Clear(); LightList.Capacity = num3; for (int m = 0; m < num3; m++) { VmdLight vmdLight = new VmdLight(); vmdLight.FromBytes(bytes, num); num += vmdLight.ByteCount; LightList.Add(vmdLight); } if (bytes.Length <= num) { return; } num3 = BitConverter.ToInt32(bytes, num); num += 4; SelfShadowList.Clear(); SelfShadowList.Capacity = num3; for (int n = 0; n < num3; n++) { VmdSelfShadow vmdSelfShadow = new VmdSelfShadow(); vmdSelfShadow.FromBytes(bytes, num); num += vmdSelfShadow.ByteCount; SelfShadowList.Add(vmdSelfShadow); } if (bytes.Length > num) { num3 = BitConverter.ToInt32(bytes, num); num += 4; VisibleIKList.Clear(); VisibleIKList.Capacity = num3; for (int num4 = 0; num4 < num3; num4++) { VmdVisibleIK vmdVisibleIK = new VmdVisibleIK(); vmdVisibleIK.FromBytes(bytes, num); num += vmdVisibleIK.ByteCount; VisibleIKList.Add(vmdVisibleIK); } } }