public void TestSetDefaultsTkAnimMetadata() { var header = new MBINHeader(); header.SetDefaults(typeof(NMS.Toolkit.TkAnimMetadata), MBINHeader.Format.V0); Assert.AreEqual(MBINHeader.MBIN_MAGIC, header.MagicID); Assert.AreEqual(MBINHeader.MBIN_VERSION, header.FormatID); Assert.AreEqual(MBINHeader.TKANIMMETADATA_TAG, header.Timestamp); Assert.AreEqual(TKANIMMETADATA_GUID, header.TemplateGUID); Assert.AreEqual("", header.TemplateName); Assert.AreEqual(MBINHeader.TKANIMMETADATA_PADDING, header.EndPadding); Assert.AreEqual(VERSION_STRING, header.GetMBINVersion().ToString()); }
public void TestSetDefaultsCommon() { var header = new MBINHeader(); header.SetDefaults(format: MBINHeader.Format.V0); Assert.AreEqual(MBINHeader.MBIN_MAGIC, header.MagicID); Assert.AreEqual(MBINHeader.MBIN_VERSION, header.FormatID); Assert.AreEqual(0ul, header.Timestamp); Assert.AreEqual(0ul, header.TemplateGUID); Assert.AreEqual("", header.TemplateName); Assert.AreEqual(0ul, header.EndPadding); Assert.AreEqual(VERSION_STRING, header.GetMBINVersion().ToString()); }
public void TestSetDefaultsCommon() { var header = new MBINHeader(); header.SetDefaults(format: MBINHeader.Format.V1); Assert.AreEqual(MBINHeader.MBIN_MAGIC, header.MagicID); Assert.AreEqual(MBINHeader.MBIN_VERSION, header.FormatID); Assert.AreEqual(MBINHeader.MBINCVER_TAG, header.Tag); Assert.AreEqual(VERSION_ID, header.MbinVersion); Assert.AreEqual("", header.TemplateName); Assert.AreEqual(END_PADDING, header.EndPadding); Assert.AreEqual(VERSION_STRING, header.GetMBINVersion().ToString()); }
public void TestSetDefaultsV0TkGeometry() { var header = new MBINHeader(); header.SetDefaultsV0(typeof(NMS.Toolkit.TkGeometryData)); Assert.AreEqual(MBINHeader.MBIN_MAGIC_PC, header.MagicID); Assert.AreEqual(MBINHeader.MBIN_VERSION, header.FormatID); Assert.AreEqual(MBINHeader.TKGEOMETRYDATA_TAG, header.Timestamp); Assert.AreEqual(TKGEOMETRYDATA_GUID, header.TemplateGUID); Assert.AreEqual("", header.TemplateName); Assert.AreEqual(MBINHeader.TKGEOMETRYDATA_PADDING, header.EndPadding); Assert.AreEqual(VERSION_STRING, header.GetMBINVersion().ToString()); }
public bool Load(bool getVersion = false) { _io.Stream.Position = 0; Header = (MBINHeader)NMSTemplate.DeserializeBinaryTemplate(_io.Reader, "MBINHeader"); if (getVersion) { string mbinVer = Header.GetMBINVersion(); Console.WriteLine(mbinVer.Substring(8)); } /*else * { * if (Header.Tag == 0x726576434E49424D) // check whether the file has been generated by MBINCompiler basically * { * string ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); * if (Header.Tag != String.Format("MBINCver{0}", ver.Substring(0, ver.Length - 2))) * { * Console.WriteLine("Incorrect version"); * return false; * } * } * }*/ return(true); }