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