[英]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.