コード例 #1
0
 public void TestExpandHexChars()
 {
     Assert.AreEqual(" ", GlobalContext.ExpandHexChars("%20"));
     Assert.AreEqual("1 2", GlobalContext.ExpandHexChars("1%202"));
     Assert.AreEqual("637839:3b<3d>3f", GlobalContext.ExpandHexChars("%3637%3839%3a3b%3C3d%3e3f"));
 }
コード例 #2
0
ファイル: Projection.cs プロジェクト: hmmueller/Archichect
        /// <summary>
        /// Return projected string for some item.
        /// </summary>
        /// <param name="cachingGraph"></param>
        /// <param name="item">Iitem to be projected.</param>
        /// <param name="left">Item is on left side of dependency</param>
        /// <returns>Projected item; or <c>null</c> if item does not
        /// match projection</returns>
        public Item Match(WorkingGraph cachingGraph, [NotNull] Item item, bool left)
        {
            if (left && !_forLeftSide || !left && !_forRightSide)
            {
                return(null);
            }
            else
            {
                var matchResultGroups = ItemMatch.Matches(item);

                if (!matchResultGroups.Success)
                {
                    return(null);
                }
                else
                {
                    IEnumerable <string> targets = _targetSegments;
                    for (int i = 0; i < matchResultGroups.Groups.Length; i++)
                    {
                        int matchResultIndex = i;
                        targets = targets.Select(s => s.Replace("\\" + (matchResultIndex + 1), matchResultGroups.Groups[matchResultIndex]));
                    }
                    _matchCount++;
                    return(cachingGraph.CreateItem(_targetItemType, targets.Select(t => GlobalContext.ExpandHexChars(t)).ToArray()));
                }
            }
        }