static void SetMark(object u, object mod) { TextBlock tb = u as TextBlock; DataMod dm = mod as DataMod; int c = dm.marktag; if (c < 1) { tb.Text = null; tb.Background.A = 0; return; } tb.Text = Mark[c]; tb.Background = new DX.Color(163, 95, 68, 200); }
public static int Search_ex(char[] buff, List <DX.BindingMod> lia) { int s = 0; string detail; int i; for (i = 0; i < 15; i++) { DataMod im = new DataMod(); s = FindCharArray(ref buff, ref Key_idA, s); if (s < 0) { break; } detail = ""; s = FindCharArray(ref buff, ref Key_posterPic, s); im.src = new string(FindCharArrayA(ref buff, '\"', '\"', ref s)); detail += "播放量:" + new string(FindCharArrayA(ref buff, ':', ',', ref s)); s = FindCharArray(ref buff, ref Key_duration, s); detail += "\r\n时长:" + new string(FindCharArrayA(ref buff, ':', ',', ref s)); s = FindCharArray(ref buff, ref Key_titleA, s); s++; char[] t = FindCharArrayA(ref buff, '\"', '\"', ref s); im.Title = GetString16A(ref t); s = FindCharArray(ref buff, ref Key_videoCategory, s); s++; detail += "S\r\n分类:" + new string(FindCharArrayA(ref buff, '\"', '\"', ref s)); s = FindCharArray(ref buff, ':', s); t = FindCharArrayA(ref buff, '\"', '\"', ref s); if (t != null) { detail += "\r\n区域:" + GetString16A(ref t); } s = FindCharArray(ref buff, ':', s); detail += "\r\n" + new string(FindCharArrayA(ref buff, '\"', '\"', ref s)); s = FindCharArray(ref buff, ref Key_webPlayUrl, s); s++; im.href = new string(FindCharArrayA(ref buff, '\"', '\"', ref s)); s = FindCharArray(ref buff, ref Key_publishDate, s); s++; detail += "\r\n" + new string(FindCharArrayA(ref buff, '\"', '\"', ref s)); im.Detail = detail; lia.Add(im); } return(i); }
static void ReSizeItemMod(int type) { float w = margin.Right - margin.Left; float iw = (w - 4) / 140; int t = (int)iw; iw = (w - 4) / t; sp.ItemWidth = (int)iw; iw *= 1.5f; sp.ItemHeight = (int)iw; if (type == 0) { DataMod.ReSize(sp.ItemTemplate, new Size2F(sp.ItemWidth, sp.ItemHeight)); } else { DataMod.ReSize_S(sp.ItemTemplate, new Size2F(sp.ItemWidth, sp.ItemHeight)); } }
static DataMod GetItemDataA(ref char[] c_buff, int s, int e) { DataMod im = new DataMod(); s = FindCharArray(ref c_buff, ref Key_href, s); string str = new string(FindCharArrayA(ref c_buff, '\"', '\"', ref s)); im.href = str; s = FindCharArray(ref c_buff, ref Key_lazyload, s); char[] t = FindCharArrayA(ref c_buff, '\"', '\"', ref s); if (FindCharArray(ref t, ref Key_http, 0) > -1) { im.src = new string(t); } else { im.src = "http:" + new string(t); } s = FindCharArray(ref c_buff, ref Key_alt, s); im.Title = new string(FindCharArrayA(ref c_buff, '\"', '\"', ref s)); int ae = FindCharArray(ref c_buff, ref Key_a_e, s); int ss = FindCharArray(ref c_buff, ref Key_mask, s, ae); string mask = ""; if (ss > 0) { mask = new string(FindCharArrayA(ref c_buff, '>', '<', ref ss)) + "\r\n"; } ss = FindCharArray(ref c_buff, ref Key_mark, s, ae); if (ss > 0) { ss += 2; int a = ss; t = FindCharArrayA(ref c_buff, '_', '.', ref a); im.marktag = CharToInt(ref t); } int d = FindCharArray(ref c_buff, ref Key_figure_desc, s, e); if (d > 0) { char[] tt = FindCharArrayA(ref c_buff, '>', '<', ref d); tt = DeleteChar(ref tt, (char)9, '\r', '\n'); str = new string(tt); int end = FindCharArray(ref c_buff, ref Key_div_e, d); int o = d; for (int c = 0; c < 4; c++) { o = FindCharArray(ref c_buff, ref Key_title, o, end); if (o < 0) { break; } str += " " + new string(FindCharArrayA(ref c_buff, '\"', '\"', ref o)); } s = d; } else { str = ""; } d = FindCharArray(ref c_buff, ref Key_info_inner, s, e); if (d > 0) { str = str + "\r\n播放数:" + new string(FindCharArrayA(ref c_buff, '>', '<', ref d)); } im.Detail = mask + str; return(im); }
public static void Create(SwapChain p, RawRectangleF m)//parent,margin { if (sp != null) { ReSize(m); return; } SetNav(0); Parent = p; nav = new ListBox(); nav.Hrizon = true; int c = nav_data.Length; for (int i = 0; i < c; i++) { nav.Data.Add(nav_data[i].title[0]); } nav.SelectedIndex = 0; nav.ItemWidth = 60; nav.Forground = new RawColor4(0.8f, 0.8f, 0.8f, 1); nav.BorderColor = new RawColor4(0, 0, 0, 1); nav.Background = new RawColor4(0.6f, 0.4725f, 0.4725f, 0.8f); RoundBorder rb = new RoundBorder(); rb.RoundRect.RadiusX = 8; rb.RoundRect.RadiusY = 8; rb.Size = new Size2F(60, 20); rb.FillBrush = BrushManage.GetLinearA(); nav.FillTemplate = rb; nav.SelectChanged = (o) => { var lb = o as ListBox; if (lb.SelectedIndex < 0) { return; } if (lb.SelectedIndex >= 12) { return; } FilterPanel.Visble = false; for (int ss = 0; ss < sp.Data.Count; ss++) { (sp.Data[ss] as IDisposable).Dispose(); } sp.Data.Clear(); part = 0; TextBar[1].Text = "1"; SetNav(lb.SelectedIndex); }; nav.ItemClick = (o) => { ShowOrHideFilter(); }; FilterPanel = new UIViewPort(); FilterPanel.Visble = false; FilterPanel.GaussianBack = true; FilterPanel.Background = new RawColor4(0, 0.1f, 0.2f, 0.4f); sp = new GridPanel(); sp.ItemTemplate = DataMod.GetTemplate(); sp.BorderColor = new RawColor4(0, 0, 0, 1); create = true; sp.ItemClick = (o, e) => { if (sp.ClickIndex < 0) { return; } string href = (sp.Data[sp.ClickIndex] as DataMod).href; if (href != null) { VideoPage.SetAddress(href); } PageManageEx.CreateNewPage(PageTag.videopage); }; lock (p.DX_Child) { p.DX_Child.Add(sp); p.DX_Child.Add(nav); p.DX_Child.Add(FilterPanel); } CreateBar(p); ReSize(m); if (load) { Analyze(); } }