示例#1
0
 public static async Task <List <ScriptInfo> > GetScripts(ScriptRepo repo)
 {
     using (RBotWebClient wc = new RBotWebClient())
     {
         return(JsonConvert.DeserializeObject <List <ScriptInfo> >(await wc.DownloadStringTaskAsync(repo.ContentsUrl)).Where(x => x.FileName.EndsWith(".cs") && (x.Parent = repo) != null).ToList());
     }
 }
示例#2
0
 public static async Task <List <ScriptRepo> > GetRepos()
 {
     using RBotWebClient wc = new RBotWebClient();
     return((await wc.DownloadStringTaskAsync(BaseUrl)).Split('\n').Select(l => l.Trim().Split('|')).Where(p => p.Length == 4).Select(p => new ScriptRepo()
     {
         Username = p[0],
         Name = p[1],
         Extension = p[2],
         Author = p[3]
     }).ToList());
 }
示例#3
0
        public static async Task <List <WikiItem> > FindMethods(string url)
        {
            using (RBotWebClient wc = new RBotWebClient())
            {
                string html = await wc.DownloadStringTaskAsync(url);

                string          stripped = Regex.Replace(html, "(?!<a.*>|<\\/a>)(<.*?>)|((?! )\\s)", string.Empty);
                List <WikiItem> methods  = new List <WikiItem>();
                Regex           shop     = new Regex(ShopRegex, RegexOptions.IgnoreCase);
                Match           match    = shop.Match(html);
                if (match.Success)
                {
                    methods.Add(new ShopReference()
                    {
                        Url   = match.Groups[1].Value,
                        Name  = match.Groups[2].Value,
                        Price = int.TryParse(match.Groups[3].Value.Replace(",", ""), out int i) ? i : 0,
                        Coins = match.Groups[4].Value == "AC"
                    });
示例#4
0
 public static async Task <List <UpdateInfo> > GetReleases()
 {
     using (RBotWebClient wc = new RBotWebClient())
         return(JsonConvert.DeserializeObject <List <UpdateInfo> >(await wc.DownloadStringTaskAsync(ApiUrl)));
 }