本文整理汇总了C#中INodeFactory类的典型用法代码示例。如果您正苦于以下问题:C# INodeFactory类的具体用法?C# INodeFactory怎么用?C# INodeFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
INodeFactory类属于命名空间,在下文中一共展示了INodeFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructContext
/// <summary>
/// Creates a new Construct Context
/// </summary>
/// <param name="g">Graph to construct Triples in</param>
/// <param name="s">Set to construct from</param>
/// <param name="preserveBNodes">Whether Blank Nodes bound to variables should be preserved as-is</param>
/// <remarks>
/// <para>
/// Either the <paramref name="s">Set</paramref> or <paramref name="g">Graph</paramref> parameters may be null if required
/// </para>
/// </remarks>
public ConstructContext(IGraph g, ISet s, bool preserveBNodes)
{
this._g = g;
this._factory = (this._g != null ? (INodeFactory)this._g : _globalFactory.Value);
this._s = s;
this._preserveBNodes = preserveBNodes;
}
示例2: Node
protected Node(INodeFactory factory)
{
if(factory == null)
throw new ArgumentNullException("factory");
this.Factory = factory;
}
示例3: ReportNodeControl
/// <summary>
/// Constructor to create the instance of the node control.
/// </summary>
/// <param name="parentNodeFactory">Parent node factory for this control.</param>
public ReportNodeControl(INodeFactory parentNodeFactory) : this()
{
if (parentNodeFactory == null)
{
ExceptionManager.Throw(new ArgumentNullException("parentNodeFactory"));
}
_parentNodeFactory = parentNodeFactory;
}
示例4: ToNode
public static INode ToNode(this EntityId entityId, INodeFactory factory)
{
if (entityId is BlankId)
{
return factory.CreateBlankNode(entityId.Uri.Authority);
}
return factory.CreateUriNode(entityId.Uri);
}
示例5: FolderNode
public FolderNode(IProjectIO projectIO, INodeFactory nodeFactory, string dirpath, bool isRoot = false)
{
_io = projectIO;
_nodeFactory = nodeFactory;
_dirpath = dirpath;
_isRoot = isRoot;
_children.CollectionChanged += OnCollectionChanged;
LoadFilesAndDirectories();
}
示例6: Create
internal static MemberBindingNode Create(INodeFactory factory, MemberBinding memberBinding)
{
MemberBindingNode memberBindingNode = null;
if (memberBinding is MemberAssignment)
memberBindingNode = new MemberAssignmentNode(factory, (MemberAssignment)memberBinding);
else if (memberBinding is MemberListBinding)
memberBindingNode = new MemberListBindingNode(factory, (MemberListBinding)memberBinding);
else if (memberBinding is MemberMemberBinding)
memberBindingNode = new MemberMemberBindingNode(factory, (MemberMemberBinding)memberBinding);
else if (memberBinding != null)
throw new ArgumentException("Unknown member binding of type " + memberBinding.GetType(), "memberBinding");
return memberBindingNode;
}
示例7: ResolvePath
public override System.Collections.Generic.IEnumerable<INodeFactory> ResolvePath(
PowerShell.Provider.PathNodeProcessors.IContext context, string path)
{
path = context.SessionState.Path.GetUnresolvedProviderPathFromPSPath(path);
var nf = PathCache.Get(path);
if (null != nf)
{
return nf;
}
var driveInfo = GetDriveFromPath(context, path);
if (null == driveInfo)
{
context.WriteWarning(String.Format("Could not determine drive for path [{0}]", path));
return base.ResolvePath(context, path);
}
string fileOrServerPath = Regex.Replace(path, @"^[^::]+::", String.Empty);
var re = new Regex("^.*(" + Regex.Escape(driveInfo.Root) + ")(.*)$", RegexOptions.IgnoreCase);
var matches = re.Match(path);
fileOrServerPath = matches.Groups[1].Value;
path = matches.Groups[2].Value;
if (File.Exists(fileOrServerPath) || Directory.Exists(fileOrServerPath))
{
_root = new BipsFileRootNodeFactory(driveInfo, fileOrServerPath);
}
else
{
_root = new BipsRootNodeFactory(driveInfo);
}
var nodes = base.ResolvePath(context, path);
if (null == nodes || !nodes.Any())
{
return nodes;
}
nodes = nodes.ToList();
PathCache.Add( path, nodes );
return nodes;
}
示例8: UnWrapNode
/// <summary>Converts a RomanticWeb's <see cref="Node"/> into dotNetRDF's <see cref="INode"/>.</summary>
public static INode UnWrapNode(this Node node, INodeFactory nodeFactory)
{
if (node.IsUri)
{
return nodeFactory.CreateUriNode(node.Uri);
}
if (node.IsLiteral)
{
if (node.Language != null)
{
return nodeFactory.CreateLiteralNode(node.Literal, node.Language);
}
if (node.DataType != null)
{
return nodeFactory.CreateLiteralNode(node.Literal, node.DataType);
}
return nodeFactory.CreateLiteralNode(node.Literal);
}
return nodeFactory.CreateBlankNode(node.BlankNode);
}
示例9: GetProperty
void GetProperty(string path, INodeFactory factory, Collection<string> providerSpecificPickList)
{
var node = factory.GetNodeValue();
PSObject values = null;
if (null == providerSpecificPickList || 0 == providerSpecificPickList.Count)
{
values = PSObject.AsPSObject(node.Item);
}
else
{
values = new PSObject();
var value = node.Item;
var propDescs = TypeDescriptor.GetProperties(value);
var props = (from PropertyDescriptor prop in propDescs
where (providerSpecificPickList.Contains(prop.Name,
StringComparer.InvariantCultureIgnoreCase))
select prop);
props.ToList().ForEach(p =>
{
var iv = p.GetValue(value);
if (null != iv)
{
values.Properties.Add(new PSNoteProperty(p.Name, p.GetValue(value)));
}
});
}
WritePropertyObject(values, path);
}
示例10: InvokeDefaultAction
void InvokeDefaultAction( string path, INodeFactory factory )
{
var invoke = factory as IInvokeItem;
if (null == factory || null == invoke)
{
WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.InvokeItem, InvokeItemNotSupportedErrorID);
return;
}
var fullPath = path;
if (!ShouldProcess(fullPath, ProviderCmdlet.InvokeItem))
{
return;
}
path = GetChildName(path);
try
{
var results = invoke.InvokeItem(CreateContext(fullPath), path);
if (null == results)
{
return;
}
// TODO: determine what exactly to return here
// http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCAQFjAA&url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fsystem.management.automation.provider.itemcmdletprovider.invokedefaultaction(v%3Dvs.85).aspx&ei=28vLTpyrJ42utwfUo6WYAQ&usg=AFQjCNFto_ye_BBjxxWfzBFGfNxw3eEgTw
// docs tell me to return the item being invoked... but I'm not sure.
// is there any way for the target of the invoke to return data to the runspace??
//results.ToList().ForEach(r => this.WriteObject(r));
}
catch( Exception e )
{
WriteGeneralCmdletError(e, InvokeItemInvokeErrorID, fullPath);
}
}
示例11: GetCopyItem
private ICopyItem GetCopyItem(INodeFactory sourceNode)
{
var copyItem = sourceNode as ICopyItem;
if (null == sourceNode || null == copyItem)
{
return null;
}
return copyItem;
}
示例12: GetItem
void GetItem( string path, INodeFactory factory )
{
try
{
WritePathNode(path, factory);
}
catch (Exception e)
{
WriteGeneralCmdletError(e, GetItemInvokeErrorID, path);
}
}
示例13: PatientNodeControl
/// <summary>
/// Constructor to create the instance of the control.
/// </summary>
/// <param name="nodeFactory">Node factory for the control.</param>
public PatientNodeControl(INodeFactory nodeFactory) : this()
{
_nodeFactory = nodeFactory;
}
示例14: SetItem
void SetItem( string path, INodeFactory factory, object value )
{
var @set = factory as ISetItem;
if (null == factory || null == @set)
{
WriteCmdletNotSupportedAtNodeError(path, ProviderCmdlet.SetItem, SetItemNotSupportedErrorID);
return;
}
var fullPath = path;
path = GetChildName(path);
if (!ShouldProcess(fullPath, ProviderCmdlet.SetItem))
{
return;
}
try
{
var result = @set.SetItem(CreateContext(fullPath), path, value);
if (null != result)
{
WritePathNode(fullPath, result);
}
}
catch (Exception e)
{
WriteGeneralCmdletError(e, SetItemInvokeErrorID, fullPath);
}
}
示例15: GetChildItems
void GetChildItems(string path, INodeFactory nodeFactory, bool recurse)
{
var context = CreateContext(path, recurse );
var children = nodeFactory.GetNodeChildren(context);
WriteChildItem(path, recurse, children);
}