本文整理汇总了C#中IStorage.LoadString方法的典型用法代码示例。如果您正苦于以下问题:C# IStorage.LoadString方法的具体用法?C# IStorage.LoadString怎么用?C# IStorage.LoadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStorage
的用法示例。
在下文中一共展示了IStorage.LoadString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadCatalogItem
static async Task<IGraph> LoadCatalogItem(IStorage storage, Uri itemUri, CancellationToken cancellationToken)
{
string json = await storage.LoadString(itemUri, cancellationToken);
IGraph graph = Utils.CreateGraph(json);
return graph;
}
示例2: LoadAsync
public override async Task LoadAsync(Uri address, IStorage storage, CancellationToken cancellationToken)
{
string json = await storage.LoadString(address, cancellationToken);
// If this is the first time we're running the crawler, there won't be any file to load.
if (json == null)
{
Trace.TraceInformation("No package catalog to load.");
return;
}
PackageCatalog item = JsonConvert.DeserializeObject<PackageCatalog>(json);
this.Catalog = item.Catalog;
this.LastUpdated = item.LastUpdated;
if (item.Packages != null)
{
this.Packages = item.Packages;
}
}
示例3: LoadCatalog
static async Task<IGraph> LoadCatalog(IStorage storage, Uri resourceUri, CancellationToken cancellationToken)
{
Trace.TraceInformation("RegistrationPersistence.LoadCatalog: resourceUri = {0}", resourceUri);
string json = await storage.LoadString(resourceUri, cancellationToken);
IGraph graph = Utils.CreateGraph(json);
if (graph == null)
{
return new Graph();
}
IEnumerable<Triple> pages = graph.GetTriplesWithPredicateObject(graph.CreateUriNode(Schema.Predicates.Type), graph.CreateUriNode(Schema.DataTypes.CatalogPage));
IList<Task<IGraph>> tasks = new List<Task<IGraph>>();
foreach (Triple page in pages)
{
Uri pageUri = ((IUriNode)page.Subject).Uri;
// note that this is explicit Uri comparison and deliberately ignores differences in the fragment
if (pageUri != resourceUri)
{
tasks.Add(LoadCatalogPage(storage, pageUri, cancellationToken));
}
}
await Task.WhenAll(tasks.ToArray());
foreach (Task<IGraph> task in tasks)
{
graph.Merge(task.Result, false);
}
await LoadCatalogItems(storage, graph, cancellationToken);
return graph;
}
示例4: LoadCatalogPage
static async Task<IGraph> LoadCatalogPage(IStorage storage, Uri pageUri, CancellationToken cancellationToken)
{
Trace.TraceInformation("RegistrationPersistence.LoadCatalogPage: pageUri = {0}", pageUri);
string json = await storage.LoadString(pageUri, cancellationToken);
IGraph graph = Utils.CreateGraph(json);
return graph;
}