Exemplo n.º 1
0
        public static PublishedNuget ReadFrom(string file)
        {
            var text = new FileSystem().ReadStringFromFile(file);

            var nuget = new PublishedNuget();

            findName(text, nuget);
            findDescription(text, nuget);

            return(nuget);
        }
Exemplo n.º 2
0
        private static void findName(string text, PublishedNuget nuget)
        {
            string openingTag = "<id>";
            string closingTag = "</id>";

            var start = text.IndexOf(openingTag);

            var end = text.IndexOf(closingTag);

            if (start > -1 && end > -1)
            {
                nuget.Name = text.Substring(start + openingTag.Length, end - start - openingTag.Length);
            }
        }
Exemplo n.º 3
0
        private static void findDescription(string text, PublishedNuget nuget)
        {
            string openingTag = "<description>";
            string closingTag = "</description>";

            var start = text.IndexOf(openingTag);

            var end = text.IndexOf(closingTag);

            if (start > -1 && end > -1)
            {
                nuget.Description = text.Substring(start + openingTag.Length, end - start - openingTag.Length);
            }
        }
Exemplo n.º 4
0
 protected bool Equals(PublishedNuget other)
 {
     return(string.Equals(Name, other.Name) && string.Equals(Description, other.Description));
 }