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


C# Model.DataNode类代码示例

本文整理汇总了C#中NBTExplorer.Model.DataNode的典型用法代码示例。如果您正苦于以下问题:C# DataNode类的具体用法?C# DataNode怎么用?C# DataNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataNode类属于NBTExplorer.Model命名空间,在下文中一共展示了DataNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindBlock

        public FindBlock (DataNode searchRoot)
        {
            InitializeComponent();

            _searchRoot = searchRoot;

            _groupX = new CoordinateGroup() {
                RegionBox = _regionXTextBox,
                ChunkBox = _chunkXTextBox,
                BlockBox = _blockXTextBox,
                LocalChunkBox = _localChunkXTextBox,
                LocalBlockBox = _localBlockXTextBox,
            };

            _groupZ = new CoordinateGroup() {
                RegionBox = _regionZTextBox,
                ChunkBox = _chunkZTextBox,
                BlockBox = _blockZTextBox,
                LocalChunkBox = _localChunkZTextBox,
                LocalBlockBox = _localBlockZTextBox,
            };

            ApplyRegion(_groupX, "0", true);
            ApplyRegion(_groupZ, "0", true);

            Validate();
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:27,代码来源:FindBlock.cs

示例2: Process

        public override bool Process(DataNode dataNode, ConsoleOptions options)
        {
            string value = options.Values[0];

            TagDataNode tagDataNode = dataNode as TagDataNode;
            return tagDataNode.Parse(value);
        }
开发者ID:Warpten,项目名称:NBTExplorer,代码行数:7,代码来源:EditOperation.cs

示例3: FindReplace

        public FindReplace (MainForm main, NodeTreeController controller, DataNode searchRoot)
        {
            InitializeComponent();

            _main = main;
            _mainController = controller;
            _mainSearchRoot = searchRoot;

            _findController = new RuleTreeController(treeView1);
            treeView1.NodeMouseDoubleClick += (s, e) => {
                _findController.EditSelection();
            };

            //_findController.VirtualRootDisplay = "Find Rules";

            _replaceController = new NodeTreeController(treeView2);
            treeView2.NodeMouseDoubleClick += (s, e) => {
                _replaceController.EditSelection();
            };

            _replaceController.VirtualRootDisplay = "Replacement Tags";

            _explorerStrip.Renderer = new ToolStripExplorerRenderer();
            _explorerStrip.ImageList = _mainController.IconList;

            _explorerManager = new ExplorerBarController(_explorerStrip, _mainController.IconRegistry, _mainController.IconList, searchRoot);
            _explorerManager.SearchRootChanged += (s, e) => {
                _mainSearchRoot = _explorerManager.SearchRoot;
                Reset();
            };
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:31,代码来源:FindReplace.cs

示例4: Process

        public override bool Process (DataNode dataNode, ConsoleOptions options)
        {
            if (options.Values.Count == 0)
                return false;

            string jsonPath = options.Values[0];
            using (FileStream stream = File.OpenWrite(jsonPath)) {
                using (StreamWriter writer = new StreamWriter(stream)) {
                    if (dataNode is TagDataNode) {
                        TagDataNode tagNode = dataNode as TagDataNode;
                        WriteNbtTag(writer, tagNode.Tag);
                    }
                    else if (dataNode is NbtFileDataNode) {
                        dataNode.Expand();
                        TagNodeCompound root = new TagNodeCompound();

                        foreach (DataNode child in dataNode.Nodes) {
                            TagDataNode childTagNode = child as TagDataNode;
                            if (childTagNode == null)
                                continue;

                            if (childTagNode.Tag != null)
                                root.Add(childTagNode.NodeName, childTagNode.Tag);
                        }

                        WriteNbtTag(writer, root);
                    }
                }
            }

            return true;
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:32,代码来源:JsonOperation.cs

示例5: CanProcess

        public override bool CanProcess (DataNode dataNode)
        {
            if (!(dataNode is TagListDataNode))
                return false;

            return true;
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:7,代码来源:SetListOperation.cs

示例6: ExpandDataNode

        private DataNode ExpandDataNode(DataNode dataNode, string tagPath)
        {
            string[] pathParts = tagPath.Split('/');

            DataNode curTag = dataNode;
            curTag.Expand();

            foreach (var part in pathParts) {
                TagDataNode.Container container = curTag as TagDataNode.Container;
                if (curTag == null)
                    throw new Exception("Invalid tag path");

                DataNode childTag = null;
                foreach (var child in curTag.Nodes) {
                    if (child.NodePathName == part)
                        childTag = child;
                }

                if (childTag == null)
                    throw new Exception("Invalid tag path");

                curTag.Expand();
            }

            return curTag;
        }
开发者ID:Warpten,项目名称:NBTExplorer,代码行数:26,代码来源:ConsoleRunner.cs

示例7: CanProcess

        public override bool CanProcess(DataNode dataNode)
        {
            if (!(dataNode is TagDataNode) || !dataNode.CanEditNode)
                return false;
            if (dataNode is TagByteArrayDataNode || dataNode is TagIntArrayDataNode)
                return false;

            return true;
        }
开发者ID:Warpten,项目名称:NBTExplorer,代码行数:9,代码来源:EditOperation.cs

示例8: ExplorerBarController

        public ExplorerBarController (ToolStrip toolStrip, IconRegistry registry, ImageList iconList, DataNode rootNode)
        {
            _explorerStrip = toolStrip;
            _registry = registry;
            _iconList = iconList;
            _rootNode = rootNode;

            Initialize();
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:9,代码来源:ExplorerBarController.cs

示例9: Print

        public static string Print(DataNode node, bool showType)
        {
            if (!_key.ContainsKey(node.GetType()))
                return "";

            if (showType)
                return "<" + _key[node.GetType()] + "> " + node.NodeDisplay;
            else
                return node.NodeDisplay;
        }
开发者ID:johndpalm,项目名称:NBTExplorer,代码行数:10,代码来源:TypePrinter.cs

示例10: Process

        public override bool Process (DataNode dataNode, ConsoleOptions options)
        {
            Console.WriteLine(TypePrinter.Print(dataNode, options.ShowTypes));

            if (dataNode.IsContainerType) {
                foreach (var child in dataNode.Nodes)
                    Console.WriteLine(" | " + TypePrinter.Print(child, options.ShowTypes));
            }

            return true;
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:11,代码来源:PrintOperation.cs

示例11: PrintSubTree

        private void PrintSubTree (DataNode dataNode, ConsoleOptions options, string indent, bool last)
        {
            Console.WriteLine(indent + " + " + TypePrinter.Print(dataNode, options.ShowTypes));

            indent += last ? "  " : " |";
            int cnt = 0;

            dataNode.Expand();
            foreach (DataNode child in dataNode.Nodes) {
                cnt++;
                PrintSubTree(child, options, indent, cnt == dataNode.Nodes.Count);
            }
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:13,代码来源:PrintTreeOperation.cs

示例12: Process

        public override bool Process (DataNode dataNode, ConsoleOptions options)
        {
            TagListDataNode listNode = dataNode as TagListDataNode;

            listNode.Clear();
            foreach (string value in options.Values) {
                TagNode tag = TagDataNode.DefaultTag(listNode.Tag.ValueType);
                TagDataNode tagData = TagDataNode.CreateFromTag(tag);
                if (!tagData.Parse(value))
                    return false;

                if (!listNode.AppendTag(tagData.Tag))
                    return false;
            }

            return true;
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:17,代码来源:SetListOperation.cs

示例13: Search

        private DataNode Search (DataNode node)
        {
            if (node is DirectoryDataNode) {
                DirectoryDataNode dirNode = node as DirectoryDataNode;
                if (!dirNode.IsExpanded)
                    dirNode.Expand();

                foreach (var subNode in dirNode.Nodes) {
                    DataNode resultNode = Search(subNode);
                    if (resultNode != null)
                        return resultNode;
                }

                return null;
            }
            else if (node is RegionFileDataNode) {
                RegionFileDataNode regionNode = node as RegionFileDataNode;

                int rx, rz;
                if (!RegionFileDataNode.RegionCoordinates(regionNode.NodePathName, out rx, out rz))
                    return null;
                if (rx != _groupX.Region.Value || rz != _groupZ.Region.Value)
                    return null;

                if (!regionNode.IsExpanded)
                    regionNode.Expand();

                foreach (var subNode in regionNode.Nodes) {
                    DataNode resultNode = Search(subNode);
                    if (resultNode != null)
                        return resultNode;
                }

                return null;
            }
            else if (node is RegionChunkDataNode) {
                RegionChunkDataNode chunkNode = node as RegionChunkDataNode;
                if (chunkNode.X != _groupX.LocalChunk.Value || chunkNode.Z != _groupZ.LocalChunk.Value)
                    return null;

                return chunkNode;
            }

            return null;
        }
开发者ID:DMV-Jumbo,项目名称:NBTExplorer,代码行数:45,代码来源:FindBlock.cs

示例14: RefreshChildNodes

        private void RefreshChildNodes(TreeNode node, DataNode dataNode)
        {
            Dictionary<DataNode, TreeNode> currentNodes = new Dictionary<DataNode, TreeNode>();
            foreach (TreeNode child in node.Nodes) {
                if (child.Tag is DataNode)
                    currentNodes.Add(child.Tag as DataNode, child);
            }

            node.Nodes.Clear();
            foreach (DataNode child in dataNode.Nodes) {
                if (!currentNodes.ContainsKey(child))
                    node.Nodes.Add(CreateUnexpandedNode(child));
                else
                    node.Nodes.Add(currentNodes[child]);
            }

            foreach (TreeNode child in node.Nodes)
                child.ContextMenuStrip = BuildNodeContextMenu(child.Tag as DataNode);

            if (node.Nodes.Count == 0 && dataNode.HasUnexpandedChildren) {
                ExpandNode(node);
                node.Expand();
            }
        }
开发者ID:emps2222,项目名称:NBTExplorer,代码行数:24,代码来源:MainForm.cs

示例15: PasteIntoNodePred

 private bool PasteIntoNodePred(DataNode dataNode, out GroupCapabilities caps)
 {
     caps = dataNode.PasteIntoNodeCapabilities;
     return (dataNode != null) && dataNode.CanPasteIntoNode;
 }
开发者ID:emps2222,项目名称:NBTExplorer,代码行数:5,代码来源:MainForm.cs


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