public byte[] ToArray() { MemoryStream buffer = new MemoryStream(); buffer.WriteValueU32(firstVal); buffer.WriteValueS32(pccRef.findName("None")); buffer.Seek(16, SeekOrigin.Begin); buffer.WriteValueU32(otherVal); buffer.WriteValueS32(enumTextureGroups.Count); foreach (ByteProp byteProp in enumTextureGroups) { buffer.WriteValueS32(pccRef.FindNameOrAdd(byteProp.name)); buffer.WriteValueS32(byteProp.value); } return(buffer.ToArray()); }
int WriteStrProperty(MemoryStream m, string name, string text) { if (text != "" && text[text.Length - 1] != 0) { text += '\0'; } int sizetext = text.Length * 2 + 4; int NAME_name = pcc.findName(name); int NAME_StrProperty = pcc.findName("StrProperty"); m.Write(BitConverter.GetBytes(NAME_name), 0, 4); m.Write(BitConverter.GetBytes(0), 0, 4); m.Write(BitConverter.GetBytes(NAME_StrProperty), 0, 4); m.Write(BitConverter.GetBytes(0), 0, 4); m.Write(BitConverter.GetBytes(sizetext), 0, 4); m.Write(BitConverter.GetBytes(0), 0, 4); m.Write(BitConverter.GetBytes(-text.Length), 0, 4); foreach (char c in text) { m.Write(BitConverter.GetBytes((Int16)c), 0, 2); } return(24 + sizetext); }