From b3bdc9ee1a9c17e7c6bd4eb26ebd2e8f368d5fe5 Mon Sep 17 00:00:00 2001 From: Paralleltree Date: Sun, 10 Apr 2016 17:48:58 +0900 Subject: [PATCH 1/6] Fix the installation command in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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). From 9ebb10dae05a5428422e35cc9d813203465b8872 Mon Sep 17 00:00:00 2001 From: Paralleltree Date: Sun, 5 Jun 2016 19:07:13 +0900 Subject: [PATCH 2/6] Add initialization for collections in the constructor --- Scallion/DomainModels/Motion.cs | 5 +++++ 1 file changed, 5 insertions(+) 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(); } From 9f780f1d5cb17afc87ea8a54a79ce2db073deffc Mon Sep 17 00:00:00 2001 From: Paralleltree Date: Sun, 5 Jun 2016 18:21:43 +0900 Subject: [PATCH 3/6] Use Array.Copy instead of Array.CopyTo --- Scallion/Core/MoSerializer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } From f2db65f734ba28df7db7e54ffdd2e9cddd4789f8 Mon Sep 17 00:00:00 2001 From: Paralleltree Date: Sun, 5 Jun 2016 19:31:08 +0900 Subject: [PATCH 4/6] Add a test for saving long string --- Scallion.Tests/Scallion.Tests.csproj | 1 + .../UnitTests/Core/MoDeserializerTest.cs | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Scallion.Tests/UnitTests/Core/MoDeserializerTest.cs diff --git a/Scallion.Tests/Scallion.Tests.csproj b/Scallion.Tests/Scallion.Tests.csproj index ab4b983..80de35e 100644 --- a/Scallion.Tests/Scallion.Tests.csproj +++ b/Scallion.Tests/Scallion.Tests.csproj @@ -63,6 +63,7 @@ + diff --git a/Scallion.Tests/UnitTests/Core/MoDeserializerTest.cs b/Scallion.Tests/UnitTests/Core/MoDeserializerTest.cs new file mode 100644 index 0000000..6163a3c --- /dev/null +++ b/Scallion.Tests/UnitTests/Core/MoDeserializerTest.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 MoDeserializerTest + { + [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."); + } + } +} From 9cfab96d2309896fe77eb7b1e4393b095d859c30 Mon Sep 17 00:00:00 2001 From: Paralleltree Date: Sun, 5 Jun 2016 19:51:15 +0900 Subject: [PATCH 5/6] Rename MoDeserializerTest to MoSerializerTest just a careless mistake :( --- Scallion.Tests/Scallion.Tests.csproj | 2 +- .../Core/{MoDeserializerTest.cs => MoSerializerTest.cs} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Scallion.Tests/UnitTests/Core/{MoDeserializerTest.cs => MoSerializerTest.cs} (96%) diff --git a/Scallion.Tests/Scallion.Tests.csproj b/Scallion.Tests/Scallion.Tests.csproj index 80de35e..e2c2081 100644 --- a/Scallion.Tests/Scallion.Tests.csproj +++ b/Scallion.Tests/Scallion.Tests.csproj @@ -63,7 +63,7 @@ - + diff --git a/Scallion.Tests/UnitTests/Core/MoDeserializerTest.cs b/Scallion.Tests/UnitTests/Core/MoSerializerTest.cs similarity index 96% rename from Scallion.Tests/UnitTests/Core/MoDeserializerTest.cs rename to Scallion.Tests/UnitTests/Core/MoSerializerTest.cs index 6163a3c..6cdf40f 100644 --- a/Scallion.Tests/UnitTests/Core/MoDeserializerTest.cs +++ b/Scallion.Tests/UnitTests/Core/MoSerializerTest.cs @@ -9,7 +9,7 @@ namespace Scallion.Tests.UnitTests.Core { [TestFixture] - internal class MoDeserializerTest + internal class MoSerializerTest { [Test] public void WriteLongStringTest() From 3f512f993d9151ff61c735e86c2c8f31c9ebf467 Mon Sep 17 00:00:00 2001 From: Paralleltree Date: Sun, 5 Jun 2016 20:33:21 +0900 Subject: [PATCH 6/6] Bump version to 0.9.1 --- Scallion.Tests/Properties/AssemblyInfo.cs | 2 +- Scallion/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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/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")]