public AssetStoreContext.PackageList GetPackageList()
{
Dictionary <string, AssetStoreContext.Package> dictionary = new Dictionary <string, AssetStoreContext.Package>();
foreach (PackageInfo package1 in PackageInfo.GetPackageList())
{
AssetStoreContext.Package package2 = new AssetStoreContext.Package();
if (package1.jsonInfo == string.Empty)
{
package2.title = Path.GetFileNameWithoutExtension(package1.packagePath);
package2.id = package1.packagePath;
if (this.IsBuiltinStandardAsset(package1.packagePath))
{
package2.publisher = new AssetStoreContext.LabelAndId()
{
label = "Unity Technologies",
id = "1"
};
package2.category = new AssetStoreContext.LabelAndId()
{
label = "Prefab Packages",
id = "4"
};
package2.version = "3.5.0.0";
}
}
else
{
JSONValue json = JSONParser.SimpleParse(package1.jsonInfo);
if (!json.IsNull())
{
package2.Initialize(json);
if (package2.id == null)
{
JSONValue jsonValue = json.Get("link.id");
package2.id = jsonValue.IsNull() ? package1.packagePath : jsonValue.AsString();
}
}
else
{
continue;
}
}
package2.local_icon = package1.iconURL;
package2.local_path = package1.packagePath;
if (!dictionary.ContainsKey(package2.id) || dictionary[package2.id].version_id == null || dictionary[package2.id].version_id == "-1" || package2.version_id != null && package2.version_id != "-1" && int.Parse(dictionary[package2.id].version_id) <= int.Parse(package2.version_id))
{
dictionary[package2.id] = package2;
}
}
AssetStoreContext.Package[] array = dictionary.Values.ToArray <AssetStoreContext.Package>();
return(new AssetStoreContext.PackageList()
{
results = array
});
}