private void ButtonGenerate_eventClicked(UIComponent component, UIMouseEventParameter eventParam) { try { RoadManager.ClearRoadTypes(); OSMExportNew osmExporter = new OSMExportNew(); osmExporter.Export(); buttonGenerate.text = "Generate OSM map"; } catch (Exception ex) { UnityEngine.Debug.LogException(ex); buttonGenerate.text = "Export failed!"; } try { string _osmName = Singleton <SimulationManager> .instance.m_metaData.m_CityName + ".osm"; string _fullOSMPath = Path.GetFullPath(_osmName); string _modPath = CimTools.CimToolsHandler.CimToolBase.Path.GetModPath(); if (_modPath != null && _modPath != "" && _fullOSMPath != null && _fullOSMPath != "") { string _mscriptPath = _modPath + Path.DirectorySeparatorChar + "MaperitiveScript.mscript"; string _mrulesPath = _modPath + Path.DirectorySeparatorChar + "Cimtographer.mrules"; string _zippedMaperitivePath = _modPath + Path.DirectorySeparatorChar + "Maperitive"; string _citiesPath = Path.GetDirectoryName(_fullOSMPath); string _extractedMaperitivePath = _citiesPath + Path.DirectorySeparatorChar + "Maperitive"; string _mscript = string.Format( "use-ruleset location=\"{0}\"" + "\r\napply-ruleset" + "\r\nload-source \"{1}\"" , _mrulesPath, _fullOSMPath); File.Delete(_mscriptPath); StreamWriter _writer = File.CreateText(_mscriptPath); _writer.Write(_mscript); _writer.Flush(); _writer.Close(); if (_extractedMaperitivePath != null && _extractedMaperitivePath != "" && GzipExtractor.RemoveAllChangedNames(_zippedMaperitivePath, _extractedMaperitivePath, ".mapper")) { Process _maperitiveProcess = Process.Start(new ProcessStartInfo( _extractedMaperitivePath + Path.DirectorySeparatorChar + "Maperitive", "\"" + _mscriptPath + "\"") { UseShellExecute = false }); if (_maperitiveProcess != null) { UIView.library.ShowModal("PauseMenu"); } } else { UnityEngine.Debug.Log("Couldn't decrypt the gzipped files from " + _zippedMaperitivePath + " to " + _extractedMaperitivePath); } } else { UnityEngine.Debug.Log("Could not find OSM at " + _fullOSMPath + " or mod path at " + _modPath); } } catch (Exception ex) { UnityEngine.Debug.LogException(ex); } }