Example #1
0
        public IRun DownloadRunByUri(Uri uri, bool patchRun)
        {
            var id          = uri.LocalPath;
            var downloadUri = GetSiteUri($"{id}/download/livesplit");

            var request = WebRequest.Create(downloadUri);

            using (var response = request.GetResponse())
                using (var stream = response.GetResponseStream())
                {
                    using (var memoryStream = new MemoryStream())
                    {
                        stream.CopyTo(memoryStream);
                        memoryStream.Seek(0, SeekOrigin.Begin);

                        var runFactory = new XMLRunFactory();

                        runFactory.Stream   = memoryStream;
                        runFactory.FilePath = null;

                        var run = runFactory.Create(new StandardComparisonGeneratorsFactory());
                        if (patchRun)
                        {
                            PatchRun(run, id);
                        }
                        return(run);
                    }
                }
        }
Example #2
0
        public IRun DownloadRunByUri(Uri uri)
        {
            var downloadUri = GetSiteUri(string.Format("{0}/download/livesplit", uri.LocalPath));

            var request = WebRequest.Create(downloadUri);

            using (var stream = request.GetResponse().GetResponseStream())
            {
                using (var memoryStream = new MemoryStream())
                {
                    stream.CopyTo(memoryStream);
                    memoryStream.Seek(0, SeekOrigin.Begin);

                    var runFactory = new XMLRunFactory();

                    runFactory.Stream   = memoryStream;
                    runFactory.FilePath = null;

                    return(runFactory.Create(new StandardComparisonGeneratorsFactory()));
                }
            }
        }