public void convert(string name, ParameterParser args, Stream from, Stream to) { var obj = ActorExDescription.ReadNew(from); byte[] buffer = Encoding.Default.GetBytes(Utils.convertToJSON(obj)); to.Write(buffer, 0, buffer.Length); }
public void read() { MemoryStream stream = new MemoryStream(sampleData, false); ActorExDescription aed = ActorExDescription.ReadNew(stream); testInstance(aed); }
private void LoadActorNow(IResource resource) { if (resource.Equals(CurrentResource)) { return; } CurrentResource = null; using var contentStream = resource.OpenContent(); if (contentStream == null) { throw new IOException($"Could not open actor at {resource.Path.ToPOSIXString()}"); } description = ActorExDescription.ReadNew(contentStream); body = new Part(localDiContainer, description.body.model, description.body.animations); body.location.Parent = actorLocation; wings = null; if (description.HasWings) { wings = new Part(localDiContainer, description.wings.model, description.wings.animations); wings.location.Parent = body.skeleton.Bones[description.attachWingsToBone]; } controls.ResetView(); fbArea.IsDirty = true; CurrentResource = resource; }
public void write() { MemoryStream readStream = new MemoryStream(sampleData, false); ActorExDescription aed = ActorExDescription.ReadNew(readStream); MemoryStream writeStream = new MemoryStream(); aed.Write(writeStream); MemoryStream rereadStream = new MemoryStream(writeStream.ToArray(), false); ActorExDescription rereadAed = ActorExDescription.ReadNew(rereadStream); testInstance(rereadAed); }
private void testInstance(ActorExDescription aed) { Assert.NotNull(aed); Assert.AreEqual(1337, aed.headBoneID); Assert.AreEqual("hello.dff", aed.body.model); Assert.AreEqual("wings.dff", aed.wings.model); Assert.AreEqual(2, aed.body.animations.Length); Assert.AreEqual("first.ani", aed.body.animations[0].filename); Assert.AreEqual(AnimationType.Jump, aed.body.animations[0].type); Assert.AreEqual("second.ani", aed.body.animations[1].filename); Assert.AreEqual(AnimationType.Run, aed.body.animations[1].type); Assert.AreEqual(1, aed.wings.animations.Length); Assert.AreEqual("third.ani", aed.wings.animations[0].filename); Assert.AreEqual(AnimationType.RunForwardLeft, aed.wings.animations[0].type); }