C#远程读取txt配置文件
C#远程读取txt配置⽂件
//SDK AppID
public static int appid;
//App Key
public static string appkey;
//模板Id
public static int tmplId;
//phone
神话主题歌
public static string phone;
//1、定义数组,来⽤接收txt⾥的内容
public static Dictionary<string, string> dic = new Dictionary<string, string>();
//2、读取远程txt配置⽂件的⽂件
public static void getMySet()
{
//读取⽹络上的txt⽂件
WebClient client = new WebClient();
byte[] buffer = client.DownloadData("域名/");
string res = System.Text.ASCIIEncoding.ASCII.GetString(buffer);
string[] items = res.Split(',');//⽤逗号来分割内容
for (int i = 0; i < items.Length; i++)
{
string str = items[i].Replace("\r\n", "");把衣服抖动几下
string a1 = str.Substring(0, str.IndexOf("="));
string a2 = str.Substring(str.IndexOf("=") + 1);
dic.Add(a1, a2);
}
//设置参数
if(dic.ContainsKey("appid")) //先判断是否存在这个key
{
appid = Convert.ToInt32(dic["appid"]);
}
if (dic.ContainsKey("appkey"))古代陆上丝绸之路的起点是哪个城市
{
appkey = dic["appkey"];
}
小米怎么投屏
if (dic.ContainsKey("tmplId"))
qq关闭图标{
事业单位年度考核个人总结
tmplId = Convert.ToInt32(dic["tmplId"]);
}
if (dic.ContainsKey("phone"))
{
phone = dic["phone"];
}
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。