【发布时间】:2021-08-25 07:51:43
【问题描述】:
我想从 here 获取值并在我的 c# 控制台应用程序中使用它们。我已经知道如何将所有这些写入一个单独的文件,但我不知道如何从文件/url 中读取值。
欢迎任何帮助!
【问题讨论】:
我想从 here 获取值并在我的 c# 控制台应用程序中使用它们。我已经知道如何将所有这些写入一个单独的文件,但我不知道如何从文件/url 中读取值。
欢迎任何帮助!
【问题讨论】:
我为你工作,希望你能欣赏它:)
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Web;
到空旷的地方
string reply, filter_reply;
代码:
void DownloadString(string address)
{
WebClient client = new WebClient();
reply = client.DownloadString(address);
filter_reply = reply
.Replace("using System;","")
.Replace("namespace hazedumper","")
.Replace("public static class netvars", "")
.Replace("public static class netvars", "")
.Replace("public const Int32", "")
.Replace("{", "")
.Replace("}", "")
.Replace("//", "")
.Replace("public static class signatures", "")
.Replace("timestamp = 1622802437;", "")
.Replace("2021-06-04 10:27:17.675243800 UTC", "")
.Replace("// namespace hazedumper", "")
.Replace("public const Int32 timestamp = 1622802437;","")
.Replace(" ", "")
.Replace("\n", "");
}
private static Dictionary<string, string> _extractDictionary(string str)
{
return Regex.Matches(str, "([^?=;]+)(=([^;]*))?").Cast<Match>().ToDictionary(x => x.Groups[1].Value, x => HttpUtility.UrlDecode(x.Groups[3].Value));
}
用法:
try
{
DownloadString("https://raw.githubusercontent.com/frk1/hazedumper/master/csgo.cs");
var dic = _extractDictionary(filter_reply);
foreach (var key_value in dic)
{
var key = key_value.Key;
var value = key_value.Value;
Console.WriteLine("Value of {0} is {1}", key, value);
}
}
catch (Exception ex)
{
}
【讨论】: