static void Main(string[] args) { th = new TextImpl(); while (true) { th.showMenu(); string s = Console.ReadLine(); switch (s) { case "1": { text = new Text(); th.write(text); th.SaveFile(text.Content, text.Saveroute + "/" + text.Name); break; } case "2": { text = new Text(); Console.WriteLine("请输入打开文件路径:"); String op = Console.ReadLine(); text = th.OpenFile(op); Console.WriteLine("笔记内容:\n" + text.Content); break; } case "3": { break; } } } }
public ActionResult Index() { TextHandle th = new TextHandle(); string str = th.GetModText("/index.htm"); //计数器 需要重写 //try //{ // var sysset = new SysSet().loadConfig(Utils.GetMapPath("~/Content/WebSet.config")).FontSize; // // myhelp = myhelp.getXml("../config/sysparm2.xml"); // //赋值给MODEL // SysSet model = new SysSet(); // model.FontSize = sysset + 1; // ////修改配置信息 // model = new SysSet().saveConifg(model, Server.MapPath("~/Content/WebSet.config")); //} //catch //{ //} ViewData["Message"] = str; return(View("index")); }
public void Ignore_null() { string value = null; string newValue = null; Assert.Equal(newValue, TextHandle.ToUri(value)); }
private void DrawTextCore(MeshGenerationContextUtils.TextParams textParams, TextHandle handle, float pixelsPerPoint) { TextInfo textInfo = handle.Update(textParams, pixelsPerPoint); for (int i = 0; i < textInfo.materialCount; i++) { bool flag = textInfo.meshInfo[i].vertexCount == 0; if (flag) { break; } this.m_CurrentEntry.isTextEntry = true; this.m_CurrentEntry.clipRectID = this.m_ClipRectID; this.m_CurrentEntry.isStencilClipped = this.m_StencilClip; MeshBuilder.MakeText(textInfo.meshInfo[i], textParams.rect.min, new MeshBuilder.AllocMeshData { alloc = this.m_AllocRawVertsIndicesDelegate }); this.m_CurrentEntry.font = textInfo.meshInfo[i].material.mainTexture; this.m_Entries.Add(this.m_CurrentEntry); this.totalVertices += this.m_CurrentEntry.vertices.Length; this.totalIndices += this.m_CurrentEntry.indices.Length; this.m_CurrentEntry = default(UIRStylePainter.Entry); } }
public void Clean_if_no_contains_a_z_or_number_add_delemiter() { string value = " "; string newValue = string.Empty; Assert.Equal(newValue, TextHandle.ToUri(value, "_")); }
public void Remove_upper_case() { string value = "1, 2, 3, EXPREÇÃO, HISTÓRIA, FÍSICA, PÊSSEGO"; string newValue = "1-2-3-EXPRECAO-HISTORIA-FISICA-PESSEGO"; Assert.Equal(newValue, TextHandle.ToUri(value)); }
private void DrawTextNative(MeshGenerationContextUtils.TextParams textParams, TextHandle handle, float pixelsPerPoint) { float scaling = TextHandle.ComputeTextScaling(this.currentElement.worldTransform, pixelsPerPoint); TextNativeSettings textNativeSettings = MeshGenerationContextUtils.TextParams.GetTextNativeSettings(textParams, scaling); using (NativeArray <UnityEngine.UIElements.TextVertex> vertices = TextNative.GetVertices(textNativeSettings)) { bool flag = vertices.Length == 0; if (!flag) { Vector2 offset = TextNative.GetOffset(textNativeSettings, textParams.rect); this.m_CurrentEntry.isTextEntry = true; this.m_CurrentEntry.clipRectID = this.m_ClipRectID; this.m_CurrentEntry.isStencilClipped = this.m_StencilClip; MeshBuilder.MakeText(vertices, offset, new MeshBuilder.AllocMeshData { alloc = this.m_AllocRawVertsIndicesDelegate }); this.m_CurrentEntry.font = textParams.font.material.mainTexture; this.m_Entries.Add(this.m_CurrentEntry); this.totalVertices += this.m_CurrentEntry.vertices.Length; this.totalIndices += this.m_CurrentEntry.indices.Length; this.m_CurrentEntry = default(UIRStylePainter.Entry); this.currentElement.renderChainData.usesLegacyText = true; this.currentElement.renderChainData.disableNudging = true; } } }
public void Ignore_null() { string value = null; string newValue = null; Assert.Equal(newValue, TextHandle.RemoveSpecialCharacters(value)); }
public void DrawText(MeshGenerationContextUtils.TextParams textParams, TextHandle handle, float pixelsPerPoint) { bool flag = textParams.font == null; if (!flag) { bool flag2 = this.m_CurrentElement.panel.contextType == ContextType.Editor; if (flag2) { textParams.fontColor *= textParams.playmodeTintColor; } float scaling = TextNative.ComputeTextScaling(this.m_CurrentElement.worldTransform, pixelsPerPoint); TextNativeSettings textNativeSettings = MeshGenerationContextUtils.TextParams.GetTextNativeSettings(textParams, scaling); using (NativeArray <TextVertex> vertices = TextNative.GetVertices(textNativeSettings)) { List <RenderChainTextEntry> arg_91_0 = this.m_CurrentElement.renderChainData.textEntries; int textEntryIndex = this.m_TextEntryIndex; this.m_TextEntryIndex = textEntryIndex + 1; RenderChainTextEntry renderChainTextEntry = arg_91_0[textEntryIndex]; Vector2 offset = TextNative.GetOffset(textNativeSettings, textParams.rect); MeshBuilder.UpdateText(vertices, offset, this.m_CurrentElement.renderChainData.verticesSpace, this.m_XFormClipPages, this.m_IDsFlags, this.m_OpacityPagesSettingsIndex, this.m_MeshDataVerts.Slice(renderChainTextEntry.firstVertex, renderChainTextEntry.vertexCount)); renderChainTextEntry.command.state.font = textParams.font.material.mainTexture; } } }
public ActionResult Search() { TextHandle th = new TextHandle(); ViewData["Message"] = th.GetModText("/shlist.htm"); //替换指定索引处的指定字符 return(View("index")); }
public void Clean_if_no_contains_a_z_or_number() { string value = " "; string newValue = string.Empty; Assert.Equal(newValue, TextHandle.RemoveSpecialCharacters(value)); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } //DontDestroyOnLoad(gameObject); enemies = new List <Enemy>(); boardScript = GetComponent <BoardManager>(); dungeonScript = GetComponent <DungeonManager>(); dungeonBSPScript = GetComponent <BSPDungeonManager>(); if (GameObject.FindGameObjectWithTag("Player")) { playerOne = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); } textHandle = new TextHandle(); textHandle.ReadFile("seeds"); camera3D = FindObjectOfType <HexMapCamera>(); InitGame(); }
protected internal override void OnThemeChange() { // Update base theme base.OnThemeChange(); // Recalculate checkbox control position ControlHandle.AlignOffset = new Vector2(0, ((DefaultHeight - ControlHandle.Size.Y) / 2) + (DrawHeader ? HeaderHeight : 0)); // Recalculate text position TextHandle.Padding = new Vector2(ControlHandle.Size.Y, (DefaultHeight - TextHandle.Bounding.Height) / -2f); TextHandle.Width = (int)(DefaultWidth - DefaultWidth * KeyButtonHandle.WidthMultiplier * 2 - ControlHandle.Size.Y); TextHandle.ApplyToControlPosition(this); // Header positions if (DrawHeader) { HeaderText.Item1.Padding = new Vector2( Width - DefaultWidth * KeyButtonHandle.WidthMultiplier * 2 + (DefaultWidth * KeyButtonHandle.WidthMultiplier - HeaderText.Item1.Bounding.Width) / 2, (HeaderHeight - HeaderText.Item1.Bounding.Height) / 2f); HeaderText.Item2.Padding = new Vector2( Width - DefaultWidth * KeyButtonHandle.WidthMultiplier + (DefaultWidth * KeyButtonHandle.WidthMultiplier - HeaderText.Item1.Bounding.Width) / 2, (HeaderHeight - HeaderText.Item1.Bounding.Height) / 2f); // Apply to this container HeaderText.Item1.ApplyToControlPosition(this); HeaderText.Item2.ApplyToControlPosition(this); } }
public void Remove_lower_case() { string value = "1, 2-3 > < expreção, história, física, pêssego"; string newValue = "1, 2-3 > < exprecao, historia, fisica, pessego"; Assert.Equal(newValue, TextHandle.RemoveSpecialCharacters(value)); }
public void Remove_upper_case() { string value = "1 | 2 & 3 $ EXPREÇÃO, HISTÓRIA, FÍSICA, PÊSSEGO"; string newValue = "1 | 2 & 3 $ EXPRECAO, HISTORIA, FISICA, PESSEGO"; Assert.Equal(newValue, TextHandle.RemoveSpecialCharacters(value)); }
public void Remove_lower_case_add_delemiter() { string value = "1, 2, 3, expreção, história, física, pêssego"; string newValue = "1_2_3_exprecao_historia_fisica_pessego"; Assert.Equal(newValue, TextHandle.ToUri(value, "_")); }
public void Remove_upper_case_add_delemiter() { string value = "1, 2, 3, EXPREÇÃO, HISTÓRIA, FÍSICA, PÊSSEGO"; string newValue = "1_2_3_EXPRECAO_HISTORIA_FISICA_PESSEGO"; Assert.Equal(newValue, TextHandle.ToUri(value, "_")); }
public void Ignore_null_add_delemiter() { string value = null; string newValue = null; Assert.Equal(newValue, TextHandle.ToUri(value, "_")); }
public void Remove_lower_case() { string value = "1, 2, 3, expreção, história, física, pêssego"; string newValue = "1-2-3-exprecao-historia-fisica-pessego"; Assert.Equal(newValue, TextHandle.ToUri(value)); }
public SysSet saveConifg(SysSet mode, string configFilePath) { lock (lockHelper) { TextHandle.xmlSave(mode, configFilePath); } return(mode); }
public void ReplaceFont(System.Drawing.Font font) { if (TextHandle != null) { TextHandle.Dispose(); } TextHandle = new Font(Drawing.Direct3DDevice, font); RecalculateBoundingAndDisplayedText(); }
public void ReplaceFont(FontDescription fontDescription) { if (TextHandle != null) { TextHandle.Dispose(); } TextHandle = new Font(Drawing.Direct3DDevice, fontDescription); RecalculateBoundingAndDisplayedText(); }
protected internal override sealed void OnThemeChange() { // Apply base theme base.OnThemeChange(); // Update text position TextHandle.Width = (int)(DefaultWidth * TextWidthMultiplier); TextHandle.ApplyToControlPosition(this); }
internal void RemoveText() { TextValue = null; if (TextHandle != null) { TextHandle.Dispose(); TextHandle = null; } }
public void Text(TextHandle sprite) { if (!DrawUI) { return; } GUI.Label(new UnityEngine.Rect(sprite.Position.X, sprite.Position.Y, 200, 200), new GUIContent() { text = sprite.Text }); }
public GroupLabel(string displayName) : base(displayName, (int)(DefaultHeight * HeightMultiplier)) { // Initialize properties TextHandle.ReplaceFont(new FontDescription { FaceName = ThemeManager.DefaultFontFaceName, Height = 20 }); TextHandle.Color = DefaultColorGreen; }
public void DrawTime() { // Apply the remaining time and draw it var time = RemainingTimeText; if (time != null) { TextHandle.TextValue = "Ward: " + time; TextHandle.Position = new Vector2(ScreenPosition.X - TextHandle.Bounding.Width / 2f, ScreenPosition.Y + HealthBar.Height); TextHandle.Draw(); } }
public void Draw(string text, SharpDX.Color color, int x, int y) { if (!IsDrawing) { Core.EndAllDrawing(Core.RenderingType.Sprite); SpriteHandle.Begin(); IsDrawing = true; } // Draw the text TextHandle.DrawText(SpriteHandle, text, x, y, color); }
public void Dispose() { if (TextHandle != null) { TextHandle.Dispose(); TextHandle = null; } Drawing.OnPreReset -= OnPreReset; Drawing.OnPostReset -= OnPostReset; AppDomain.CurrentDomain.ProcessExit -= OnUnload; AppDomain.CurrentDomain.DomainUnload -= OnUnload; }
protected internal override void OnThemeChange() { // Apply base theme base.OnThemeChange(); // Update check box handle //ControlHandle.AlignOffset = new Vector2(Size.X - ControlHandle.Size.X, Size.Y / 2 - ControlHandle.Size.Y / 2); // Right align ControlHandle.AlignOffset = new Vector2(0, (Size.Y - ControlHandle.Size.Y) / 2); // Left align // Update text position offset TextHandle.Padding = new Vector2(ControlHandle.Size.X, 0); TextHandle.ApplyToControlPosition(this); }
//主页的 private void LoadData() { TextHandle th = new TextHandle(); string str = th.GetModText("/index.htm"); //计数器 需要重写 //try //{ // var sysset = new SysSet().loadConfig(Utils.GetMapPath("~/App_Data/WebSet.config")).FontSize; // // myhelp = myhelp.getXml("../config/sysparm2.xml"); // //赋值给MODEL // SysSet model = new SysSet(); // model.FontSize = sysset + 1; // ////修改配置信息 // model = new SysSet().saveConifg(model, Server.MapPath("~/App_Data/WebSet.config")); //} //catch //{ //} Response.Write(str); }
public ActionResult Index() { TextHandle th = new TextHandle(); string str = th.GetModText("/index.htm"); //计数器 需要重写 //try //{ // var sysset = new SysSet().loadConfig(Utils.GetMapPath("~/Content/WebSet.config")).FontSize; // // myhelp = myhelp.getXml("../config/sysparm2.xml"); // //赋值给MODEL // SysSet model = new SysSet(); // model.FontSize = sysset + 1; // ////修改配置信息 // model = new SysSet().saveConifg(model, Server.MapPath("~/Content/WebSet.config")); //} //catch //{ //} ViewData["Message"] = str; return View("index"); }
public ActionResult list(string ID) { int myid = int.Parse(ID); string type = ""; using (Entities db = new Entities()) { //通过栏目id 得到栏目名称和栏目类别 //1 文章模型 2 单页模型 3 跳转地址模型 var datas = from i in db.L_Classs where i.CID == myid select new { i.CType, i.CSkin }; if (datas.Count() != 0) { var _Ncl = datas.First(); type = _Ncl.CType.ToString(); if (type == "1") { TextHandle th = new TextHandle(); string str = ""; if (!(_Ncl.CSkin == null || _Ncl.CSkin.ToString() == String.Empty)) { str = th.GetModText("/" + _Ncl.CSkin.ToString()); } else { str = th.GetModText("/list.htm"); } ViewData["Message"] = str; //替换指定索引处的指定字符 } if (type == "2") { var listNew = (from n in db.L_Newss where n.ClassId == myid select n); if (listNew.Count() != 0) { var _listNew = listNew.First(); string newsid = "pages_" + _listNew.ClassId.ToString() + "_" + _listNew.NID.ToString() + ".aspx"; ViewData["Message"] = ""; Response.Redirect(newsid); } else { ViewData["Message"] = "单页没有内容,请到后台添加!"; } } if (type == "3") { var listUrl = (from m in db.L_Newss where m.ClassId == myid select m.Url).First(); if (listUrl.Count() != 0 && listUrl != "" && listUrl != "0") { Response.Redirect(listUrl.ToString()); } else { ViewData["Message"] = "跳转页面没有内容,请到后台添加!"; } } } else { ViewData["Message"] = "暂无该栏目请仔细核对!"; } } return View("index"); }
public ActionResult Search() { TextHandle th = new TextHandle(); ViewData["Message"] = th.GetModText("/shlist.htm"); //替换指定索引处的指定字符 return View("index"); }
private void LoadForm() { // string u_id = "1"; int myid = int.Parse(HttpContext.Current.Request.QueryString["ID"]); // adduc(myid); using (Entities db = new Entities()) { var fm = db.L_Form.SingleOrDefault(p => p.FID == myid); Table newtable = new Table(); int textnum = 0; this.title = fm.FNmae; content = "<table><form name=Form2 action=myform" + myid + ".aspx method=post>"; string a = fm.F1; if (a.Length > 0) { a = a.Substring(0, a.Length - 1); string[] sArray = a.Split(new char[] { '|' }); foreach (string myStr in sArray) { textnum++; content += "<tr><td>" + myStr + "</td>"; content += "<td><input name='ln" + textnum.ToString() + "'/></td></tr>"; } } } content += "<tr><td><input type='submit' name='Submit' value='提交' /><td><td></td><tr></from></table>"; TextHandle th = new TextHandle(); string str = th.GetModText("/read.htm"); str = str.Replace("<!--Read_title-->", title); str = str.Replace("<!--Read_content-->", content); // ViewState["adduc"] = 1; Response.Write(str); }
// list 页面 private void LoadList() { int myid = int.Parse(HttpContext.Current.Request.QueryString["ID"]); string type = "",str=""; using (Entities db = new Entities()) { //通过栏目id 得到栏目名称和栏目类别 //1 文章模型 2 单页模型 3 跳转地址模型 var datas = from i in db.L_Classs where i.CID == myid select new { i.CType, i.CSkin }; if (datas.Count() != 0) { var _Ncl = datas.First(); type = _Ncl.CType.ToString(); if (type == "1") { TextHandle th = new TextHandle(); if (!(_Ncl.CSkin == null || _Ncl.CSkin.ToString() == String.Empty)) { str = th.GetModText("/" + _Ncl.CSkin.ToString()); } else { str = th.GetModText("/list.htm"); } } if (type == "2") { var listNew = (from n in db.L_Newss where n.ClassId == myid select n); if (listNew.Count() != 0) { var _listNew = listNew.First(); string newsid = "pages_" + _listNew.ClassId.ToString() + "_" + _listNew.NID.ToString() + ".aspx"; str = ""; Response.Redirect(newsid); } else { str = "单页没有内容,请到后台添加!"; } } if (type == "3") { var listUrl = (from m in db.L_Newss where m.ClassId == myid select m.Url).First(); if (listUrl.Count() != 0 && listUrl != "" && listUrl != "0") { Response.Redirect(listUrl.ToString()); } else { str = "跳转页面没有内容,请到后台添加!"; } } } else { str = "暂无该栏目请仔细核对!"; } } Response.Write(str); }
//read页面 private void Loadread() { int newsid = int.Parse(HttpContext.Current.Request.QueryString["NID"]); int myid = int.Parse(HttpContext.Current.Request.QueryString["ID"]); string str = ""; using (Entities db = new Entities()) { var datas = db.L_Classs.SingleOrDefault(i => i.CID == myid); if (datas != null) { try { var News = db.L_Newss.Single(i => i.NID == newsid); if (News.Url != "" && News.Url != "0" && News.Url != null) { Response.Redirect(News.Url.ToString()); } TextHandle th = new TextHandle(); if (!string.IsNullOrEmpty(datas.CSubSkin)) { str = th.GetModText("/" + datas.CSubSkin.Trim()); } else { str = th.GetModText("/read.htm"); } string allpicTAG = "<!--Read_allpic,.*-->"; Regex regallpic = new Regex(allpicTAG); MatchCollection mcallpic = regallpic.Matches(str); if (mcallpic.Count > 0) { for (int i = 0; i < mcallpic.Count; i++) { string longtag = mcallpic[i].ToString(); string[] longtags = longtag.Split(','); longtag = longtags[1].ToString().Replace("-->", ""); string allpic2 = ""; string biaoda = @"src=""([\s\S]*?)"""; Regex regimg = new Regex(biaoda); MatchCollection mcimg = regimg.Matches(News.Content); if (mcimg.Count > 0) { for (int ii = 0; ii < mcimg.Count; ii++) { allpic2 += longtag.Replace("#pic#", mcimg[ii].ToString().Replace("src=\"", "").Replace("\"", "")); } } str = str.Replace(mcallpic[i].ToString(), allpic2); } } str = str.Replace("<!--Read_title-->", News.Title); str = str.Replace("<!--Read_content-->", News.Content); str = str.Replace("<!--Read_key-->", News.Tag); str = str.Replace("<!--Read_img-->", News.Img); str = str.Replace("<!--Read_desc-->", News.ZhaiYao); str = str.Replace("<!--Read_auth-->", News.Author); str = str.Replace("<!--Read_from-->", News.From); str = str.Replace("<!--Read_click-->", News.Click); str = str.Replace("<!--Read_time-->", News.Time.ToString()); str = str.Replace("<!--Nid-->", newsid.ToString()); str = str.Replace("<!--Id-->", ID); try { News.Click = (Convert.ToInt32(News.Click) + 1).ToString(); db.SaveChanges(); } catch { } } catch { str = "没有ID为" + newsid + "的文章,请到后台核对!"; } } else { str = "没有ID为" + myid + "的栏目,请到后台核对!"; } } Response.Write(str); }
private void LoadSearch() { TextHandle th = new TextHandle(); Response.Write(th.GetModText("/shlist.htm")); //替换指定索引处的指定字符 }