/// <summary> /// 获取最新版本号(GitHub) /// </summary> /// <returns></returns> public Version GetVersionForGitHub() { var task = new Task <string>(() => HTTP.GETtoString("https://github.com/DNoki/NokiWorkConfiguration/blob/master/README.md").Result); task.Start(); var result = Regex.Match(task.Result, "\"NokiKanColle Version:.+?\"").Value; if (string.IsNullOrEmpty(result)) { throw new Exception("数据为空。"); } return(Version.Parse(Regex.Match(result, "[0-9.]+").Value)); }
///// <summary> ///// 将时间戳转化为DateTime ///// </summary> ///// <param name="timeStamp">时间戳(10位数)</param> ///// <returns>DateTime</returns> //public DateTime TimestampToTime(string timeStamp) //{ // DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // long lTime = long.Parse(timeStamp + "0000000"); // TimeSpan toNow = new TimeSpan(lTime); // return dtStart.Add(toNow); //} /// <summary> /// 获取最新版本号(简书) /// </summary> /// <returns></returns> public Version GetVersionForJianshu() { var task = new Task <string>(() => HTTP.GETtoString("https://www.jianshu.com/p/d2d10a83ca77").Result); task.Start(); var result = Regex.Match(task.Result, "-NokiKanColle Version:.+?-").Value; if (string.IsNullOrEmpty(result)) { throw new Exception("数据为空。"); } return(Version.Parse(Regex.Match(result, "[0-9.]+").Value)); }