public void StopRunningScript(string scriptId, string runId, bool resetState, Action onComplete) { var key = GetScriptRunId(scriptId, runId); ScriptProcessor proc = null; if (m_runningProcessors.TryGetValue(key, out proc)) { proc.StopRunning(() => { m_runningProcessors.Remove(key); if (resetState) { DeleteScriptFolder(scriptId, runId); } if (onComplete != null) { onComplete(); } }); } else { if (resetState) { DeleteScriptFolder(scriptId, runId); } if (onComplete != null) { onComplete(); } } }