BrickLink samples
To load a BrickLink-style want list, use code like this:
var file = WantListFile.Load(fileName);
foreach (var item in file.Items)
{
Console.WriteLine(item.ItemNumber);
}
To create a new BrickLink-style want list, use code like this:
var item = new WantListItem(WantListItemType.Part, "3622", new WantListColorId(11));
var file = new WantListFile(new[] { item });
file.Save(fileName);
To update a BrickLink-style want list, use code like this:
var file = WantListFile.Load(fileName);
var newItems = new List<WantListItem>();
foreach (var item in file.Items)
{
if (item.ItemNumber != "3622")
newItems.Add(item);
else
newItems.Add(item.UpdateMinimimDesiredQuantity(item.MinimumDesiredQuantity+1));
}
var newFile = new WantListFile(newItems);
newFile.Save(fileName);