public Task <List <Pdf> > GetPdfs(FileOrder order = FileOrder.NameAscending) { var pdfs = new List <Pdf>(); switch (order) { case FileOrder.NameAscending: pdfs = _context.Pdfs.OrderBy(pdf => pdf.Title).ToList(); break; case FileOrder.NameDescending: pdfs = _context.Pdfs.OrderByDescending(pdf => pdf.Title).ToList(); break; case FileOrder.SizeAscending: pdfs = _context.Pdfs.OrderBy(pdf => pdf.Size).ToList(); break; case FileOrder.SizeDescending: pdfs = _context.Pdfs.OrderByDescending(pdf => pdf.Size).ToList(); break; } return(Task.FromResult(pdfs)); }
private static void SwapRom(string[] args) { if (args.Length != 3) { return; } string inRom = args[0]; string outRom = args[1]; string swap = args[2]; if (!FileExists(inRom)) { return; } FileEncoding fileEncoding; switch (swap.ToLower()) { case "little16": fileEncoding = FileEncoding.LittleEndian16; break; case "little32": fileEncoding = FileEncoding.LittleEndian32; break; default: return; } using (FileStream fs = File.OpenRead(inRom)) { using (FileStream fw = File.Create(outRom)) { FileOrder.ToBigEndian32(fs, fw, fileEncoding); } } }
/// <summary> /// 获取指定文件夹的所有文件/文件夹,失败时返回null /// </summary> /// <param name="path">路径</param> /// <param name="order">排序依据</param> /// <param name="asc">排序顺序</param> /// <param name="page">页数</param> /// <param name="count">显示数量</param> /// <returns></returns> public ObjectMetadata[] GetFileList(string path, FileOrder order = FileOrder.name, bool asc = true, int page = 1, int count = 1000) { if (_enable_function_trace) { _trace.TraceInfo("BaiduPCS.GetFileList called: string path=" + path + ", FileOrder order=" + order + ", bool asc=" + asc + ", int page=" + page + ", int count=" + count); } ObjectMetadata[] ret = null; var set_event = new ManualResetEventSlim(); GetFileListAsync(path, (suc, data, s) => { ret = data; set_event.Set(); }, order, asc, page, count); set_event.Wait(); return(ret); }
public override List <WechatGroup> GetGroupsInOneFile(string filePath, FileOrder order) { var fileContent = File.ReadAllText(filePath).ReplaceNoNeedSymbols(); // </div><a class = 'subtitle4'.*?>(.*?)\\(\\d*\\) var tableMatches = Regex.Matches(fileContent, "<a class = 'subtitle4'.{0,100}<table(.{0,200}?)abbr=\"群账号\"(.*?)</table>"); var qqIndex = GetQQIndex(fileContent); var groupList = new List <WechatGroup>(); foreach (Match aMatch in tableMatches) { if (qqIndex > 0 && order == FileOrder.Last && fileContent.IndexOf(aMatch.Value) > qqIndex) { continue; } var memberMatches = Regex.Matches(aMatch.Value, @"<tr .*?>(.*?)</tr>"); var newGroup = new WechatGroup(); newGroup.Members = new List <WechatAccountInfo>(); foreach (Match aMembenMatch in memberMatches) { var aNewMember = new WechatAccountInfo(); var memberInfoMatch = Regex.Matches(aMembenMatch.Value, "<td>.*?</td>"); if (string.IsNullOrEmpty(newGroup.Account)) { newGroup.Account = Regex.Match(memberInfoMatch[1].Value, "<td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); } if (string.IsNullOrEmpty(newGroup.Name)) { newGroup.Name = Regex.Match(memberInfoMatch[2].Value, "<td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); } aNewMember.Account = Regex.Match(memberInfoMatch[3].Value, "<td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); aNewMember.Name = Regex.Match(memberInfoMatch[4].Value, "<td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); newGroup.Members.Add(aNewMember); } groupList.Add(newGroup); } return(groupList); }
public override List <WechatGroup> GetGroupsInOneFile(string filePath, FileOrder order) { var fileContent = File.ReadAllText(filePath).ReplaceNoNeedSymbols(); var tableMatches = Regex.Matches(fileContent, @"<table .{0,350}?成员(帐|账)号</td>.*?</table>((\s<div)|(<br>)|(\s</body>))"); var groupList = new List <WechatGroup>(); foreach (Match aMatch in tableMatches) { var newGroup = new WechatGroup(); newGroup.Members = new List <WechatAccountInfo>(); var memberMatches = Regex.Matches(aMatch.Value, @"<tr\S.*?>(.*?)</table></div></td></tr>"); foreach (Match aMembenMatch in memberMatches) { var aNewMember = new WechatAccountInfo(); newGroup.Account = Regex.Match(aMembenMatch.Value, @"</td><td>(.*?)</td><td .*?><div").Groups[1].Value; var memberInfoMatch = Regex.Matches(aMembenMatch.Value, @"<tr><td> .*?</td><td> (.*?)</td></tr>"); if (string.IsNullOrEmpty(newGroup.Name)) { newGroup.Name = memberInfoMatch[0].Groups[1].Value.FilterHtmlSpecialSymbols(); } aNewMember.Name = memberInfoMatch[1].Groups[1].Value.FilterHtmlSpecialSymbols(); aNewMember.Account = memberInfoMatch[2].Groups[1].Value.FilterHtmlSpecialSymbols(); aNewMember.Description = memberInfoMatch[3].Groups[1].Value.FilterHtmlSpecialSymbols(); aNewMember.Location = memberInfoMatch[4].Groups[1].Value.FilterHtmlSpecialSymbols(); // aNewMember.Account = memberInfoMatch[5].Groups[1].Value.FilterHtmlSpecialSymbols(); 头像 if (memberInfoMatch.Count > 6) { aNewMember.Inway = memberInfoMatch[6].Groups[1].Value.FilterHtmlSpecialSymbols(); } newGroup.Members.Add(aNewMember); } groupList.Add(newGroup); } return(groupList); }
protected void btnSaveOrder_Click(object sender, EventArgs e) { String NewFileDocName = ""; if (FileOrder.HasFile) { string typeFile = FileOrder.FileName.Split('.')[FileOrder.FileName.Split('.').Length - 1]; if (typeFile == "jpg" || typeFile == "jpeg" || typeFile == "png") { NewFileDocName = Session["CodePK"].ToString() + "_Order" + Quotations_id + new Random().Next(1000, 9999); NewFileDocName = "/Techno/Upload/Order/" + function.getMd5Hash(NewFileDocName) + "." + typeFile; FileOrder.SaveAs(Server.MapPath(NewFileDocName.ToString())); string sql = "INSERT INTO tbl_status_detail (detail_status_id,detail_claim_id,detail_date_start,detail_date_end) VALUES ('4','" + Session["codePK"].ToString() + "','" + txtDateOrder.Text.Trim() + "','" + function.ConvertDateTime(txtDateOrder.Text.Trim(), int.Parse(txtSendOrder.Text)) + "')"; if (function.MySqlQuery(sql)) { sql = "UPDATE tbl_claim SET claim_status = '4' WHERE claim_id = '" + Session["codePK"].ToString() + "'"; function.MySqlQuery(sql); sql = "UPDATE tbl_quotations SET quotations_order='1', quotations_order_img='" + NewFileDocName + "' WHERE quotations_claim_id = '" + Session["codePK"].ToString() + "' AND quotations_company_id = '" + txtCompanyOrder.SelectedValue + "'"; function.MySqlQuery(sql); } ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('บันทึกสำเร็จ')", true); Response.Redirect("/Techno/TechnoFormDetail"); } else { //AlertPop("Error : แนบรูปภาพล้มเหลว ไฟล์เอกสารต้องเป็น *.jpg *.jpge *.png เท่านั้น", "error"); ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Error : แนบรูปภาพล้มเหลว ไฟล์เอกสารต้องเป็น *.jpg *.jpge *.png เท่านั้น')", true); } } else { //AlertPop("Error : แนบรูปภาพล้มเหลวไม่พบไฟล์", "error"); ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Error : แนบรูปภาพล้มเหลวไม่พบไฟล์')", true); } }
private static void SwapRom(string[] args) { string inRom; string outRom; string swap; FileEncoding fileEncoding = FileEncoding.Error; if (args.Length != 3) { return; } inRom = args[0]; outRom = args[1]; swap = args[2]; if (!FileExists(inRom)) { return; } switch (swap.ToLower()) { case "little16": fileEncoding = FileEncoding.LittleEndian16; break; case "little32": fileEncoding = FileEncoding.LittleEndian32; break; //case "": default: return; } using (FileStream fs = new FileStream(inRom, FileMode.Open, FileAccess.Read)) { using (FileStream fw = new FileStream(outRom, FileMode.Create)) { FileOrder.ToBigEndian32(fs, fw, fileEncoding); } } }
public override List <WechatAccountInfo> GetFriendsInOneFile(string filePath, FileOrder order) { var wechatAccountInfoList = new List <WechatAccountInfo>(); var regexString = @"好友列表\(\d*\)</a></th></tr></table></div><table.*?</table>((\s<div)|(<br>))"; if (order == FileOrder.Normal) { regexString = @"<table.*?</table>(<br>|\s</body>)"; } else if (order == FileOrder.Last) { regexString = @"<table.*?</table>\s<div"; } var fileContent = File.ReadAllText(filePath).ReplaceNoNeedSymbols(); var friendContent = Regex.Match(fileContent, regexString).Value; // check if it is public account if (order == FileOrder.Last) { var paIndex = GetWechatPublicAccountIndex(fileContent); if (paIndex > 0 && fileContent.IndexOf(friendContent) >= paIndex) { return(wechatAccountInfoList); } } var friendMatches = Regex.Matches(friendContent, @"<tr\S.*?>(.*?)</table>"); foreach (Match aMatch in friendMatches) { var newWechatAccountInfo = new WechatAccountInfo(); newWechatAccountInfo.Id = Regex.Match(aMatch.Value, @"</td><td>(.*?)</td><td .*?><div").Groups[1].Value; var matches = Regex.Matches(Regex.Match(aMatch.Value, @"<table.*?>(.*?)</table>").Groups[1].Value, @"<tr><td> .*?</td><td> (.*?)</td></tr>"); if (matches.Count < 2) { continue; } newWechatAccountInfo.Account = matches[0].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.Name = matches[1].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.Mobile = matches[2].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.Sex = matches[3].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.Description = matches[4].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.Remark = matches[5].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.Location = matches[6].Groups[1].Value.FilterHtmlSpecialSymbols(); // newWechatAccountInfo. = matches[7].Groups[1].Value.FilterHtmlSpecialSymbols(); 头像 newWechatAccountInfo.BindQQ = matches[8].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.BindQQName = matches[9].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.Email = matches[10].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.BindQQDescription = matches[11].Groups[1].Value.FilterHtmlSpecialSymbols(); newWechatAccountInfo.BindQQTip = matches[12].Groups[1].Value.FilterHtmlSpecialSymbols(); wechatAccountInfoList.Add(newWechatAccountInfo); } return(wechatAccountInfoList); }
public abstract List <WechatGroup> GetGroupsInOneFile(string filePath, FileOrder order);
public abstract List <WechatAccountInfo> GetFriendsInOneFile(string filePath, FileOrder order);
public FileSort(FileOrder fileorder, FileAsc fileasc) { this._fileorder = fileorder; this._fileasc = fileasc; }
/// <summary> /// 构造函数 /// </summary> /// <param name="fileorder"></param> public FileSort(FileOrder fileorder) : this(fileorder, FileAsc.Asc) { }
public override List <WechatAccountInfo> GetFriendsInOneFile(string filePath, FileOrder order) { var regexString = @"好友统计\(\d*\)</a>[\s\S]*?<table[\s\S]*?>[\s\S]*?</table>"; if (order == FileOrder.Normal) { regexString = "<table.*?abbr=\"真实姓名\".*?</table>"; } else if (order == FileOrder.Last) { regexString = "<table.*?abbr=\"真实姓名\".*?</table>"; } var fileContent = File.ReadAllText(filePath).ReplaceNoNeedSymbols(); var friendContent = Regex.Match(fileContent, regexString).Value; var friendMatches = Regex.Matches(friendContent, @"<tr .*?>(.*?)</tr>"); var wechatAccountInfoList = new List <WechatAccountInfo>(); foreach (Match aMatch in friendMatches) { var newWechatAccountInfo = new WechatAccountInfo(); var matches = Regex.Matches(aMatch.Value, @"<td>.*?</td>"); if (matches.Count > 1) { newWechatAccountInfo.Id = Regex.Match(matches[1].Value, "<td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); } if (matches.Count > 2) { newWechatAccountInfo.Account = Regex.Match(matches[2].Value, "<td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); } if (matches.Count > 3) { newWechatAccountInfo.Name = Regex.Match(matches[3].Value, "<td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); } // newWechatAccountInfo.Name = Regex.Match(matches[4].Value, "<td>(.*) <br/></td>").Groups[1].Value; 真实姓名 if (matches.Count > 5) { newWechatAccountInfo.Mobile = Regex.Match(matches[5].Value, "<td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); } if (matches.Count > 6) { newWechatAccountInfo.Email = Regex.Match(matches[6].Value, "<td>(.*) <br/></td>").Groups[1].Value.FilterHtmlSpecialSymbols(); } if (matches.Count > 7) { newWechatAccountInfo.Count = Regex.Match(matches[7].Value, "<td>(.*) <br/></td>").Groups[1].Value; } wechatAccountInfoList.Add(newWechatAccountInfo); } return(wechatAccountInfoList); }
public async Task <ActionResult <IEnumerable <Pdf> > > GetPdfs([FromQuery] FileOrder order) { return(await _pdfService.GetPdfs(order)); }
/// <summary> /// 构造函数 /// </summary> /// <param name="fileorder"></param> /// <param name="fileasc"></param> public FileSort(FileOrder fileorder, FileAsc fileasc) { _fileorder = fileorder; _fileasc = fileasc; }
/// <summary> /// Requests that a JavaScript file be registered on the client browser /// </summary> /// <param name="page">The current page. Used to get a reference to the client resource loader.</param> /// <param name="filePath">The relative file path to the JavaScript resource.</param> /// <param name="priority">The relative priority in which the file should be loaded.</param> /// <param name="provider">The name of the provider responsible for rendering the script output.</param> public static void RegisterScript(Page page, string filePath, FileOrder.Js priority, string provider) { RegisterScript(page, filePath, (int) priority, provider); }
/// <summary> /// Requests that a CSS file be registered on the client browser. Defaults to rendering in the page header. /// </summary> /// <param name="page">The current page. Used to get a reference to the client resource loader.</param> /// <param name="filePath">The relative file path to the CSS resource.</param> /// <param name="priority">The relative priority in which the file should be loaded.</param> public static void RegisterStyleSheet(Page page, string filePath, FileOrder.Css priority) { RegisterStyleSheet(page, filePath, (int)priority, DefaultCssProvider); }
public FileSort(FileOrder fileorder) : this(fileorder, FileAsc.Asc) { }