protected override void OnAfter(IMethodInvocation input) { if (!_debug) { return; } try { var currentDateTime = DateTime.Now; var ts = currentDateTime.Subtract(_onBeforeDateTime); if (input.MethodBase.DeclaringType == null) { return; } Queue.Execute(() => { LoggerFactory.GetLogger("TimeConsuming").Info("接口:{0},方法:{1},参数:{2},耗时:{3}", input.MethodBase.DeclaringType.FullName, input.MethodBase.Name, JsonConvert.SerializeObject(input.Arguments), ts.TotalSeconds); return(true); }); } catch (Exception) { // ignored } }
public async Task Download() { if (options.ListClip || options.ListModule) { Utils.WriteRedText("--list cannot be used with --clip or --module"); } var course = await GetCourseAsync(options.CourseId, list : false); Utils.WriteYellowText($"Downloading from course'{course.Header.Title}' started ..."); if (options.DownloadClip) { var(clip, index, title) = course.GetClip(options.ClipId); GetClipAsync(clip, course.Header, index, title, list: false); } else if (options.DownloadModule) { var(module, index) = course.Modules.WithIndex() .FirstOrDefault(i => i.item.Id == options.ModuleId); GetModuleAsync(course.Header, module, index, list: false); } else { foreach (var(module, index) in course.Modules.WithIndex()) { GetModuleAsync(course.Header, module, index, options.ListCourse); } } Utils.WriteGreenText($"\tDownloading has started ..."); await queue.Execute(); Utils.WriteYellowText($"Download complete"); }
public void Execute(Action <T[]> complete) { _queue.Execute(complete); }
public static void Info() { var m = new StackFrame(1).GetMethod(); Bq.Execute(() => WriteLine(INFORMATION, "", m)); }