Beispiel #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);
        }
Beispiel #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);
            }
        }
Beispiel #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);
            }
        }
Beispiel #4
0
 protected bool Equals(PublishedNuget other)
 {
     return(string.Equals(Name, other.Name) && string.Equals(Description, other.Description));
 }