} /* Checkout() */ public void Commit() { // commit data from type reflection foreach (System.Reflection.FieldInfo field in this.Implementation.GetType().GetFields()) { string fieldID = "m_"; char[] propID = field.Name.Substring(field.Name.IndexOf(fieldID) + fieldID.Length).ToCharArray(); propID[0] = char.ToUpper(propID[0]); object boxedObject = this.Implementation; field.SetValue(boxedObject, this.m_properties[new string(propID)].Data); this.Implementation = (datamodel.ApollonRecordFileImpl)boxedObject; } /* foreach() */ } /* Commit() */
static public ApollonRecordFileFacade Load(string filename) { try { datamodel.ApollonRecordFileImpl impl = new datamodel.ApollonRecordFileImpl(); System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(impl.GetType()); System.IO.StreamReader reader = new System.IO.StreamReader(filename); impl = (datamodel.ApollonRecordFileImpl)serializer.Deserialize(reader); ApollonRecordFileFacade facade = new ApollonRecordFileFacade(impl); facade.Checkout(); reader.Close(); return(facade); } catch (System.Exception ex) { UnityEngine.Debug.LogError("<color=red>Error: </color> ApollonRecordFileController::Load(" + filename + ") [" + ex.Message + "]"); return(null); } } /* Load() */
// Ctor public ApollonRecordFileFacade(datamodel.ApollonRecordFileImpl impl) { // the only one assignement this.Implementation = impl; } /* Ctor */