コード例 #1
0
ファイル: UxNodePath.cs プロジェクト: BeeWarloc/Fuse.UxParser
        public static bool TryParse(string str, out UxNodePath path)
        {
            path = null;
            var parts = str.Split(new[] { '/' }, StringSplitOptions.None);

            if (parts.Length < 1)
            {
                return(false);
            }
            if (parts[0] != string.Empty)
            {
                return(false);
            }
            var indexes = new int[parts.Length - 1];

            for (var i = 1; i < parts.Length; i++)
            {
                if (!int.TryParse(parts[i], out var index))
                {
                    return(false);
                }

                indexes[i - 1] = index;
            }
            path = new UxNodePath(indexes);
            return(true);
        }
コード例 #2
0
 public UxInsertAttributeChange(
     UxNodePath nodePath,
     int attributeIndex,
     AttributeSyntaxBase attribute)
 {
     NodePath       = nodePath;
     AttributeIndex = attributeIndex;
     Attribute      = attribute;
 }
コード例 #3
0
 public UxReplaceAttributeChange(
     UxNodePath nodePath,
     int attributeIndex,
     AttributeSyntaxBase oldAttribute,
     AttributeSyntaxBase newAttribute)
 {
     NodePath       = nodePath;
     AttributeIndex = attributeIndex;
     OldAttribute   = oldAttribute;
     NewAttribute   = newAttribute;
 }
コード例 #4
0
 public UxInsertNodeChange(UxNodePath path, NodeSyntax node)
 {
     Node     = node ?? throw new ArgumentNullException(nameof(node));
     NodePath = path ?? throw new ArgumentNullException(nameof(path));
 }
コード例 #5
0
 public UxElementNameChange(UxNodePath nodePath, NameToken oldName, NameToken newName)
 {
     NodePath = nodePath;
     OldName  = oldName;
     NewName  = newName;
 }
コード例 #6
0
 public UxReplaceNodeChange(UxNodePath nodePath, NodeSyntax oldNode, NodeSyntax newNode)
 {
     NodePath = nodePath;
     OldNode  = oldNode;
     NewNode  = newNode;
 }