public WebresourceNode AddSingleNode(Webresource resource, string[] nameParts, FolderNode folder = null)
        {
            var             fileName = nameParts.Last();
            WebresourceType type     = WebresourceType.Auto;

            if (resource.Type != 0)
            {
                type = (WebresourceType)resource.Type;
            }

            if (type == WebresourceType.Auto)
            {
                if (fileName.IndexOf(".", StringComparison.Ordinal) < 0)
                {
                    if (resource.Type == 0)
                    {
                        return(null);
                    }

                    type = (WebresourceType)resource.Type;
                }
                else
                {
                    type = Webresource.GetTypeFromExtension(fileName
                                                            .Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Last());
                }
            }

            WebresourceNode node = null;

            switch (type)
            {
            case WebresourceType.WebPage:
                node = new WebpageNode(resource, Settings);
                break;

            case WebresourceType.Css:
                node = new CssNode(resource, Settings);
                break;

            case WebresourceType.Data:
                node = new DataNode(resource, Settings);
                break;

            case WebresourceType.Gif:
                node = new GifNode(resource, Settings);
                break;

            case WebresourceType.Ico:
                node = new IcoNode(resource, Settings);
                break;

            case WebresourceType.Jpg:
                node = new JpgNode(resource, Settings);
                break;

            case WebresourceType.Png:
                node = new PngNode(resource, Settings);
                break;

            case WebresourceType.Resx:
                node = new ResxNode(resource, Settings);
                break;

            case WebresourceType.Script:
                node = new JavaScriptNode(resource, Settings);
                break;

            case WebresourceType.Silverlight:
                node = new SilverlightNode(resource, Settings);
                break;

            case WebresourceType.Vector:
                node = new VectorNode(resource, Settings);
                break;

            case WebresourceType.Xsl:
                node = new XslNode(resource, Settings);
                break;
            }

            resource.Node = node;

            if (folder != null && node != null)
            {
                folder.Nodes.Add(node);
            }

            return(node);
        }
示例#2
0
 public UnaryExpression(UnaryOperator op, CssNode operand)
     : base(NodeKind.Expression)
 {
     Operand  = operand;
     Operator = op;
 }
示例#3
0
 public UnaryExpression(UnaryOperator op, CssNode operand)
     : base(NodeKind.Expression)
 {
     Operand = operand;
     Operator = op;
 }