示例#1
0
 //TODO:
 //public override Zhilian ReadConfig(string json)
 //{
 //    api = JObject.Parse(json).ToObject<APIData>();
 //    return this;
 //}
 public Zhilian ReadConfigFromFile(string path)
 {
     using (StreamReader reader = new StreamReader(path))
     {
         api = JObject.Parse(reader.ReadToEnd()).ToObject <APIData>();
     }
     return(this);
 }
示例#2
0
        public Zhilian()
        {
            logger = Log.Init();
            logger.Common("Zhilian Web Spider Init...", logFile);
            if (File.Exists(ConfigPath))
            {
                logger.Common($"Read Config From {ConfigPath}", logFile);
                api = ReadConfig <APIData>(ConfigPath);
            }
            else
            {
                api = new APIData();
            }

            EmploymentTypeDic = GetBasicInfo(Environment.CurrentDirectory + "\\Data\\Zhilian.employment_type.json");
            JobTypeParentDic  = GetBasicInfo(Environment.CurrentDirectory + "\\Data\\Zhilian.job_type_parent.json");
            RegionCodeDic     = GetBasicInfo(Environment.CurrentDirectory + "\\Data\\Zhilian.region_relation.json");
            EducationDic      = GetBasicInfo(Environment.CurrentDirectory + "\\Data\\Zhilian.education.json");
        }