public int AddStringData(PrimitiveBinding <string> string_data) { string dat = string_data.Value; int new_offset = CharBank.Count; // Formula: (x + (n-1)) & ~(n-1) int nextAligned = (dat.Length + 0x7) & ~0x7; int delta = nextAligned - dat.Length; CharBank.AddRange(Encoding.ASCII.GetChars(Encoding.ASCII.GetBytes(dat))); for (int i = 0; i < delta; i++) { CharBank.Add('\0'); } return(new_offset); }
public StringValueEditorViewModel() { Value = new PrimitiveBinding <string>(""); }