Esempio n. 1
0
        public Block GetCorrespondingOriginalBlock(Block block)
        {
            if (!CorrelatedBlocks.Contains(block))
            {
                return(null);
            }
            var i       = CorrelatedBlocks.Where(b => b.GetText(true).Contains(block.GetText(true))).IndexOf(block);
            var matches = OriginalBlocks.Where(b => b.GetText(true).Contains(block.GetText(true))).ToList();

            if (matches.Count > i)
            {
                return(matches[i]);
            }
            Debug.Fail("Properly corresponding match not found in for block " + block.GetText(true));
            return(matches.FirstOrDefault());
        }
Esempio n. 2
0
        public Block GetCorrespondingOriginalBlock(Block block)
        {
            if (!CorrelatedBlocks.Contains(block))
            {
                return(null);
            }
            var i = CorrelatedBlocks.Where(b => b.GetText(true).Contains(block.GetText(true))).IndexOf(block);
            //var matches = OriginalBlocks.Where(b => b.GetText(true).IndexOf(block.GetText(true), StringComparison.Ordinal) >= 0).ToList();
            var matches = OriginalBlocks.Where(b => b.GetText(true).Contains(block.GetText(true))).ToList();

            if (matches.Count > i)
            {
                return(matches[i]);
            }
            // If we're in the middle of doing a split, there can be a few moments where the block cannot be found. Let's hope
            // this gets called again after the split is complete.
            Debug.WriteLine("Properly corresponding match not found in for block " + block.GetText(true));
            return(matches.FirstOrDefault());
        }