Ejemplo n.º 1
0
 /// <summary>
 /// Search a template in the content of this objetc, and replace it with another one,
 /// </summary>
 /// <param name="toFind">the template to find</param>
 /// <param name="toReplace">the template to replace with</param>
 /// <returns>true if at least one modification occured</returns>
 public bool ReplaceAll(MapTemplate toFind, MapTemplate toReplace)
 {
     return(CharUtils
            .Replace(Content, toFind.Content, toReplace.Content, 100, ""));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// place a given template on the content at a given position.
 /// Only filled part of the template characters (!= '?') are used
 /// </summary>
 /// <param name="Template">the replacing template</param>
 /// <param name="xpos">X position</param>
 /// <param name="ypos">Y position</param>
 public void Place(MapTemplate template, int xpos, int ypos)
 {
     CharUtils.Place(Content, template.Content, xpos, ypos);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// check the current template against a given map and return the list of position where both template matche
 /// </summary>
 /// <param name="destination">The template to chekc the template against. It should be bigger than the template</param>
 /// <returns>List of position where the template Matches</returns>
 public List <Position> Matches(MapTemplate content, bool strict = false)
 {
     return(CharUtils
            .Matches(map: content.Content, template: Content, "", strict: strict));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// check the given template against the content of the object return the list of position where the template matche
 /// </summary>
 /// <param name="template">The template to chek </param>
 /// <param name="operation">operations to perform on the template (RXY) </param>
 /// <returns>List of position where the template Matches</returns>
 public List <Position> Matches(MapTemplate template, string operations, bool strict = false)
 {
     return(CharUtils.Matches(Content, template.Content, operations, strict: strict));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// check the current template against a given position on the given map and return true if the template matche
 /// </summary>
 /// <param name="template">The template to check</param>
 /// <param name="xpos">X position</param>
 /// <param name="ypos">Y position</param>
 /// <returns>true if the template Matches, false otherwise</returns>
 public bool Matches(MapTemplate template, int xpos, int ypos, bool strict = false)
 {
     return(CharUtils.Match(pattern: Content, map: template.Content, xpos: xpos, ypos: ypos, strict: strict));
 }