using Newtonsoft.Json; using System.Text; public class CfgInfo { public int IntervalMinute; public string GitCMD; public string[] paths; } public static class Config { public static CfgInfo info; public static bool LoadConfig() { try { StreamReader sr = new StreamReader(System.Environment.CurrentDirectory + "//config.cfg", Encoding.Default); string cfgstr = sr.ReadToEnd(); sr.Close(); info = JsonConvert.DeserializeObject(cfgstr); return true; } catch (Exception ex) { Console.WriteLine("配置文件异常:" + ex.ToString()); return false; } } }