AddPackage() public method

public AddPackage ( SourcePackage package ) : void
package SourcePackage
return void
Example #1
0
 public static Source Read(string file)
 {
     try {
         var json = _fileReader(file);
         var data = JObject.Parse(json);
         var source = new Source(data["origin"].ToString(), file);
         data["packages"].Children().ToList()
                 .ForEach(x =>
                     source.AddPackage(
                         new SourcePackage(
                             x["id"].ToString(),
                             x["os"].Children().Select(y => y.ToString()).ToArray(),
                             x["version"].ToString(),
                             x["name"].ToString(),
                             x["description"].ToString(),
                             source.Base + x["package"].ToString())));
         return source;
     } catch {
         Logger.Write("Failed to read source package " + file);
     }
     return null;
 }
Example #2
0
 public static Source Read(string file)
 {
     try {
         var json   = _fileReader(file);
         var data   = JObject.Parse(json);
         var source = new Source(data["origin"].ToString(), file);
         data["packages"].Children().ToList()
         .ForEach(x =>
                  source.AddPackage(
                      new SourcePackage(
                          x["id"].ToString(),
                          x["os"].Children().Select(y => y.ToString()).ToArray(),
                          x["version"].ToString(),
                          x["name"].ToString(),
                          x["description"].ToString(),
                          source.Base + x["package"].ToString())));
         return(source);
     } catch {
         Logger.Write("Failed to read source package " + file);
     }
     return(null);
 }