I'm writing a code to automatically download & install windows updates. (using "tlbimped" wuapi.dll and some sample code found over the Internet).
UpdateDownloader updateDownloader = Sesion.CreateUpdateDownloader();
updateDownloader.Updates = new UpdateCollection() { Item };
updateDownloader.BeginDownload(this, this, this);
And it's fine - i successfully can download and install update. But, i prefer to cache items, and do not download them if this item alredy exist in "special" folder. Google says, that i can use:
IUpdate.CopyFromCache(path, true);
But it doesn't work for me :(
Here is sample code
IUpdate Item { get; set; }
public UpdateSession Sesion { get; set; }
void CopyToFolder()
{
string path=Environment.CurrentDirectory + @"\Updates";
DirectoryInfo di = new DirectoryInfo(path);
if (!di.Exists) Directory.CreateDirectory(path);
Item.CopyFromCache(path, true);
}
Item is not null, is downloaded. Can be installed, but can't be copied to the specified path.