public void Bone() { var s = IwSerialise.Open("TestData\\managedobject_bone.bin", true, this.container.Resolve <ClassRegistry>(), null); CIwManaged obj = null; s.ManagedObject(ref obj); s.Close(); Assert.IsTrue(obj is CIwAnimBone); Assert.AreEqual(obj.Hash, "bonename".ToeHash()); }
public void Bool() { var s = IwSerialise.Open("TestData\\bool.bin", true, null, null); bool v = false; s.Bool(ref v); Assert.AreEqual(v, false); s.Bool(ref v); Assert.AreEqual(v, true); s.Close(); }
public void Int32() { var s = IwSerialise.Open("TestData\\int32.bin", true, null, null); int[] v = new int[16]; s.Int32(ref v[0]); Assert.AreEqual(v[0], int.MinValue); s.Int32(ref v[0]); Assert.AreEqual(v[0], int.MaxValue); s.Int32(ref v[0]); Assert.AreEqual(v[0], 0x01020304); s.Close(); }
/// <summary> /// Loads a resource group from a file. For more information on build mode and load mode, see @ ref resourceManagerModes "Resource Manager Modes". /// </summary> /// <param name="groupPath"> /// Pathname to GROUP text file to load. /// </param> /// <param name="allowNonExist"> /// True only if we wish to permit the non-existence of the GROUP file. Defaults to false. /// </param> /// <returns> /// </returns> public CIwResGroup LoadGroup(string groupPath, bool allowNonExist) { if (allowNonExist && !File.Exists(groupPath)) { return(null); } var gr = new CIwResGroup(this); string originalDir = Directory.GetCurrentDirectory(); try { var file = this.ResolveSourceOrBinaryFilePath(groupPath); Debug.WriteLine(string.Format("Loading {0}", file)); this.groups.Add(gr); // Directory.SetCurrentDirectory(Path.GetDirectoryName(file)); if (file.EndsWith(".bin", StringComparison.InvariantCultureIgnoreCase)) { using (var s = IwSerialise.Open(file, true, this.classRegistry, this)) { gr.Read(s); } } else { throw new NotImplementedException(); } } finally { Directory.SetCurrentDirectory(originalDir); } return(gr); }