public string GetProcessedRouteTemplate(string template, WrapType wrapType = WrapType.WholeString, bool escapeBrackets = false) { foreach (var map in _templateMap) { var expectedTemplate = $"{{{map.Key}}}"; var templatePattern = map.Value; if (!template.Contains(expectedTemplate)) { continue; } if (wrapType == WrapType.EachToken) { templatePattern = $"^{templatePattern}$"; } template = template.Replace(expectedTemplate, templatePattern); } if (wrapType == WrapType.WholeString) { //append an ending to the template template = $"^{template}$"; } //should we escape brackets [] to [[]] if (escapeBrackets) { template = template.Replace("[", "[[").Replace("]", "]]"); } return(template); }
public void on_config_change(WrapType wrap, bool showln) { showLN = showln; wrapType = wrap; CalcLNAreaWidth(); CalcWrapWidth(); }
public PresetData(float duration, WrapType timeWrap, Vector3 positionExtent, Vector3 rotationExtent, Vector3 scaleExtent) { this.duration = duration; this.timeWrap = timeWrap; this.positionExtent = positionExtent; this.rotationExtent = rotationExtent; this.scaleExtent = scaleExtent; }
public Canvas(GCsTextEdit view, Font font, bool showLN) { txtZone_ = view.getClientRect(); font_ = new Painter(view.Handle, font); this.showLN = showLN; figNum_ = 3; wrapWidth_ = 0xfffffff; wrapType = WrapType.NonWrap; }
public static SKCanvasView AsView( string Message, float FS = 64f, WrapType WT = WrapType.WordWrap, HorizontalAlignment hAlignment = HorizontalAlignment.Center) { return(new FlorineSkiaCVWrap(new ImageText(Message) { FontSize = FS, Overflow = WT, HAlign = hAlignment })); }
/// <summary> /// Performs wrap around detection on the current value. /// Algorithm is online, call this function everytime you measure the variable. /// </summary> /// <param name="value">Value to perform wrap detection on.</param> /// <returns>The result of the algorithm. The parameter Result also holds this value.</returns> public WrapType Run(double value) { double distance1; double distance2; if (value > _prevValue) { distance1 = value - _prevValue; distance2 = _prevValue + (_maxValue - value); if (distance2 < distance1) { // Data most likely negatively overflowed back to the end Result = WrapType.ReverseWrap; } else { Result = WrapType.None; } } else { distance1 = _prevValue - value; distance2 = value + (_maxValue - _prevValue); if (distance2 < distance1) { // Data most likely positively overflowed back to begining Result = WrapType.ForwardWrap; } else { Result = WrapType.None; } } // Remember value for next time Run() is called _prevValue = value; return(Result); }
internal static extern void elm_entry_line_wrap_set(IntPtr obj, WrapType wrap);
/// <summary> /// Represents the HTML attribute "wrap". /// </summary> /// <param name="wrap">The value.</param> /// <returns>The same instance of <see cref="Hex.AttributeBuilders.HtmlAttributeBuilder"/>.</returns> public HtmlAttributeBuilder Wrap( WrapType wrap ) { this.Attributes[ HtmlAttributes.Wrap ] = wrap.ToLowerString(); return this; }
internal static List <string> WordWrap(string str, int width, WrapMode mode, WrapType type, byte size) { List <string> lines = new List <string>(); string line = ""; string nextLine = ""; if (!(str == "")) { foreach (var word in Explode(str, SplitChars)) { var trim = word.Trim(); var currentType = type; do { var baseLine = line.Length < 1 ? "" : line + " "; var newLine = nextLine.Length < 1 ? baseLine + trim : nextLine; nextLine = ""; if (mode == WrapMode.Font ? Convert.ToBoolean(GetTextWidth(System.Convert.ToString(newLine), size)) : newLine.Length < width) { line = System.Convert.ToString(newLine); } else if (mode == WrapMode.Font ? Convert.ToBoolean(GetTextWidth(System.Convert.ToString(newLine), size)) : newLine.Length == width) { lines.Add(newLine); line = ""; } else { if (currentType == WrapType.None) { line = System.Convert.ToString(newLine); } else if (currentType == WrapType.Whitespace) { lines.Add(line.Length < 1 ? newLine : line); line = System.Convert.ToString(line.Length < 1 ? "" : trim); } else if (currentType == WrapType.BreakWord) { var remaining = trim; do { if ((mode == WrapMode.Font ? (GetTextWidth(System.Convert.ToString(baseLine), size)) : baseLine.Length) > width) { lines.Add(line); baseLine = ""; line = ""; } var i = remaining.Length - 1; while (-1 < i) { switch (mode) { case WrapMode.Font: if (!(width < GetTextWidth(baseLine + remaining.Substring(0, i) + "-", size))) { goto endOfWhileLoop; } break; case WrapMode.Characters: if (!(width < (baseLine + remaining.Substring(0, i) + "-").Length)) { goto endOfWhileLoop; } break; } i--; } endOfWhileLoop: line = System.Convert.ToString(baseLine + remaining.Substring(0, i + 1) + (remaining.Length <= i + 1 ? "" : "-")); lines.Add(line); line = ""; baseLine = ""; remaining = remaining.Substring(i + 1); } while ((remaining.Length > 0) && (width < (mode == WrapMode.Font ? (GetTextWidth(System.Convert.ToString(remaining), size)) : remaining.Length))); line = System.Convert.ToString(remaining); } else if (currentType == WrapType.Smart) { if ((line.Length < 1) || (width < (mode == WrapMode.Font ? (GetTextWidth(System.Convert.ToString(trim), size)) : trim.Length))) { currentType = WrapType.BreakWord; } else { currentType = WrapType.Whitespace; } nextLine = System.Convert.ToString(newLine); } } } while (nextLine.Length > 0); } } if (line.Length > 0) { lines.Add(line); } return(lines); }
/// <summary> /// Insert Image in Word Document /// </summary> /// <param name="SourceDocumentFilePath">Source/Input Document file's full path</param> ///// <param name="TargetDocumentFilePath">Target/Output Document file's full path</param> /// <param name="InputImagePath">Image full path(Which needs to be inserted in the document) </param> /// <param name="needtoAddHeader">Add header in page page if true </param> /// <param name="ImageWidthDraw">Image-Width in the document</param> /// <param name="ImageHeightDraw">Image-Height in the document</param> /// <param name="Left">Left</param> /// <param name="Top">Top</param> /// <returns></returns> public static Document InsertHeaderLogo(string SourceDocumentFilePath, string InputImagePath, bool needtoAddHeader = false, double ImageWidthDraw = 120, double ImageHeightDraw = 44, double Left = 10, double Top = 10) //, string TargetDocumentFilePath, { License license1 = new License(); license1.SetLicense("Aspose.Words.lic"); Document doc = new Document(SourceDocumentFilePath); DocumentBuilder builder; RelativeHorizontalPosition h = RelativeHorizontalPosition.Page; RelativeVerticalPosition v = RelativeVerticalPosition.Page; WrapType w = WrapType.None; List <string> DocListNeedLog = new List <string> { @"\Subpoenas\State\Michigan\FAX Request.doc" , @"\Custodian Letters\All Letter Request Forms\FOIA or Letter Requests\FAX Request.doc" , @"\Face Sheets\Face Sheet-DIGITAL ONLY - ONLINE FACE SHEET ONLY.doc" , @"\Custodian Letters\All Location Letters & Faxes\Non-Compliance (HIPAA).doc" }; var objDocumentPath = DocListNeedLog.FirstOrDefault(x => SourceDocumentFilePath.ToLower().Replace('/', '\\').Contains(x.ToLower())); if (objDocumentPath != null) { builder = new DocumentBuilder(doc); Shape shape; switch (objDocumentPath.ToLower().Replace('/', '\\')) { case @"\subpoenas\state\michigan\fax request.doc": // 2 LOGO case @"\custodian letters\all letter request forms\foia or letter requests\fax request.doc": case @"\custodian letters\all location letters & faxes\non-compliance (hipaa).doc": #region Header Logo common across three forms ImageWidthDraw = 130; ImageHeightDraw = 50; Left = 45; Top = 85; builder.InsertImage(InputImagePath, h, Left, v, ConvertUtil.PixelToPoint(Top), ConvertUtil.PixelToPoint(ImageWidthDraw), ConvertUtil.PixelToPoint(ImageHeightDraw), w); #endregion #region LargeLogo builder.MoveToBookmark("LargeLogo"); if (objDocumentPath.ToLower() == @"\custodian letters\all location letters & faxes\non-compliance (hipaa).doc") { Left = 275; ImageWidthDraw = 305; ImageHeightDraw = 118; Top = 50; } else //fax request { Left = 270; ImageWidthDraw = 305; ImageHeightDraw = 135; Top = 90; } shape = builder.InsertImage(InputImagePath); // Make the image float, put it behind text and center on the page shape.WrapType = WrapType.TopBottom; shape.BehindText = false; shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page; shape.HorizontalAlignment = HorizontalAlignment.Center; shape.RelativeVerticalPosition = RelativeVerticalPosition.Page; //shape.VerticalAlignment = VerticalAlignment.; shape.Top = ConvertUtil.PixelToPoint(Top); //shape.Left = ConvertUtil.PixelToPoint(Left); shape.Width = ConvertUtil.PixelToPoint(ImageWidthDraw); shape.Height = ConvertUtil.PixelToPoint(ImageHeightDraw); #endregion return(doc); break; case @"\face sheets\face sheet-digital only - online face sheet only.doc": // CENTER LOGO ONLY ONE LOGO ImageWidthDraw = 305; ImageHeightDraw = 110; Left = 240; Top = 170; shape = builder.InsertImage(InputImagePath); // Make the image float, put it behind text and center on the page shape.WrapType = WrapType.TopBottom; shape.BehindText = false; shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page; shape.HorizontalAlignment = HorizontalAlignment.Center; shape.RelativeVerticalPosition = RelativeVerticalPosition.Page; //shape.VerticalAlignment = VerticalAlignment.; shape.Top = ConvertUtil.PixelToPoint(Top); //shape.Left = ConvertUtil.PixelToPoint(Left); shape.Width = ConvertUtil.PixelToPoint(ImageWidthDraw); shape.Height = ConvertUtil.PixelToPoint(ImageHeightDraw); return(doc); break; } return(doc); } else { return(doc); } builder = new DocumentBuilder(doc); if (needtoAddHeader) { Section currentSection = builder.CurrentSection; PageSetup pageSetup = currentSection.PageSetup; pageSetup.DifferentFirstPageHeaderFooter = false; // --- Create header for the first page. --- pageSetup.HeaderDistance = 100; builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst); builder.ParagraphFormat.Alignment = ParagraphAlignment.Center; // Set font properties for header text. builder.Font.Name = "Arial"; builder.Font.Bold = true; builder.Font.Size = 14; // Specify header title for the first page. builder.Write("...Header Text Here...."); // --- Create header for pages other than first. --- pageSetup.HeaderDistance = 20; builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary); // Insert absolutely positioned image into the top/left corner of the header. // Distance from the top/left edges of the page is set to 10 points. if (File.Exists(InputImagePath)) { builder.InsertImage(InputImagePath, RelativeHorizontalPosition.Page, 10, RelativeVerticalPosition.Page, 10, ImageWidthDraw, ImageHeightDraw, WrapType.Through); } //doc.Save(TargetDocumentFilePath); } else { if (File.Exists(InputImagePath)) { builder.InsertImage(InputImagePath, h, Left, v, Top, ImageWidthDraw, ImageHeightDraw, w); } } return(doc); }
/// <summary> /// Parses all static settings and adds custom settings into the CustomSettings-List /// </summary> public void Add(String setting) { setting = setting.Trim(); if (String.IsNullOrEmpty(setting)) return; var parts = setting.Split(':'); if (parts.Length != 2) return; switch (parts[0]) { case "WrapStyle": WrapStyle = (WrapType) Int32.Parse(parts[1]); break; case "Title": Title = parts[1]; break; case "PlayResX": VideoWidth = Int32.Parse(parts[1]); break; case "PlayResY": VideoHeight = Int32.Parse(parts[1]); break; case "ScaledBorderAndShadow": ScaledBorderAndShadow = parts[1].Trim().Equals("yes"); break; default: Add(parts[0], parts[1].Trim()); break; } }