Ejemplo n.º 1
0
        /// <summary>
        /// Downloads and returns patch list.
        /// </summary>
        /// <param name="uri"></param>
        /// <returns></returns>
        private PatchList GetPatchList(string uri)
        {
            var patchListFileName = Path.GetFileName(uri);

            var wc = new WebClient();

            wc.DownloadFile(uri, patchListFileName);

            var patchList = new PatchList();

            using (var fr = new FileReader(patchListFileName))
            {
                foreach (var line in fr)
                {
                    var index    = line.Value.IndexOf(" ");
                    var version  = Convert.ToInt32(line.Value.Substring(0, index).Trim());
                    var fileName = line.Value.Substring(index + 1).Trim();

                    var patchFile = new PatchFile(version, fileName);

                    patchList.RemoveAll(a => a.Version == version);
                    patchList.Add(patchFile);
                }
            }

            return(patchList);
        }