123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.IO;
- namespace CB.LotteryCatchData.Entity
- {
- /// <summary>
- /// 彩种配置信息
- /// </summary>
- public class LotteryConfigInfo
- {
- /// <summary>
- /// 彩票名称
- /// </summary>
- public string Name { get; set; }
- /// <summary>
- /// 临时配置存放路劲
- /// </summary>
- public string Path { get; set; }
- /// <summary>
- /// 数据抓取地址
- /// </summary>
- public string DataUrl { get; set; }
- /// <summary>
- /// HTTP请求超时时间
- /// </summary>
- public int TimeOut { get; set; }
- /// <summary>
- /// 周期内起始开奖时间格式
- /// </summary>
- public string OpenTimeFomart { get; set; }
- /// <summary>
- /// 周期内起始时间
- /// </summary>
- public TimeSpan StartTime { get; set; }
- /// <summary>
- /// 开奖频率、开奖周期(分钟)
- /// </summary>
- public int OpenPeriod { get; set; }
- /// <summary>
- /// 周期内结束时间
- /// </summary>
- public TimeSpan EndTime { get; set; }
- /// <summary>
- /// 实现彩种数据抓取ICatchDataProvider接口的类类型
- /// </summary>
- public string CatchDataProvider { get; set; }
- /// <summary>
- /// 序列化xml
- /// </summary>
- /// <returns></returns>
- public override string ToString()
- {
- return string.Format("<Lottery Name=\"{0}\" Path=\"{1}\" TimeOut=\"{2}\" OpenTimeFomart=\"{3}\" StartTime=\"{4}\" OpenPeriod=\"{5}\" EndTime=\"{6}\" CatchDataProvider=\"{7}\">{8}</Lottery>",
- this.Name, this.Path, this.TimeOut, this.OpenTimeFomart, this.StartTime, this.OpenPeriod, this.EndTime, this.CatchDataProvider, this.DataUrl);
- }
- /// <summary>
- /// 获取临时配置文件路劲
- /// </summary>
- /// <returns></returns>
- public string GetParamKeyPath()
- {
- if (string.IsNullOrEmpty(this.Path))
- throw new FileNotFoundException("请设置Config\\CatchDataConfig.xml配置文件对应【" + this.Name + "】彩种的Path属性值");
- string path = AppDomain.CurrentDomain.BaseDirectory + "Config\\" + this.Path + "\\";
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- return path + "tmpDataConfig";
- }
- }
- }
|