コード例 #1
0
        private void CreateProxy(Block block, int[] map)
        {
            var sections = block.Sections;

            for (int i = 0; i < sections.Length; i++)
            {
                // Current section
                var section = sections[i];
                var proxy   = new SectionProxy();
                section.Proxy1 = proxy;

                // Target section
                var section2 = sections[map[i]];
                var proxy2   = new SectionProxy();
                section2.Proxy2 = proxy2;
                var section2Label = new ILLabel();
                section2.CodeNode.AddNext(section2Label);

                int value = _random.Next(3, 7);
                var node  = section.ProxyNode.AddNext(Instruction.GetLdc(value));

                proxy.Node  = node;
                proxy2.Node = node;

                if (_random.NextBool())
                {
                    node            = node.AddNext(OpCodes.Bgt, section2Label);
                    proxy.MinValue  = 1;
                    proxy.MaxValue  = value;
                    proxy2.MinValue = value + 1;
                    proxy2.MaxValue = 8;
                }
                else
                {
                    node            = node.AddNext(OpCodes.Blt, section2Label);
                    proxy.MinValue  = value + 1;
                    proxy.MaxValue  = 8;
                    proxy2.MinValue = 1;
                    proxy2.MaxValue = value;
                }
            }
        }
コード例 #2
0
 public virtual void VisitSectionStart(SectionProxy section)
 {
 }
コード例 #3
0
 public virtual void VisitSectionEnd(SectionProxy section)
 {
 }