本文整理匯總了C#中Catalog.SetUrl方法的典型用法代碼示例。如果您正苦於以下問題:C# Catalog.SetUrl方法的具體用法?C# Catalog.SetUrl怎麽用?C# Catalog.SetUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Catalog
的用法示例。
在下文中一共展示了Catalog.SetUrl方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CheckOrUpdateCatalog
void CheckOrUpdateCatalog()
{
var progress = Log.Action(2, "Checking and/or updating catalog...");
var books = new BookSource { Log = Log };
var volumes = new VolumeSource { Log = Log };
if (!string.IsNullOrEmpty(ActualDirectory)) {
books.SetDirectory(ActualDirectory);
volumes.SetDirectory(ActualDirectory);
}
var updater = new CatalogUpdater { Log = Log };
Date localDate = Date.MinValue;
if (Always || updater.ShouldUpdate(books, volumes, out localDate)) {
progress.Continue("Downloading remote catalog...");
var catalog = new Catalog { Log = Log };
if (!string.IsNullOrEmpty(URL))
catalog.SetUrl(URL);
using (var stream = catalog.Open())
updater.TryUpdate(stream, books, volumes,
remoteDate => localDate == Date.MinValue || localDate < remoteDate,
() => ShouldProcess("Catalog", "Update") && (Force ||
ShouldContinue("Do you really want to update the local catalog?",
"Catalog Update")));
}
progress.Finish();
}