public static bool ManualRemove(ManualRenameModel model) { bool ret = false; var di = new FileInfo(model.moveFile); var targetFolder = CreateNeededFolder(model.rootFolder, model.location); targetFolder = targetFolder.EndsWith("\\") ? targetFolder : targetFolder + "\\"; var av = new JavLibraryDAL().GetAvModelById(model.avDbId).Result; if (av != null) { var targetfile = GenerateTagetFileName(targetFolder, di.Extension, av, model); var res = FileUtility.RenameAndTransferUsingSystem(model.moveFile, targetfile, true, false); if (res == 0) { ret = true; } } return(ret); }
//读取从油猴脚本传过来的Cookie再结合上从本地Chrome读取到的HttpOnly的Cookie public async static Task <int> SaveJavLibraryCookie(string cookie, string userAgent) { List <CookieItem> items = new(); int res = 0; if (!string.IsNullOrEmpty(cookie)) { foreach (var item in cookie.Split(';')) { items.Add(new CookieItem() { Name = item.Split('=')[0].Trim(), Value = item.Split('=')[1].Trim(), }); } var httpOnlyCookie = CookieService.ReadChromeCookie(JavLibraryCookieDomain); if (httpOnlyCookie != null) { items.AddRange(httpOnlyCookie); } if (items != null && items.Count > 0) { var business = new JavLibraryDAL(); await business.DeleteJavLibraryCookie(); JavLibraryCookieJson entity = new() { CookieJson = JsonSerializer.Serialize(items), UserAgent = userAgent }; res = await business.InsertJavLibraryCookie(entity); } } return(res); }