/// <summary> /// Stops API. /// </summary> public static void stopApi() { if (needStopAPI) { MetaEditAPI.MENull menull = new MetaEditAPI.MENull(); Port.stopAPI(menull); needStopAPI = false; } }
/// <summary> /// Runs the named generator /// </summary> /// <param name="port">Connection to MetaEdit+ API server.</param> /// <param name="generator">Name of the generator</param> /// <returns>Was the generation successful (unknown=true, e.g. for 4.5)</returns> public bool RunGenerator(MetaEditAPI.MetaEditAPI port, String generator) { bool success = true; MEAPI.AllowSetForegroundWindow(); try { if (Settings.GetSettings().Version.IsEqualOrGreaterThan("5.0")) { success = port.forGraphRun(this.ToMEOop(), generator); } else { MetaEditAPI.MENull meNull = new MetaEditAPI.MENull(); port.forName(meNull, this.Name, this.TypeName, generator); } } catch (Exception e) { DialogProvider.ShowMessageDialog("API error: " + e.Message, "API error"); success = false; } return(success); }