public void CompileData(List <Substance> substances) { IntegerBank.Clear(); FloatBank.Clear(); CharBank.Clear(); foreach (Substance sub in substances) { sub.PrepareSubstance(substances); switch (sub) { case Substance <ObservableCollection <PrimitiveBinding <float> > > float_sub: float_sub.UpdateSubstanceDataForExport(float_sub.Data.Count, AddFloatData); break; case Substance <ObservableCollection <PrimitiveBinding <int> > > int_sub: int_sub.UpdateSubstanceDataForExport(int_sub.Data.Count, AddIntData); break; case Substance <ObservableCollection <BindingVector3> > vec_sub: vec_sub.UpdateSubstanceDataForExport(vec_sub.Data.Count, AddVec3Data); break; case Substance <PrimitiveBinding <string> > string_sub: if (!string_sub.Data.Value.EndsWith("\0")) { string_sub.Data.Value += '\0'; } string_sub.UpdateSubstanceDataForExport(string_sub.Data.Value.Length, AddStringData); break; } } }
public int AddIntData(ObservableCollection <PrimitiveBinding <int> > int_data) { int new_offset = IntegerBank.Count; for (int i = 0; i < int_data.Count; i++) { IntegerBank.Add(int_data[i].Value); } return(new_offset); }