예제 #1
0
        private static OutputGroup ReadOutputElement(XmlReader reader)
        {
            var outputNode = new OutputGroup();

            while (reader.Read())
            {
                // get the attributes
                if (reader.Name == OutputElementName && reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        switch (reader.Name)
                        {
                        case PathAttributeName:
                            outputNode.Path = reader.Value;
                            break;

                        case EncodingAttributeName:
                            outputNode.EncodingName = reader.Value;
                            break;

                        case TypeAttributeName:
                            switch (reader.Value.ToUpperInvariant())
                            {
                            case "JS":
                            case "JAVASCRIPT":
                            case "JSCRIPT":
                                outputNode.CodeType = CodeType.JavaScript;
                                break;

                            case "CSS":
                            case "STYLESHEET":
                            case "STYLESHEETS":
                                outputNode.CodeType = CodeType.StyleSheet;
                                break;
                            }
                            break;

                        case MapPathAttributeName:
                            outputNode.SymbolMap = new SymbolMap()
                            {
                                Path = reader.Value
                            };
                            break;
                        }
                    }

                    // back to element
                    reader.MoveToElement();
                }

                // process child elements
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case ArgumentsElementName:
                        ReadArgumentsElement(reader.ReadSubtree(), outputNode.Arguments);
                        break;

                    case RenameElementName:
                        ReadRenameElement(reader.ReadSubtree(), outputNode.RenameIdentifiers);
                        break;

                    case NoRenameElementName:
                        ReadNoRenameElement(reader.ReadSubtree(), outputNode.NoRenameIdentifiers);
                        break;

                    case SymbolMapElementName:
                        outputNode.SymbolMap = ReadSymbolMapElement(reader.ReadSubtree());
                        break;

                    case ResourceElementName:
                        outputNode.Resources.Add(ReadResourceElement(reader.ReadSubtree()));
                        break;

                    case InputElementName:
                        outputNode.Inputs.Add(ReadInputElement(reader.ReadSubtree()));
                        break;
                    }
                }
            }

            reader.Close();
            return(outputNode);
        }
예제 #2
0
        private static OutputGroup ReadOutputElement(XmlReader reader)
        {
            var outputNode = new OutputGroup();
            while (reader.Read())
            {
                // get the attributes
                if (reader.Name == OutputElementName && reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        switch (reader.Name)
                        {
                            case PathAttributeName:
                                outputNode.Path = reader.Value;
                                break;

                            case EncodingAttributeName:
                                outputNode.EncodingName = reader.Value;
                                break;

                            case TypeAttributeName:
                                switch (reader.Value.ToUpperInvariant())
                                {
                                    case "JS":
                                    case "JAVASCRIPT":
                                    case "JSCRIPT":
                                        outputNode.CodeType = CodeType.JavaScript;
                                        break;

                                    case "CSS":
                                    case "STYLESHEET":
                                    case "STYLESHEETS":
                                        outputNode.CodeType = CodeType.StyleSheet;
                                        break;
                                }
                                break;

                            case MapPathAttributeName:
                                outputNode.SymbolMap = new SymbolMap()
                                {
                                    Path = reader.Value
                                };
                                break;
                        }
                    }

                    // back to element
                    reader.MoveToElement();
                }

                // process child elements
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case ArgumentsElementName:
                            ReadArgumentsElement(reader.ReadSubtree(), outputNode.Arguments);
                            break;

                        case RenameElementName:
                            ReadRenameElement(reader.ReadSubtree(), outputNode.RenameIdentifiers);
                            break;

                        case NoRenameElementName:
                            ReadNoRenameElement(reader.ReadSubtree(), outputNode.NoRenameIdentifiers);
                            break;

                        case SymbolMapElementName:
                            outputNode.SymbolMap = ReadSymbolMapElement(reader.ReadSubtree());
                            break;

                        case ResourceElementName:
                            outputNode.Resources.Add(ReadResourceElement(reader.ReadSubtree()));
                            break;

                        case InputElementName:
                            outputNode.Inputs.Add(ReadInputElement(reader.ReadSubtree()));
                            break;
                    }
                }
            }

            reader.Close();
            return outputNode;
        }