我正在使用 Reprise RLM 许可证管理器研究 Internet 激活。我不知道如何使用 C# 将许可证文件从网络服务器获取到文本文件中(我对 C# 也很陌生)。
RLM 附带了一个 C++ 示例,但我无法翻译它。
我的代码(用于演示)如下所示:
int stat = RLM.rlm_act_request(handle, "http://www.reprisesoftware.com", "rlmactdemo", activationKey, "", "", 1, "", new byte[RLM.RLM_MAX_LINE+1]);
if (stat == 0||stat == 1){
//Successful connection
//Read license file and write to local machine
}
rlm_act_request
建立并验证连接。建立后,如何访问该文件并将其写入本地文件?
该 if 语句中的任何内容的 C++ 代码如下:
char name[100];
char license[100];
int try;
FILE *f, *fopen();
stat = 1;
for (try=0; try<100; try++)
{
sprintf(name, "a%d.lic", try);
f = fopen(name, "r");
if (f == (FILE *) NULL)
{
f = fopen(name, "w");
if (f)
{
fprintf(f, "%s\n", license);
fclose(f);
break;
}
else
{
printf("Error writing license file \"%s\"\n", name);
stat = -1;
break;
}
}
}
什么是 C# 等价物?