diff --git a/README.md b/README.md index 56fe331..d1ce4d0 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Now available on [NuGet](https://www.nuget.org/packages/Scallion) Execute the following command in the Package Manager Console: ``` -PM> Install-Package Scallion -Pre +PM> Install-Package Scallion ``` Or download an archive from [Releases](https://github.com/paralleltree/Scallion/releases). diff --git a/Scallion.Tests/Properties/AssemblyInfo.cs b/Scallion.Tests/Properties/AssemblyInfo.cs index 8f5b1b1..83615a8 100644 --- a/Scallion.Tests/Properties/AssemblyInfo.cs +++ b/Scallion.Tests/Properties/AssemblyInfo.cs @@ -11,4 +11,4 @@ [assembly: ComVisible(false)] [assembly: Guid("2b69216b-f367-46a9-8d9b-56b16771019c")] -[assembly: AssemblyVersion("0.9.0.1")] +[assembly: AssemblyVersion("0.9.1.0")] diff --git a/Scallion.Tests/Scallion.Tests.csproj b/Scallion.Tests/Scallion.Tests.csproj index ab4b983..e2c2081 100644 --- a/Scallion.Tests/Scallion.Tests.csproj +++ b/Scallion.Tests/Scallion.Tests.csproj @@ -63,6 +63,7 @@ + diff --git a/Scallion.Tests/UnitTests/Core/MoSerializerTest.cs b/Scallion.Tests/UnitTests/Core/MoSerializerTest.cs new file mode 100644 index 0000000..6cdf40f --- /dev/null +++ b/Scallion.Tests/UnitTests/Core/MoSerializerTest.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using NUnit.Framework; +using Scallion.DomainModels; +using Scallion.DomainModels.Components; + +namespace Scallion.Tests.UnitTests.Core +{ + [TestFixture] + internal class MoSerializerTest + { + [Test] + public void WriteLongStringTest() + { + Assert.DoesNotThrow(() => + { + var m = new Motion() + { + ModelName = "テストモデル" + }; + + // Add a bone whose name length is longer than the maximum. + m.Bones.Add(new Bone() + { + Name = "テストモデルのテストボーン", + KeyFrames = new List() { new BoneKeyFrame() } + }); + + // Then, try to save it. + m.Save("out.vmd"); + }, "An error occurred while saving a Motion."); + } + } +} diff --git a/Scallion/Core/MoSerializer.cs b/Scallion/Core/MoSerializer.cs index f7b9fe3..3aab1f6 100644 --- a/Scallion/Core/MoSerializer.cs +++ b/Scallion/Core/MoSerializer.cs @@ -80,7 +80,8 @@ public void WriteByte(byte value) public void WriteByteString(string value, int bytesCount) { var data = new byte[bytesCount]; - FileEncoding.GetBytes(value).CopyTo(data, 0); + var arr = FileEncoding.GetBytes(value); + Array.Copy(arr, data, Math.Min(bytesCount, arr.Length)); _stream.Write(data); } diff --git a/Scallion/DomainModels/Motion.cs b/Scallion/DomainModels/Motion.cs index 8244fc6..3c0cbcc 100644 --- a/Scallion/DomainModels/Motion.cs +++ b/Scallion/DomainModels/Motion.cs @@ -62,6 +62,11 @@ public IEnumerable IKBones /// public Motion() { + Bones = new List(); + Morphs = new List(); + Camera = new Camera(); + Light = new Light(); + SelfShadow = new SelfShadow(); VisibilityKeyFrames = new List(); } diff --git a/Scallion/Properties/AssemblyInfo.cs b/Scallion/Properties/AssemblyInfo.cs index bc6433a..27960b9 100644 --- a/Scallion/Properties/AssemblyInfo.cs +++ b/Scallion/Properties/AssemblyInfo.cs @@ -11,8 +11,8 @@ [assembly: ComVisible(false)] [assembly: Guid("3934e015-89f5-4214-80df-71b57f62c2cd")] -[assembly: AssemblyVersion("0.9.0.1")] -[assembly: AssemblyInformationalVersion("0.9.0")] +[assembly: AssemblyVersion("0.9.1.0")] +[assembly: AssemblyInformationalVersion("0.9.1")] // Exposes internal components to the testing project. [assembly: InternalsVisibleTo("Scallion.Tests")]