示例#1
0
 public string ini_mode()  //
 {
     using (FileStream fs = new FileStream("setting.json", FileMode.Open))
     {
         using (StreamReader sr = new StreamReader(fs))
         {
             SetHost m      = JsonConvert.DeserializeObject <SetHost>(sr.ReadLine());
             string  result = m.mode;
             return(result);
         }
     }
 }
示例#2
0
        public string write_url_json(string mode, string host)  //
        {
            using (FileStream fs = new FileStream("setting.json", FileMode.Create))
            {
                using (StreamWriter writer = new StreamWriter(fs))
                {
                    SetHost sh = new SetHost();
                    sh.mode   = mode;
                    sh.host   = host;
                    sh.client = GetMyIp();

                    string str = JsonConvert.SerializeObject(sh);
                    writer.WriteLine(str);
                    return(string.Empty);
                }
            }
        }