简体   繁体   English

是否可以在后端编写 C# 代码并将结果发送回 dart?

[英]It it possible to write C# code in backend and send results back to dart?

Hi so I am making a website for an esport organisation.嗨,我正在为一个电子竞技组织制作一个网站。 They want players to upload their Fortnite Replay file (.replay) and get stats from it.他们希望玩家上传他们的 Fortnite 重播文件 (.replay) 并从中获取统计数据。

I've found this C# library (also in python) that can read those files and extract stats: https://github.com/Shiqan/FortniteReplayDecompressor我发现这个 C# 库(也在 python 中)可以读取这些文件并提取统计信息: https://github.com/Shiqan/FortniteReplayDecompressor

Since there's no dart package for doing that, I don't really know how to do that.由于没有 dart package 可以做到这一点,我真的不知道该怎么做。

In other words, how to use C# as a backend for flutter?换句话说,如何使用 C# 作为 flutter 的后端? How to upload a file, do something with it in C# or python and then return extracted stats from it?如何上传文件,在 C# 或 python 中对其进行处理,然后从中返回提取的统计信息?

Thank you.谢谢你。

Dart's Process class allows you to execute an external command and optionally retrieve those results: Dart 的Process class 允许您执行外部命令并可选择检索这些结果:

import 'dart:io';

main() {
  // List all files in the current directory in UNIX-like systems.
  Process.run('ls', ['-l']).then((ProcessResult results) {
    print(results.stdout);
  });
}

So in your case, rather than executing ls like the code above, you could write a simple program in C# or Python using the library you mentioned, and have it print the results to the console in some structured format.因此,在您的情况下,您可以使用您提到的库在 C# 或 Python 中编写一个简单的程序,而不是像上面的代码那样执行ls ,并让它以某种结构化格式将结果打印到控制台。

Then you use the Process class to run that command, read the results, then parse and display them.然后使用 Process class 运行该命令,读取结果,然后解析并显示它们。

See the documentation of the Process class for more details.有关详细信息,请参阅过程 class的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发回后端更改的数据 - Send back data changed on backend 可以将 Excel 选项卡读入代码并用格式写回相同的选项卡 - Possible to Read Excel Tab into Code and Write Back that Same Tab With Formatting 用RabbitMQ接收消息然后处理它然后发回结果 - Receive a message with RabbitMQ then process it then send back the results 是否可以通过命令提示符从C#运行python代码? - Is this possible to run a python code from C# through command prompt? 有没有办法在后端服务器中使用 plot 和 plotly 图表,并在网络应用程序上发送交互式结果? - Is there a way to plot a plotly chart in a backend server, and to send the interactive results on a webapp? 后端python代码发送电子邮件并在发送请求的页面上打印消息 - backend python code to send an email and print a message on the page that send the request 使用最少的代码将结果写入文件 - Write results to file using the least amount of code 将值从c ++发送回python - Send value back from c++ to python 云 Function http - 实时发回结果 - Cloud Function http - send back results live as they arrive 编码json并将其发送到Objective C的后端的正确方法是什么? - What is the correct way to encode a json and send it to the backend in Objective C?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM