/// <summary> /// Parses the specified XML content and returns all prototypes which could be parsed. /// </summary> /// <param name="xmlContent">The xml content to use for parsing-</param> /// <param name="parameters">The parameters for the parser.</param> /// <param name="extend">The result to extend when parsing. Setting this will give the parser the ability to let data to be loaded now inherited from data loaded in extend.</param> /// <returns></returns> public void Parse(string xmlContent, string filename, PrototypeParseParameters parameters) { PrototypeCaches.LazyInit(); // Pre-parse data var data = new List <SerializedData>(); _PreParse(xmlContent, filename, ref parameters, data); _Parse(data, ref parameters); }
/// <summary> /// Same as <see cref="Parse(string, string)"/>, but can parse many xmls with relationships / dependencies in them together. /// This will make it possible to have a prototype in one file which is inherited from in another file. /// /// The prototypes will be loaded in order and able to resolve references across multiple files! /// </summary> public void Parse(string[] xmlContents, string[] filenames, PrototypeParseParameters parameters) { PrototypeCaches.LazyInit(); List <SerializedData> data = new List <SerializedData>(); if (xmlContents.Length != filenames.Length) { throw new ArgumentException("Xml content string count must match filename count in Prototypes.Parse()!"); } for (int i = 0; i < xmlContents.Length; i++) { _PreParse(xmlContents[i], filenames[i], ref parameters, data); } _Parse(data, ref parameters); }