private void DemoCutThread(object arg) { var cuts = arg as CutLists; if (cuts == null) { _app.LogError("Invalid thread argument"); return; } _app.InitParseArg(); _app.ParseArg.ProgressCb = (progress, context) => {}; try { var progress = 0.0; var fileCount = cuts.FileCuts.Count; foreach (var fileCuts in cuts.FileCuts) { UDT_DLL.CutDemoByTimes(_app.GetMainThreadContext(), ref _app.ParseArg, fileCuts.FilePath, fileCuts.Cuts); progress += 1.0 / (double)fileCount; _app.SetProgressThreadSafe(100.0 * progress); } } catch (Exception exception) { _app.LogError("Caught an exception while cutting demos: {0}", exception.Message); } }