/// <summary> /// Loads this model. /// </summary> /// <param name="el"></param> /// <param name="preLoad">true if model functions and local properties must be /// preloaded.</param> /// <returns>true if model is successfully loaded</returns> protected virtual bool Load(XmlElement el, bool preLoad) { ModelLoader modelLoader = new ModelLoader(this); XmlElement document = modelLoader.Open(el); ModelFunctions ModelFunctions = new ModelFunctions(); if (document == null) { return(false); } if (document.Name != el.Name) { log.Error(" Read model '" + document.Name + "' while expecting model '" + el.Name + "'"); return(false); } bool result = true; if (preLoad) { result = ModelFunctions.Load(document, FDMExec); } if (document != el) { el.MergeAttributes(document); if (preLoad) { // After reading interface properties in a file, read properties in the // local model element. This allows general-purpose models to be defined // in a file, with overrides or initial loaded constants supplied in the // relevant element of the aircraft configuration file. LocalProperties.Load(el, propertyManager, true); } foreach (var node in document.ChildNodes) { XmlElement element = node as XmlElement; if (element != null) { el.AppendChild(element); } } } return(result); }
public virtual string FindFullPathName(string path) { return(ModelLoader.CheckPathName(FDMExec.GetFullAircraftPath(), path)); }