private void ProcessScriptData(FileEntry file, List <XMLTagLookup> lookup) { /*ScriptData script = new ScriptData(new BinaryReader(file.FileStream())); * if (script.Root is Dictionary<string, object>) * { * * }*/ Stream str = file.FileStream(); string xml = ScriptActions.GetConverter("scriptdata", "script_cxml").export(str, true); str = null; this.ProcessXML(file, lookup, xml); }
private void ProcessWorld(FileEntry file) { foreach (KeyValuePair <string, IChild> child in file.Parent.Children) { if (child.Value is FileEntry) { this.WriteFile(child.Value as FileEntry); } } this.WriteFile(file); this.ProcessScriptData(file, new List <XMLTagLookup> { new XMLTagLookup { node_name = "environment_values", value = new[] { "environment" }, Converter = (hash) => { return(hash + ".environment"); } } }); string continents_file = Path.Combine(Path.GetDirectoryName(file.Path), "continents").Replace("\\", "/"); Idstring ids = HashIndex.Get(continents_file); var t_ids = new Tuple <Idstring, Idstring, Idstring>(ids, new Idstring(0), HashIndex.Get("continents")); if (this._browser.RawFiles.ContainsKey(t_ids)) { FileEntry c_file = this._browser.RawFiles[t_ids]; this.WriteFile(c_file); string xml = ScriptActions.GetConverter("scriptdata", "script_cxml").export(c_file.FileStream(), true); XmlDocument doc = new XmlDocument(); try { doc.LoadXml(xml); foreach (XmlNode child in doc.ChildNodes[0]) { this.ProcessFile(Path.Combine(Path.GetDirectoryName(file.Path), string.Format("{0}/{0}.continent", child.Attributes.GetNamedItem("name").Value)).Replace("\\", "/")); } } catch (Exception exc) { this.error_output.Write("Exception occured on file: {0}\n", c_file.Path); if (xml != null) { this.error_output.Write(xml + "\n"); } this.error_output.Write(exc.Message + "\n"); this.error_output.Write(exc.StackTrace + "\n"); this.error_output.Flush(); return; } } else { this.error_output.Write("Continents file {0} does not exist!\n", continents_file); } string mission_file = Path.Combine(Path.GetDirectoryName(file.Path), "mission").Replace("\\", "/"); Idstring m_ids = HashIndex.Get(mission_file); var t_m_ids = new Tuple <Idstring, Idstring, Idstring>(m_ids, new Idstring(0), HashIndex.Get("mission")); if (this._browser.RawFiles.ContainsKey(t_m_ids)) { FileEntry m_file = this._browser.RawFiles[t_m_ids]; this.WriteFile(m_file); string xml = ScriptActions.GetConverter("scriptdata", "script_cxml").export(m_file.FileStream(), true); XmlDocument doc = new XmlDocument(); try { doc.LoadXml(xml); foreach (XmlNode child in doc.ChildNodes[0]) { this.ProcessFile(Path.Combine(Path.GetDirectoryName(file.Path), string.Format("{0}.mission", child.Attributes.GetNamedItem("file").Value)).Replace("\\", "/")); } } catch (Exception exc) { this.error_output.Write("Exception occured on file: {0}\n", m_file.Path); if (xml != null) { this.error_output.Write(xml + "\n"); } this.error_output.Write(exc.Message + "\n"); this.error_output.Write(exc.StackTrace + "\n"); this.error_output.Flush(); return; } } else { this.error_output.Write("Mission file {0} does not exist!\n", continents_file); } this.error_output.Flush(); }