当前位置: 首页>>代码示例>>C#>>正文


C# IStorage.LoadString方法代码示例

本文整理汇总了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;
 }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:6,代码来源:RegistrationPersistence.cs

示例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;
            }
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:21,代码来源:PackageCatalog.cs

示例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;
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:40,代码来源:RegistrationPersistence.cs

示例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;
 }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:7,代码来源:RegistrationPersistence.cs


注:本文中的IStorage.LoadString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。