本文整理汇总了C#中IScope.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IScope.Get方法的具体用法?C# IScope.Get怎么用?C# IScope.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScope
的用法示例。
在下文中一共展示了IScope.Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Select
/// <summary>
/// Вспомогательный метод загрузки прокси из конфигурации
/// </summary>
/// <param name="uri"></param>
/// <param name="config"></param>
/// <returns></returns>
public static WebProxy Select(Uri uri, IScope config = null) {
config = config ?? ResourceConfig.Default;
return Select(uri,
config.Get(ResourceConfig.PROXY_USAGE, ProxyUsage.Default),
config.Get(ResourceConfig.PROXY_ADDRESSES, ""),
config.Get(ResourceConfig.PROXY_EXCLUDES, "")
);
}
示例2: Finalize
protected virtual void Finalize(IReportContext context, IScope scope, object result) {
if (scope.Get("store_render").ToBool()) {
scope[scope.Get("render_name", "render_result")] = result;
}
if (!scope.Get("no_render").ToBool()) {
context.Write(result.ToString());
}
}
示例3: RemoveDebugInfo
private static void RemoveDebugInfo(IScope scope, XElement result) {
if (!scope.Get("debug_render", false)) {
foreach (var element in result.DescendantsAndSelf()) {
element.SetAttributeValue("_file", null);
element.SetAttributeValue("_line", null);
}
}
}
示例4: GetDataSource
private static object[] GetDataSource(XElement source, IScope datasource) {
IEnumerable result = null;
var name = source.Attr("xi-repeat");
if (name.Contains(" in ")) {
name = Regex.Replace(name, @"^[\s\S]+?\s+in\s+", "");
}
if (name.StartsWith("$")) {
name = name.Substring(1);
var ds = source.XPathSelectElement("//xi-dataset[@code='" + name + "']");
if (null != ds) {
result = new List<object>();
foreach (var e in ds.Elements()) {
var dict = new Dictionary<string, object>();
foreach (var attribute in e.Attributes()) {
dict[attribute.Name.LocalName] = attribute.Value;
}
((IList<object>) result).Add(dict);
}
}
}
else {
result = datasource.Get<object>(name) as IEnumerable;
}
if (null == result) {
return new object[] {};
}
return result.OfType<object>().ToArray();
}