31 lines
726 B
C#
31 lines
726 B
C#
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<CfgInfo>(cfgstr);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine("配置文件异常:" + ex.ToString());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} |