public bool Load() { if (_io.Stream.Length < 0x60) { return(false); } _io.Stream.Position = 0; Header = (MBINHeader)NMSTemplate.DeserializeBinaryTemplate(_io.Reader, "MBINHeader"); return(true); }
public bool Load(bool getVersion = false) { _io.Stream.Position = 0; Header = (MBINHeader)NMSTemplate.DeserializeBinaryTemplate(_io.Reader, "MBINHeader"); if (getVersion) { string mbinVer = Header.Tag; Console.WriteLine(mbinVer.Substring(8)); } else { if (Header.Tag.Contains("MBIN")) // 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); }
//public bool Load(bool getVersion = false) public bool Load() { _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); }
public NMSTemplate GetData() { _io.Stream.Position = 0x60; return(NMSTemplate.DeserializeBinaryTemplate(_io.Reader, Header.GetXMLTemplateName())); }
public bool Load() { _io.Stream.Position = 0; Header = (MBINHeader)NMSTemplate.DeserializeBinaryTemplate(_io.Reader, "MBINHeader"); return(true); }