public static MailAddressCollection GetAddresses(Field field) { IPattern addrSpecPattern = PatternFactory.GetInstance().Get(typeof(RFC822.Pattern.AddrSpecPattern)); MailAddressCollection addresses = null; if (addrSpecPattern.RegularExpression.IsMatch(field.Body)) { //TODO: Make supprt for multiple addresses with names addresses = new MailAddressCollection(); try { MailAddress address = new MailAddress(field.Body); addresses.Add(address); } catch (FormatException) { MatchCollection matches = addrSpecPattern.RegularExpression.Matches(field.Body); foreach (Match match in matches) { addresses.Add(match.Value); } } } return(addresses); }
public PhrasePattern() { IPattern wordPattern = PatternFactory.GetInstance().Get(typeof(WordPattern)); m_TextPattern = wordPattern.TextPattern; m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled); }
public PatternClient(GameObject item, Vector3 theStart, Vector3 theEnd) { start = theStart; end = theEnd; ptrn = PatternFactory.getPattern(item); gameObject = MonoBehaviour.Instantiate(ptrn.GetPattern(), start, ptrn.GetPattern().transform.rotation); }
/// <summary> /// Constructor for a basic ui element /// </summary> /// <param name="automation">The automation instance where this element belongs to</param> /// <param name="nativeElement">The native element this instance wrapps</param> public Element(UIA3Automation automation, UIA.IUIAutomationElement nativeElement) : base(automation) { NativeElement = nativeElement; PatternFactory = new PatternFactory(this); Cached = new ElementInformation(this, true); Current = new ElementInformation(this, false); }
public DatePattern() { IPattern monthPattern = PatternFactory.GetInstance().Get(typeof(MonthPattern)); m_TextPattern = "([0-9]{2,2}\x5C\x73" + monthPattern.TextPattern + "\x5C\x73[0-9]{2,4}){1,1}"; m_Regex = new Regex(m_TextPattern); }
public void IsFull() { var context = new BoardProperties(4, 4, 5); var positions = new PositionFactory().Create(context); var patterns = new PatternFactory().Create(); var matcher = new PatternMatcher(patterns); var boardFactories = new IBoardFactory[] { new BoardFactory(context, positions), new PatternBoardFactory(context, positions, matcher) }; foreach (var boardFactory in boardFactories) { IGame game = new GameFactory().CreateGame( boardFactory, new NextAvailablePlayer(positions), new NextAvailablePlayer(positions), new BasicJudge(context, positions) ); game.Start(); foreach (var i in Enumerable.Range(0, context.RowSize * context.ColSize)) { Assert.AreEqual(game.GameStatus, GameStatus.NotEnd); game.Run(); } Assert.AreEqual(game.GameStatus, GameStatus.Tie); Assert.IsTrue(game.Board.IsFull()); } }
public CreationDateParmPattern() { IPattern quotedDatetimePattern = PatternFactory.GetInstance().Get(typeof(QuotedDateTimePattern)); m_TextPattern = "creation-date=" + quotedDatetimePattern.TextPattern; m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled); }
public CommandReader(string commands, Random random) { _animationFactory = new AnimationFactory(TypeSource <IAnimation> .FromThisAssembly()); _patternFactory = new PatternFactory(TypeSource <IPattern> .FromThisAssembly()); _timingFactory = new TimingFactory(TypeSource <ITiming> .FromThisAssembly()); _commands = commands; }
public DomainPattern() { IPattern subDomainPattern = PatternFactory.GetInstance().Get(typeof(SubDomainPattern)); m_TextPattern = "(" + subDomainPattern.TextPattern + "(?:\x5C\x2E" + subDomainPattern.TextPattern + ")*)"; m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled); }
public MIMEVersionPattern() { IPattern commentPattern = PatternFactory.GetInstance().Get(typeof(RFC822.Pattern.CommentPattern)); m_TextPattern = "(?i)MIME-Version:(?-i)([0-9]{1,1}|\\x2E{1,1}|" + commentPattern.TextPattern + ")*"; m_Regex = new Regex(m_TextPattern); }
public override void Initialize() { base.Initialize(); _ruleChooser = new MajorityInOrderRuleChooser(); CAPattern pattern; Point insertPoint; pattern = PatternFactory.GetPieceGridFromPatternFile("RuleFiles/PersianRugs.rle"); insertPoint = new Point(5, 5); InsertPattern(pattern, insertPoint, 5); pattern = PatternFactory.GetPieceGridFromPatternFile("RuleFiles/SpiralGrowth.rle"); insertPoint = new Point(85, 45); InsertPattern(pattern, insertPoint, 4); pattern = PatternFactory.GetPieceGridFromPatternFile("RuleFiles/JustFriendsBox50.rle"); insertPoint = new Point(25, 25); InsertPattern(pattern, insertPoint, 0); pattern = PatternFactory.GetPieceGridFromPatternFile("RuleFiles/GliderGunNE.rle"); insertPoint = new Point(48, 31); InsertPattern(pattern, insertPoint, 1); pattern = PatternFactory.GetPieceGridFromPatternFile("RuleFiles/SeedsSmall.rle"); insertPoint = new Point(2, 2); InsertPattern(pattern, insertPoint, 3); }
public ContentTransferEncodingPattern() { IPattern mechanismPattern = PatternFactory.GetInstance().Get(typeof(MechanismPattern)); m_TextPattern = "(?i)Content-Transfer-Encoding(?i):[ ]*" + mechanismPattern.TextPattern; m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled); }
public CharsetPattern() { IPattern tokenPattern = PatternFactory.GetInstance().Get(typeof(RFC822.Pattern.TokenPattern)); m_TextPattern = "(?<==\x5C?)" + tokenPattern.TextPattern + "(?=\x5C?)"; m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled); }
public DispositionTypePattern() { IPattern xtokenPattern = PatternFactory.GetInstance().Get(typeof(XTokenPattern)); m_TextPattern = "(?i)(inline|Attachment|" + xtokenPattern.TextPattern + ")(?i)"; m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled); }
public XTokenPattern() { IPattern tokenPattern = PatternFactory.GetInstance().Get(typeof(MIMER.RFC822.Pattern.TokenPattern)); m_TextPattern = "(X-|x-)" + tokenPattern.TextPattern; m_Regex = new Regex(m_TextPattern); }
public void Collapse() { if (!Current.IsEnabled || ExpandCollapseState != ExpandCollapseState.Expanded) { return; } if (FrameworkType == FrameworkType.WinForms) { // WinForms var openButton = FindFirstChild(ConditionFactory.ByControlType(ControlType.Button)).AsButton(); if (IsEditable) { // WinForms editable combo box only closes on click and not on invoke openButton.Click(); } else { openButton.Invoke(); } } else { // WPF var ecp = PatternFactory.GetExpandCollapsePattern(); ecp?.Collapse(); } Helpers.WaitUntilResponsive(this); }
public MailReader() { m_FieldParser = new FieldParser(); m_FieldParser.CompilePattern(); m_UnfoldPattern = PatternFactory.GetInstance().Get(typeof(Pattern.UnfoldPattern)); }
public QuotedDateTimePattern() { IPattern datetimePattern = PatternFactory.GetInstance().Get(typeof(RFC822.Pattern.DateTimePattern)); m_TextPattern = "\"" + datetimePattern.TextPattern + "\""; m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled); }
public FieldParser() { m_UnfoldPattern = PatternFactory.GetInstance().Get(typeof(UnfoldPattern)); m_FieldPattern = PatternFactory.GetInstance().Get(typeof(FieldPattern)); m_HeaderNamePattern = PatternFactory.GetInstance().Get(typeof(FieldNamePattern)); m_HeaderBodyPattern = PatternFactory.GetInstance().Get(typeof(FieldBodyPattern)); m_DataReader = new DataReader(); }
public LocalPartPattern() { IPattern wordPattern = PatternFactory.GetInstance().Get(typeof(WordPattern)); m_TextPattern = "(" + wordPattern.TextPattern + "(?:\x5C\x2E" + wordPattern.TextPattern + ")*)"; m_Regex = new Regex(m_TextPattern); }
public SubDomainPattern() { IPattern domainRefPattern = PatternFactory.GetInstance().Get(typeof(DomainRefPattern)); IPattern domainLiteralPattern = PatternFactory.GetInstance().Get(typeof(DomainLiteralPattern)); m_TextPattern = "(?:(" + domainRefPattern.TextPattern + "|" + domainLiteralPattern.TextPattern + "))"; m_Regex = new Regex(m_TextPattern); }
public MechanismPattern() { IPattern xtokenPattern = PatternFactory.GetInstance().Get(typeof(XTokenPattern)); m_TextPattern = "(?i)(7bit|8bit|binary|quoted-printable|base64|" + xtokenPattern.TextPattern + ")(?i)"; //or ief-token m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled); }
public void Creates_List_Of_Winning_Patterns_Based_On_Board_Size(int size, IEnumerable <string> expected) { var factory = new PatternFactory(); var patterns = factory.Create(size); patterns.Should().BeEquivalentTo(expected); }
public TimePattern() { IPattern hourPattern = PatternFactory.GetInstance().Get(typeof(HourPattern)); IPattern zonePattern = PatternFactory.GetInstance().Get(typeof(ZonePattern)); m_TextPattern = hourPattern.TextPattern + zonePattern.TextPattern; m_Regex = new Regex(m_TextPattern); }
public WordPattern() { IPattern atomPattern = PatternFactory.GetInstance().Get(typeof(AtomPattern)); IPattern quotedStringPattern = PatternFactory.GetInstance().Get(typeof(QuotedStringPattern)); m_TextPattern = "(" + atomPattern.TextPattern + "|" + quotedStringPattern.TextPattern + ")"; m_Regex = new Regex(m_TextPattern); }
public AddrSpecPattern() { IPattern localPartPattern = PatternFactory.GetInstance().Get(typeof(LocalPartPattern)); IPattern domainPattern = PatternFactory.GetInstance().Get(typeof(DomainPattern)); m_TextPattern = "(" + localPartPattern.TextPattern + "@" + domainPattern.TextPattern + ")"; m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled); }
public TypePattern() { IPattern descritePattern = PatternFactory.GetInstance().Get(typeof(DiscreteTypePattern)); IPattern compositePattern = PatternFactory.GetInstance().Get(typeof(CompositeTypePattern)); m_TextPattern = "(" + descritePattern.TextPattern + "|" + compositePattern.TextPattern + ")"; m_Regex = new Regex(m_TextPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase); }
private static IJudge GetJudge() { var context = new BoardProperties(); var positions = new PositionFactory().Create(context); var patternRepo = new PatternFactory().Create(); return(new PatternJudge(positions, patternRepo, new PatternMatcher(patternRepo))); }
public void Test_against_DataSet(TriStateMatrix input, MaskPatternType patternType, BitMatrix expected) { Pattern pattern = new PatternFactory().CreateByType(patternType); BitMatrix result = input.Apply(pattern, ErrorCorrectionLevel.H); expected.AssertEquals(result); }
public ParameterPattern() { IPattern tokenPattern = PatternFactory.GetInstance().Get(typeof(RFC822.Pattern.TokenPattern)); IPattern valuePattern = PatternFactory.GetInstance().Get(typeof(ValuePattern)); m_TextPattern = tokenPattern.TextPattern + "=" + valuePattern.TextPattern; m_Regex = new Regex(m_TextPattern); }
public void Before() { var networkFactory = new NetworkFactory(); var patternFactory = new PatternFactory(); var resultFactory = new ResultWeightFactory(); snapNetworkTask = networkFactory.CreateFrom("network.json"); patternsTask = patternFactory.CreateFrom("patterns.json"); }
internal static BitMatrix GetLowestPenaltyMatrix(this TriStateMatrix matrix, ErrorCorrectionLevel errorlevel) { PatternFactory patternFactory = new PatternFactory(); int score = int.MaxValue; int tempScore; TriStateMatrix result = new TriStateMatrix(matrix.Width); TriStateMatrix triMatrix; foreach(Pattern pattern in patternFactory.AllPatterns()) { triMatrix = matrix.Apply(pattern, errorlevel); tempScore = triMatrix.PenaltyScore(); if(tempScore < score) { score = tempScore; result = triMatrix; } } return result; }