E
elfenliedtopfan2
Guest
ok so what i trying to do currently i have program that parses though a json file gets images depending on what the uses has selected but i want to automate it to download the largest images each foreachloop this is the part of the file
here is part i want to get stuff out of
all links in here with height and width
and this is the code i currently have witch works fine just dont know how to get it to pick the largest image and download
// start to grab textures
var jsonContent = File.ReadAllText(elfenliedprogsettings.Read("DOWNLOADPATH") + "\\textures.json");
var data = (JObject)JsonConvert.DeserializeObject(jsonContent);
var texturesNodeKey = "/i/models/" + texturemodel + "/textures?optimized=1";
var images = new Dictionary<string, string>();
foreach (var resultNode in data[texturesNodeKey]["results"])
{
var name = resultNode["name"].ToObject<string>();
Name = name;
foreach (var imageNode in resultNode["images"])
{
var height = imageNode["height"].ToObject<string>();
var width = imageNode["width"].ToObject<string>();
var url = imageNode["url"].ToObject<string>();
Url = url;
if (Sachiko_Res.sizecheck == true)
{
if(height == Sachiko_Res.height && width == Sachiko_Res.width)
{
downloadAsync();
}
//elfenliedtopfan5();
//images.Add(name,url);
}
else
{
if(Sachiko_Res.sizecheck == false)
{
if (height != Sachiko_Res.height && width != Sachiko_Res.width)
{
downloadAsync();
}
}
}
}
}
the size check was to see if they match like 2048 x 2048 because some dont this works it downloads the ones maching this but misses some out i only want the ones that are large and in this part like all images that are 2048 if thats the largest in that image path some dont match but want them anyway
just dont want the 64x64 because they are just thumbnails just want the biggest in the list of each entry and then download one by one i have the program working its just trying to get it to pick only the largest size of the list so say
thompson_AO
that would have loads of links in there with width and height i want to get largest one download go onto next one and do the same over and over to its compleate resulting in the largest image for each texture name.
thank you in advance elfenliedtopfan5
Continue reading...
here is part i want to get stuff out of
all links in here with height and width
and this is the code i currently have witch works fine just dont know how to get it to pick the largest image and download
// start to grab textures
var jsonContent = File.ReadAllText(elfenliedprogsettings.Read("DOWNLOADPATH") + "\\textures.json");
var data = (JObject)JsonConvert.DeserializeObject(jsonContent);
var texturesNodeKey = "/i/models/" + texturemodel + "/textures?optimized=1";
var images = new Dictionary<string, string>();
foreach (var resultNode in data[texturesNodeKey]["results"])
{
var name = resultNode["name"].ToObject<string>();
Name = name;
foreach (var imageNode in resultNode["images"])
{
var height = imageNode["height"].ToObject<string>();
var width = imageNode["width"].ToObject<string>();
var url = imageNode["url"].ToObject<string>();
Url = url;
if (Sachiko_Res.sizecheck == true)
{
if(height == Sachiko_Res.height && width == Sachiko_Res.width)
{
downloadAsync();
}
//elfenliedtopfan5();
//images.Add(name,url);
}
else
{
if(Sachiko_Res.sizecheck == false)
{
if (height != Sachiko_Res.height && width != Sachiko_Res.width)
{
downloadAsync();
}
}
}
}
}
the size check was to see if they match like 2048 x 2048 because some dont this works it downloads the ones maching this but misses some out i only want the ones that are large and in this part like all images that are 2048 if thats the largest in that image path some dont match but want them anyway
just dont want the 64x64 because they are just thumbnails just want the biggest in the list of each entry and then download one by one i have the program working its just trying to get it to pick only the largest size of the list so say
thompson_AO
that would have loads of links in there with width and height i want to get largest one download go onto next one and do the same over and over to its compleate resulting in the largest image for each texture name.
thank you in advance elfenliedtopfan5
Continue reading...