示例#1
0
        /// <inheritdoc />
        public void GetMethod(out MethodInfoDto methodInfo, out Action method)
        {
            while (true)
            {
                var fullAddress = cs[eip];
                if (fullAddress == 0)
                {
                    throw new InvalidOperationException("Запрос метода по нулевому указателю.");
                }

                var info = FindExactMethod(fullAddress);
                if (info != null)
                {
                    methodInfo = info.MethodInfo;
                    method     = info.Action;
                    return;
                }

                // Всё-таки декодируем.
                var files = DecodeCurrentMethod();

                // Compile and load.
                try
                {
                    NonBlockingConsole.WriteLine($"Компилирование новых методов.");
                    var dllPath = Compile(files);

                    NonBlockingConsole.WriteLine($"Загрузка '{dllPath}'.");
                    var assembly = Assembly.LoadFile(dllPath);

                    DefinitionCollection.AddDefinitionsFromAssembly(assembly);
                    ConnectDecodedMethods(assembly);
                }
                catch (Exception ex)
                {
                    NonBlockingConsole.WriteLine(ex);
                    throw;
                }
            }

            //throw new InvalidOperationException("Метод не найдена.");
        }
示例#2
0
        public async Task SendJsonAsyncWithDumpTest()
        {
            var data = new MethodInfoDto
            {
                Name         = "name",
                TypeFullName = "fullname"
            };

            IJsonLogger logger = new NUnitJsonLogger(SyncHandler.Instance);

            using (HostUtils.HostController <TestFlurlController>("http://localhost:5062"))
            {
                string response = await new Url("http://localhost:5062")
                                  .AppendPathSegment("Flurl")
                                  .WithDump(logger)
                                  .PostJsonAsync(data)
                                  .ReceiveString();

                var responseData = JsonConvert.DeserializeObject <MethodInfoDto>(response);
                responseData.Should().NotBeNull();
                responseData.Name.Should().Be(data.Name);
                responseData.TypeFullName.Should().Be(data.TypeFullName);
            }
        }
示例#3
0
 public string Post([FromBody] MethodInfoDto data)
 {
     return(JsonConvert.SerializeObject(data));
 }