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); }
private bool IsLineARepositorFile(IWoWRepository repository, string line) { if (line.StartsWith(repository.GetBaseUrl())) { if (line.Substring(line.Length - 4, 1) == ".") { return(true); } } return(false); }
private bool IsLineARepositorFile(IWoWRepository repository, string line) { if (line.StartsWith(repository.GetBaseUrl())) { if (line.Substring(line.Length - 4, 1) == ".") { return true; } } return false; }