Beispiel #1
0
 /// <summary>
 /// For loading from a repository
 /// </summary>
 /// <param name="node"></param>
 public Mod(XmlNode node)
 {
     Name        = node.Attributes["name"].Value;
     Version     = node.Attributes["version"].Value;
     KSPVersion  = new VersionMatcher(node.Attributes["kspversion"].Value);
     Description = node.Attributes["description"].Value;
     URL         = node.Attributes["url"].Value;
     Author      = node.Attributes["author"].Value;
     Thread      = node.Attributes["thread"].Value;
     ImageURLs   = new List <string>();
     foreach (XmlNode imgnode in node.ChildNodes)
     {
         if (imgnode.NodeType == XmlNodeType.Element)
         {
             if (imgnode.Name.Equals("thumb"))
             {
                 ImageURLs.Add(imgnode.Value);
             }
             if (imgnode.Name.Equals("file"))
             {
                 Files.Add(imgnode.Value);
             }
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// For loading from a repository
 /// </summary>
 /// <param name="node"></param>
 public Mod(XmlNode node)
 {
     Name = node.Attributes["name"].Value;
     Version = node.Attributes["version"].Value;
     KSPVersion = new VersionMatcher(node.Attributes["kspversion"].Value);
     Description = node.Attributes["description"].Value;
     URL = node.Attributes["url"].Value;
     Author = node.Attributes["author"].Value;
     Thread = node.Attributes["thread"].Value;
     ImageURLs = new List<string>();
     foreach (XmlNode imgnode in node.ChildNodes)
     {
         if(imgnode.NodeType == XmlNodeType.Element)
         {
             if (imgnode.Name.Equals("thumb"))
             {
                 ImageURLs.Add(imgnode.Value);
             }
             if (imgnode.Name.Equals("file"))
             {
                 Files.Add(imgnode.Value);
             }
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// For loading a mod metadata file
 /// </summary>
 /// <param name="mod_data"></param>
 public Mod(string mod_data)
 {
     /*
      * Mission Aeronautics
      * by N3X15
      * Version: 0.0.1
      * URL: http://ci.nexisonline.net/mirror/kerbal/MissionPack0.0.1.zip
      * Requires KSP 0.13.0 to 0.13.1
      * Description: Blah blah blah
      * Thumbnails: http... http...
      * Thread: http...
      */
     foreach (string line in mod_data.Split('\n'))
     {
         if (line.Contains(":") && handleColon(line))
         {
             ;
         }
         else if (line.StartsWith("by "))
         {
             Author = line.Remove(0, 3).Trim();
         }
         else if (line.StartsWith("Requires KSP "))
         {
             KSPVersion = new VersionMatcher(line.Remove(0, 13).Trim());
         }
         else
         {
             Name = line.Trim();
         }
     }
 }
Beispiel #4
0
 /// <summary>
 /// For loading a mod metadata file
 /// </summary>
 /// <param name="mod_data"></param>
 public Mod(string mod_data)
 {
     /*
      * Mission Aeronautics
      * by N3X15
      * Version: 0.0.1
      * URL: http://ci.nexisonline.net/mirror/kerbal/MissionPack0.0.1.zip
      * Requires KSP 0.13.0 to 0.13.1
      * Description: Blah blah blah
      * Thumbnails: http... http...
      * Thread: http...
      */
     foreach (string line in mod_data.Split('\n'))
     {
         if (line.Contains(":") && handleColon(line))
         {
             ;
         }
         else if (line.StartsWith("by "))
         {
             Author = line.Remove(0, 3).Trim();
         }
         else if (line.StartsWith("Requires KSP "))
         {
             KSPVersion = new VersionMatcher(line.Remove(0, 13).Trim());
         }
         else
         {
             Name = line.Trim();
         }
     }
 }