Exemplo n.º 1
0
        public void ParseAndFormat([ValueSource(nameof(Samples))] string name)
        {
            var source = Load(name);
            var match  = Splitter.Match(source);

            Assert.That(match.Success, Is.True);

            var group = match.Groups["splitter"];
            var blob  = BinaryProcessor.Parse(source.AsSpan(0, group.Index));

            MethodData data;

            if (name.StartsWith("Body.", StringComparison.InvariantCulture))
            {
                data = MethodParser.ParseBody(blob);
            }
            else if (name.StartsWith("IL.", StringComparison.InvariantCulture))
            {
                data = MethodParser.ParseIL(blob);
            }
            else
            {
                throw new ArgumentException();
            }

            var actual   = MethodFormatter.Format(data);
            var expected = source.Substring(group.Index + group.Length);

            Assert.That(actual, Is.EqualTo(expected));
        }
Exemplo n.º 2
0
        public void FormatTest()
        {
            System.Reflection.MethodInfo methodInfo = default;

            string actual = MethodFormatter.Format(methodInfo);

            string expected = default;

            Assert.That(actual, Is.EqualTo(expected));
            Assert.Fail("autogenerated");
        }
Exemplo n.º 3
0
        void DoRun()
        {
            var buffer = BinaryProcessor.Parse(BytesTextBox.Text.AsSpan());

            if (buffer != null)
            {
                BytesTextBox.Text = BinaryProcessor.Format(buffer);

                var data = Parse(buffer);

                if (data != null)
                {
                    ILTextBox.Text = MethodFormatter.Format(data);
                }
            }
        }
Exemplo n.º 4
0
        void DoRun()
        {
            var buffer = BinaryProcessor.Parse(BytesTextBox.Text.AsSpan());

            if (buffer != null)
            {
                BytesTextBox.Text = BinaryProcessor.Format(buffer);

                var data = Parse(buffer);

                if (data != null)
                {
                    var sectioned = ShowSectioned.IsChecked ?? false;
                    ILTextBox.Text = MethodFormatter.Format(data, sectioned);
                }
            }
        }