public static ManifestFile FromRepository(IWoWRepository repository)
        {
            try
            {
                var manifest = new ManifestFile();
                var client = new WebClient();

                string content = client.DownloadString(repository.GetBaseUrl() + repository.GetMFilName());

                string[] lines = content.Split('\n');

                foreach (string line in lines)
                {
                    if (line.Trim().StartsWith("version="))
                    {
                        int output;
                        if (int.TryParse(line.Trim().Replace("version=", ""), out output))
                        {
                            manifest.Version = output;
                        }
                    }
                    manifest.Lines.Add(line.Trim().Replace("file=", repository.GetBaseUrl()));
                }

                return manifest;
            }
            catch (Exception ex)
            {
                Program.Log("Unable to retrieve Manifest file", ConsoleColor.Red);
                Program.Log(ex.Message, ConsoleColor.Red);
            }
            return null;
        }
        public static ManifestFile FromRepository(IWoWRepository repository)
        {
            try
            {
                var manifest = new ManifestFile();
                var client   = new WebClient();

                string content = client.DownloadString(repository.GetBaseUrl() + repository.GetMFilName());

                string[] lines = content.Split('\n');

                foreach (string line in lines)
                {
                    if (line.Trim().StartsWith("version="))
                    {
                        int output;
                        if (int.TryParse(line.Trim().Replace("version=", ""), out output))
                        {
                            manifest.Version = output;
                        }
                    }
                    manifest.Lines.Add(line.Trim().Replace("file=", repository.GetBaseUrl()));
                }

                return(manifest);
            }
            catch (Exception ex)
            {
                Program.Log("Unable to retrieve Manifest file", ConsoleColor.Red);
                Program.Log(ex.Message, ConsoleColor.Red);
            }
            return(null);
        }
예제 #3
0
        private static void EntryPointNewSession()
        {
            IWoWRepository repository = UserInputs.SelectRepository();
            ManifestFile   manifest   = ManifestFile.FromRepository(repository);
            string         locale     = UserInputs.SelectLocale(manifest);
            string         os         = UserInputs.SelectOs();

            CurrentSession = new Session(repository.GetMFilName(), locale, os);
            CurrentSession.SaveSession();

            StartProcess(manifest);
        }