public byte[] GetRawData() { //init byte[] res = new byte[0]; //add the 4 unknown bytes... res = res.Concat(CGeneric.GiveMeArray(rawData, 0, 4)).ToArray(); //title scene length res = res.Concat(CGeneric.ConvertIntToByteArray(this.sceneName.Length)).ToArray(); //scene name res = res.Concat(sceneName).ToArray(); //size dynamicObject res = res.Concat(CGeneric.ConvertIntToByteArray(dynamicObjectList.Count)).ToArray(); //dynamic objectData foreach (CSBF1DynamicObject dynObj in dynamicObjectList) { res = res.Concat(dynObj.GetRawData()).ToArray(); } //size TextObject res = res.Concat(CGeneric.ConvertIntToByteArray(textObjectList.Count)).ToArray(); //TextObject foreach (CSBF1TextObject TexObj in textObjectList) { res = res.Concat(TexObj.GetRawData()).ToArray(); } //Size textureManagement res = res.Concat(CGeneric.ConvertIntToByteArray(textureManagementObjectList.Count)).ToArray(); //TextureManagement foreach (CSBF1TextureManagement texManObj in textureManagementObjectList) { res = res.Concat(texManObj.GetRawData()).ToArray(); } //dont renember why.. but needed byte[] test = new byte[] { 0x00, 0x00, 0x00, 0x00 }; res = res.Concat(test).ToArray(); return(res); }
public int GetSize() { // 24 = size of header and number of elements int totalSize = 24 + sceneName.Length; foreach (CSBF1DynamicObject dynObj in dynamicObjectList) { totalSize += dynObj.GetSize(); } foreach (CSBF1TextObject TexObj in textObjectList) { totalSize += TexObj.GetSize(); } foreach (CSBF1TextureManagement texObj in textureManagementObjectList) { totalSize += texObj.GetSize(); } return(totalSize); }