Esempio n. 1
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            //only read attributes in GraphicObject IXmlReader implementation
            base.ReadXml(reader);

            using (System.Xml.XmlReader subTree = reader.ReadSubtree())
            {
                subTree.Read(); //skip current node
                subTree.Read(); //read first child

                if (!subTree.IsStartElement())
                    return;

                Type t = Type.GetType("Crow." + subTree.Name);
                if (t == null) {
                    Assembly a = Assembly.GetEntryAssembly ();
                    foreach (Type expT in a.GetExportedTypes ()) {
                        if (expT.Name == subTree.Name)
                            t = expT;
                    }
                }
                GraphicObject go = (GraphicObject)Activator.CreateInstance(t);

                (go as IXmlSerializable).ReadXml(subTree);

                SetChild(go);

                subTree.Read();//closing tag
            }
        }
        /// <summary>
        /// Lê comando.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        private void ReadCommand(System.Xml.XmlReader p_reader)
        {
            System.Xml.XmlReader v_item;

            this.v_cmd = new Spartacus.Database.Command();

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement())
                {
                    switch (p_reader.Name)
                    {
                        case "sql":
                            this.v_cmd.v_text = p_reader.ReadString();
                            break;
                        case "parameter":
                            v_item = p_reader.ReadSubtree();
                            this.ReadParameter(v_item);
                            v_item.Close();
                            break;
                        default:
                            break;
                    }
                }
            }
        }
Esempio n. 3
0
        public override void ReadXML(System.Xml.XmlReader input)
        {
            System.Xml.XmlReader subtree = input.ReadSubtree();

            subtree.ReadToFollowing("x");
            this.X = subtree.ReadElementContentAsFloat("x", "");

            subtree.ReadToFollowing("y");
            this.Y = subtree.ReadElementContentAsFloat("y", "");
        }
Esempio n. 4
0
        public override void ReadXML(System.Xml.XmlReader input)
        {
            System.Xml.XmlReader subtree = input.ReadSubtree();

            subtree.ReadToFollowing("r");
            this.R = subtree.ReadElementContentAsFloat("r", "");

            subtree.ReadToFollowing("g");
            this.G = subtree.ReadElementContentAsFloat("g", "");

            subtree.ReadToFollowing("b");
            this.B = subtree.ReadElementContentAsFloat("b", "");
        }
Esempio n. 5
0
        public override void ReadXml(System.Xml.XmlReader reader)
        {
            using (System.Xml.XmlReader subTree = reader.ReadSubtree ()) {
                subTree.Read ();
                string tmp = subTree.ReadOuterXml ();

                //seek for template tag
                using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
                    xr.Read ();
                    base.ReadXml (xr);
                }
                //process content
                using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
                    xr.Read (); //skip current node

                    while (!xr.EOF) {
                        xr.Read (); //read first child

                        if (!xr.IsStartElement ())
                            continue;

                        if (xr.Name == "Template"){
                            xr.Skip ();
                            if (!xr.IsStartElement ())
                                continue;
                        }

                        Type t = Type.GetType ("Crow." + xr.Name);
                        if (t == null) {
                            Assembly a = Assembly.GetEntryAssembly ();
                            foreach (Type expT in a.GetExportedTypes ()) {
                                if (expT.Name == xr.Name)
                                    t = expT;
                            }
                        }
                        if (t == null)
                            throw new Exception (xr.Name + " type not found");

                        GraphicObject go = (GraphicObject)Activator.CreateInstance (t);

                        (go as IXmlSerializable).ReadXml (xr);

                        Content = go;

                        xr.Read (); //closing tag
                    }

                }
            }
        }
Esempio n. 6
0
    /// <summary>
    /// Generates an object from its XML representation.
    /// </summary>
    /// <param name="reader">The <see cref="XmlReader" /> stream from which the object is deserialized.</param>
    public void ReadXml(System.Xml.XmlReader reader)
    {
      System.Xml.XmlReader shareReader = reader;
      if (reader.IsStartElement())
      {
        shareReader = reader.ReadSubtree();
      }

      while (shareReader.Read())
      {
        while (shareReader.IsStartElement())
        {
          switch (shareReader.Name)
          {
            case IdElementName:
              this.Id = shareReader.ReadString();
              break;
            case TimestampElementName:
              this.Timestamp = long.Parse(shareReader.ReadString());
              break;
            case CommentElementName:
              this.Comment = shareReader.ReadString();
              break;
            case ContentElementName:
              ShareContent content = new ShareContent();
              content.ReadXml(shareReader.ReadSubtree());
              this.Content = content;
              break;
            case VisibilityElementName:
              Visibility visibility = new Visibility();
              visibility.ReadXml(shareReader);
              this.Visibility = visibility;
              break;
            case SourceElementName:
              this.Source = Utility.Utilities.DeserializeXml<ShareSource>(shareReader.ReadOuterXml());
              break;
            case AuthorElementName:
              this.Author = Utility.Utilities.DeserializeXml<Person>(string.Format("<person>{0}</person>", shareReader.ReadInnerXml()));
              break;
            default:
              shareReader.Read();
              break;
          }
        }
      }

      shareReader.Close();
    }
        public virtual void ReadXml(System.Xml.XmlReader topReader)
        {
            this.m_isBeingRead = true;

            string infoName = topReader.Name;
            XmlReader reader = topReader.ReadSubtree();
            XPathDocument doc = new XPathDocument(reader);
            var nav = doc.CreateNavigator();
            XPathNavigator iter = nav.SelectSingleNode(String.Format("/{0}/Version", infoName));
            if (iter == null)
            {
                throw new XmlException("ExperimentInfo is missing version information.");
            }
            else
            {
                long ver = iter.ValueAsLong;
                if (ver == CurrentVersion)
                {
                    ReadCurrentVersion(nav, infoName);
                }
                else if (ver == 1)
                {
                    ReadVersion1(nav, infoName);
                }
                else
                {
                    throw new InvalidOperationException("ExperimentInfo has an invalid version number");
                }
            }

            this.m_isBeingRead = false;
        }
Esempio n. 8
0
        public void ReadShader(ref XmlReadState state, System.Xml.XmlReader node)
        {
            node.Read();
            var name = node.GetAttribute("name");
            if(!state.Silent) Console.WriteLine("Shader: {0}", node.GetAttribute("name"));
            if (string.IsNullOrEmpty(name)) return;

            var shader = new Shader(Client, Shader.ShaderType.Material) {Name = name};

            Utilities.Instance.ReadNodeGraph(ref shader, node.ReadSubtree());

            state.Scene.AddShader(shader);
        }
        /// <summary>
        /// Lê objeto do cabeçalho do relatório.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        private void ReadHeaderObject(System.Xml.XmlReader p_reader)
        {
            Spartacus.Reporting.Object v_object;
            System.Xml.XmlReader v_item;

            v_object = new Spartacus.Reporting.Object();

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement())
                {
                    switch (p_reader.Name)
                    {
                        case "type":
                            switch (p_reader.ReadString())
                            {
                                case "IMAGE":
                                    v_object.v_type = Spartacus.Reporting.ObjectType.IMAGE;
                                    break;
                                case "TEXT":
                                    v_object.v_type = Spartacus.Reporting.ObjectType.TEXT;
                                    break;
                                case "PAGENUMBER":
                                    v_object.v_type = Spartacus.Reporting.ObjectType.PAGENUMBER;
                                    break;
                                default:
                                    break;
                            }
                            break;
                        case "column":
                            v_object.v_column = p_reader.ReadString();
                            break;
                        case "posx":
                            v_object.SetPosX(p_reader.ReadString());
                            break;
                        case "posy":
                            v_object.SetPosY(p_reader.ReadString());
                            break;
                        case "align":
                            switch (p_reader.ReadString())
                            {
                                case "LEFT":
                                    v_object.v_align = Spartacus.Reporting.FieldAlignment.LEFT;
                                    break;
                                case "RIGHT":
                                    v_object.v_align = Spartacus.Reporting.FieldAlignment.RIGHT;
                                    break;
                                case "CENTER":
                                    v_object.v_align = Spartacus.Reporting.FieldAlignment.CENTER;
                                    break;
                                default:
                                    break;
                            }
                            break;
                        case "font":
                            v_object.v_font = new Spartacus.Reporting.Font();
                            v_item = p_reader.ReadSubtree();
                            this.ReadFont(v_object.v_font, v_item);
                            v_item.Close();
                            break;
                        default:
                            break;
                    }
                }
            }

            this.v_header.v_objects.Add(v_object);
        }
Esempio n. 10
0
        private void ReadScene(ref XmlReadState state, System.Xml.XmlReader node)
        {
            while (node.Read())
            {
                if (!node.IsStartElement()) continue;

                if(!state.Silent) Console.WriteLine("XML node: {0}", node.Name);
                switch (node.Name)
                {
                    case "camera":
                        ReadCamera(ref state, node.ReadSubtree());
                        break;
                    case "background":
                        ReadBackground(ref state, node.ReadSubtree());
                        break;
                    case "transform":
                        var transform_substate = new XmlReadState(state);
                        var t = transform_substate.Transform;
                        ReadTransform(node, ref t);
                        transform_substate.Transform = t;
                        node.Read(); /* advance forward one, otherwise we'll end up in internal loop */
                        ReadScene(ref transform_substate, node.ReadSubtree());
                        break;
                    case "state":
                        var state_substate = new XmlReadState(state);
                        ReadState(ref state_substate, node.ReadSubtree());
                        node.Read(); /* advance one forward */
                        ReadScene(ref state_substate, node.ReadSubtree());
                        break;
                    case "integrator":
                        ReadIntegrator(ref state, node.ReadSubtree());
                        break;
                    case "shader":
                        var shader_substate = new XmlReadState(state);
                        ReadShader(ref shader_substate, node.ReadSubtree());
                        break;
                    case "mesh":
                        ReadMesh(ref state, node.ReadSubtree());
                        break;
                    case "include":
                        var src = node.GetAttribute("src");
                        if (!string.IsNullOrEmpty(src))
                        {
                            ReadInclude(ref state, src);
                        }
                        break;
                    default:
                        Console.WriteLine("Uknown node {0}", node.Name);
                        break;
                }
            }
        }
        /// <summary>
        /// Lê um único grupo do relatório.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        private void ReadGroup(System.Xml.XmlReader p_reader)
        {
            System.Xml.XmlReader v_item;
            Spartacus.Reporting.Group v_group;

            v_group = new Spartacus.Reporting.Group();

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement())
                {
                    switch (p_reader.Name)
                    {
                        case "level":
                            v_group.v_level = System.Convert.ToInt32(p_reader.ReadString());
                            break;
                        case "column":
                            v_group.v_column = p_reader.ReadString();
                            break;
                        case "sort":
                            v_group.v_sort = p_reader.ReadString();
                            break;
                        case "showheader":
                            if (p_reader.ReadString() == "FALSE")
                                v_group.v_showheader = false;
                            else
                                v_group.v_showheader = true;
                            break;
                        case "showfooter":
                            if (p_reader.ReadString() == "FALSE")
                                v_group.v_showfooter = false;
                            else
                                v_group.v_showfooter = true;
                            break;
                        case "headerfields":
                            v_item = p_reader.ReadSubtree();
                            this.ReadGroupHeaderFields(v_item, v_group);
                            v_item.Close();
                            break;
                        case "footerfields":
                            v_item = p_reader.ReadSubtree();
                            this.ReadGroupFooterFields(v_item, v_group);
                            v_item.Close();
                            break;
                        case "showheadertitles":
                            if (p_reader.ReadString() == "FALSE")
                                v_group.v_showheadertitles = false;
                            else
                                v_group.v_showheadertitles = true;
                            break;
                        case "showfootertitles":
                            if (p_reader.ReadString() == "FALSE")
                                v_group.v_showfootertitles = false;
                            else
                                v_group.v_showfootertitles = true;
                            break;
                        default:
                            break;
                    }
                }
            }

            this.v_groups.Add(v_group);
        }
Esempio n. 12
0
        public void LoadFrom(System.Xml.XmlReader x)
        {
            if (x.ReadState == ReadState.Initial)
                x.Read();

            if (x.MoveToAttribute("Target"))
                TargetType = (DCompileTarget)Enum.Parse(typeof(DCompileTarget), x.ReadContentAsString());

            while(x.Read())
                switch (x.LocalName)
                {
                    case "CompilerCommand":
                        Compiler = x.ReadString();
                        break;
                    case "LinkerCommand":
                        Linker = x.ReadString();
                        break;
                    case "ObjectLinkPattern":
                        ObjectFileLinkPattern = x.ReadString();
                        break;
                    case "IncludePathPattern":
                        IncludePathPattern = x.ReadString();
                        break;

                    case "DebugArgs":
                        var s = x.ReadSubtree();
                        DebugArguments.ReadFrom(s);
                        s.Close();
                        break;

                    case "ReleaseArgs":
                        var s2 = x.ReadSubtree();
                        ReleaseArguments.ReadFrom(s2);
                        s2.Close();
                        break;
                }
        }
Esempio n. 13
0
 public void ReadXml(System.Xml.XmlReader reader)
 {
     if (reader.ReadToFollowing(this.GetType().Name))
     {
         String s = reader.GetAttribute(Orientation.GetType().Name);
         m_orientation = (Orientation)(Enum.Parse(Orientation.GetType(), s));
         switch (m_orientation)
         {
             case Orientation.Horizontal:
                 if (reader.ReadToDescendant("Column"))
                 {
                     RowDefinitions.Add(NewRowDefinition(new GridLength(1, GridUnitType.Star), m_minGridSize.Height));
                     do
                     {
                         double width = double.Parse(reader.GetAttribute("Width"));
                         IDockLayout layout = null;
                         reader.ReadStartElement();
                         if (reader.LocalName == typeof(DockedWindow).Name)
                         {
                             DockedWindow dockedWindow = new DockedWindow(Root, reader.ReadSubtree());
                             layout = dockedWindow.DockedContent.Children.Count != 0 ? dockedWindow : null;
                             reader.ReadEndElement();
                         }
                         else if (reader.LocalName == typeof(GridLayout).Name)
                         {
                             GridLayout gridLayout = new GridLayout(Root, reader.ReadSubtree());
                             layout = gridLayout.Layouts.Count > 0 ? gridLayout : null;
                             reader.ReadEndElement();
                         }
                         if (layout != null)
                         {
                             if (Children.Count > 0)
                             {
                                 ColumnDefinitions.Add(NewColumnDefinition(new GridLength(1, GridUnitType.Auto), 0));
                                 Children.Add(NewGridSplitter(Orientation));
                             }
                             ColumnDefinitions.Add(NewColumnDefinition(new GridLength(width, GridUnitType.Star), m_minGridSize.Width));
                             m_children.Add(layout);
                             Children.Add((FrameworkElement)layout);
                         }
                     } while (reader.ReadToNextSibling("Column"));
                 }
                 break;
             case Orientation.Vertical:
                 if (reader.ReadToDescendant("Row"))
                 {
                     ColumnDefinitions.Add(NewColumnDefinition(new GridLength(1, GridUnitType.Star), m_minGridSize.Width));
                     do
                     {
                         double height = double.Parse(reader.GetAttribute("Height"));
                         IDockLayout layout = null;
                         reader.ReadStartElement();
                         if (reader.LocalName == typeof(DockedWindow).Name)
                         {
                             DockedWindow dockedWindow = new DockedWindow(Root, reader.ReadSubtree());
                             layout = dockedWindow.DockedContent.Children.Count != 0 ? dockedWindow : null;
                             reader.ReadEndElement();
                         }
                         else if (reader.LocalName == typeof(GridLayout).Name)
                         {
                             GridLayout gridLayout = new GridLayout(Root, reader.ReadSubtree());
                             layout = gridLayout.Layouts.Count > 0 ? gridLayout : null;
                             reader.ReadEndElement();
                         }
                         if (layout != null)
                         {
                             if (Children.Count > 0)
                             {
                                 RowDefinitions.Add(NewRowDefinition(new GridLength(1, GridUnitType.Auto), 0));
                                 Children.Add(NewGridSplitter(Orientation));
                             }
                             RowDefinitions.Add(NewRowDefinition(new GridLength(height, GridUnitType.Star), m_minGridSize.Height));
                             m_children.Add(layout);
                             Children.Add((FrameworkElement)layout);
                         }
                     } while (reader.ReadToNextSibling("Row"));
                 }
                 break;
         }
         for(int i = 0; i < Children.Count; i++)
         {
             Grid.SetColumn(Children[i], Orientation == Orientation.Horizontal ? i : 0);
             Grid.SetRow(Children[i], Orientation == Orientation.Vertical ? i : 0);
         }
         reader.ReadEndElement();
     }
 }
Esempio n. 14
0
        public OpenGLShape(System.Xml.XmlReader r, List<OpenGLTexture> textures)
        {
            while (r.Read ()) {
                if (r.IsStartElement ("Info")) {
                    Info = OpenGLShapeInfo.ReadXml (r.ReadSubtree ());
                }
                else if (r.IsStartElement ("Texture")) {
                    TextureReference = new OpenGLTextureReference (r.ReadSubtree (), textures);
                }
            }

            Rendered = true;
        }
Esempio n. 15
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");

            if (reader.LocalName == "Settings")
            {
                XmlReader topReader = reader.ReadSubtree();
                XPathDocument doc = new XPathDocument(topReader);
                var nav = doc.CreateNavigator();

                XPathNavigator iter = nav.SelectSingleNode("/Settings/Version");
                if (iter == null)
                    throw new XmlSchemaException("Settings does not have a version element");

            }
        }
Esempio n. 16
0
 /// <summary>
 /// See http://code.google.com/apis/shopping/search/v1/reference-response-format.html#product-resource for
 /// documentation on the return format, and http://www.google.com/support/merchants/bin/answer.py?answer=188494
 /// for information on all the fields.
 /// </summary>
 /// <param name="subTree"></param>
 public void Parse( System.Xml.XmlReader subTree )
 {
     while( subTree.Read() )
     {
         if( subTree.NodeType == XmlNodeType.Element )
         {
             switch( subTree.LocalName )
             {
                 // If this is provided, override the id of the item. Google Content provides the vendor's ID/SKU
                 // which we need for Whitelabels.
                 case "id":
                     subTree.MoveToContent();
                     this.Id = subTree.ReadString();
                     break;
                 case "image_link":
                     // Ignoring for now, until https://groups.google.com/group/google-content-api-for-shopping/browse_thread/thread/f0c575ad709295c2 is resolved.
                     // case "additional_image_link":
                     subTree.MoveToContent();
                     String imageLink = subTree.ReadString();
                     if( !String.IsNullOrEmpty( imageLink ) )
                     {
                         this.ImageLinks.Add( imageLink );
                     }
                     break;
                 // Product attributes can be specified in generic or schema. The former, the /generic format,
                 // they are all different attributes.  For the later (not supported here), they are in the "scp" namespace
                 // instead of "sc"
                 case "attribute":
                     subTree.MoveToContent();
                     ParseAttribute( subTree );
                     break;
                 // TODO "target_country" - do we support products in multiple countries for a given vendor though?
                 // If this is a tag that we don't recognize, we should ignore the whole group.
                 default:
                     var elementReader = subTree.ReadSubtree();
                     elementReader.Close();
                     break;
             }
         }
     }
 }
Esempio n. 17
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader.ReadToFollowing(this.GetType().Name))
            {
                reader.ReadStartElement(this.GetType().Name);
                if (reader.LocalName == typeof(TabLayout).Name || reader.LocalName == "MultiContent") // MultiContent is old name and is used here for compatibility with old saved layouts
                {
                    DockedContent = new TabLayout(Root, reader.ReadSubtree());
                    if (DockedContent.Children.Count > 0)
                    {
                        ContentSettings contentSettings = DockedContent.Children[0].Settings;
                        Left = contentSettings.Location.X;
                        Top = contentSettings.Location.Y;
                        Width = contentSettings.Size.Width;
                        Height = contentSettings.Size.Height;

                        Left = Math.Max(0, Math.Min(Left, SystemParameters.VirtualScreenWidth - Width));
                        Top = Math.Max(0, Math.Min(Top, SystemParameters.VirtualScreenHeight - Height));
                        Width = Math.Max(Math.Min(Width, SystemParameters.VirtualScreenWidth - Left), 100);
                        Height = Math.Max(Math.Min(Height, SystemParameters.VirtualScreenHeight - Top), 100);

                        reader.ReadEndElement();
                    }
                }
                reader.ReadEndElement();
            }	
        }
Esempio n. 18
0
 /// <summary>
 /// Generate object from its XML representation</summary>
 /// <param name="reader">XmlReader stream from which object is deserialized</param>
 public void ReadXml(System.Xml.XmlReader reader)
 {
     if (reader.ReadToFollowing(this.GetType().Name))
     {
         reader.ReadStartElement();
         if (reader.LocalName == typeof(TabLayout).Name || reader.LocalName == "MultiContent") // MultiContent is old name and is used here for compatibility with old saved layouts
         {
             DockedContent = new TabLayout(Root, reader.ReadSubtree());
             Content = DockedContent;
             reader.ReadEndElement();
         }
         reader.ReadEndElement();
     }
 }
Esempio n. 19
0
        public void ReadFrom(System.Xml.XmlReader x)
        {
            XmlReader s = null;

            while(x.Read())
                switch (x.LocalName)
                {
                    case "TargetConfiguration":
                        s = x.ReadSubtree();

                        var t = new LinkTargetConfiguration();
                        t.LoadFrom(s);
                        LinkTargetConfigurations.Add(t);

                        s.Close();
                        break;

                    case "DefaultLibs":
                        s = x.ReadSubtree();

                        while (s.Read())
                            if (s.LocalName == "lib")
                                DefaultLibraries.Add(s.ReadString());

                        s.Close();
                        break;

                    case "Includes":
                        s = x.ReadSubtree();

                        while (s.Read())
                            if (s.LocalName == "Path")
                                GlobalParseCache.Add(s.ReadString());

                        s.Close();
                        break;
                }
        }
        /// <summary>
        /// Lê um único campo de um cabeçalho de grupo.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        /// <param name="p_group">Grupo do relatório.</param>
        private void ReadGroupHeaderField(System.Xml.XmlReader p_reader, Spartacus.Reporting.Group p_group)
        {
            Spartacus.Reporting.Field v_field;
            System.Xml.XmlReader v_item;

            v_field = new Spartacus.Reporting.Field();

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement())
                {
                    switch (p_reader.Name)
                    {
                        case "title":
                            v_field.v_title = p_reader.ReadString();
                            break;
                        case "column":
                            v_field.v_column = p_reader.ReadString();
                            break;
                        case "align":
                            switch (p_reader.ReadString())
                            {
                                case "LEFT":
                                    v_field.v_align = Spartacus.Reporting.FieldAlignment.LEFT;
                                    break;
                                case "RIGHT":
                                    v_field.v_align = Spartacus.Reporting.FieldAlignment.RIGHT;
                                    break;
                                case "CENTER":
                                    v_field.v_align = Spartacus.Reporting.FieldAlignment.CENTER;
                                    break;
                                default:
                                    break;
                            }
                            break;
                        case "fill":
                            v_field.v_fill = double.Parse(p_reader.ReadString());
                            break;
                        case "type":
                            v_field.SetType(p_reader.ReadString());
                            break;
                        case "groupedvalue":
                            if (p_reader.ReadString() == "FALSE")
                                v_field.v_groupedvalue = false;
                            else
                                v_field.v_groupedvalue = true;
                            break;
                        case "row":
                            v_field.v_row = System.Convert.ToInt32(p_reader.ReadString());
                            break;
                        case "format":
                            v_field.v_format = p_reader.ReadString();
                            break;
                        case "border":
                            v_field.v_border = new Spartacus.Reporting.Border(p_reader.ReadString());
                            break;
                        case "blank":
                            v_field.v_blank = p_reader.ReadString();
                            break;
                        case "font":
                            v_field.v_font = new Spartacus.Reporting.Font();
                            v_item = p_reader.ReadSubtree();
                            this.ReadFont(v_field.v_font, v_item);
                            v_item.Close();
                            break;
                        default:
                            break;
                    }
                }
            }

            if ((v_field.v_row + 1) > p_group.v_numrowsheader)
                p_group.v_numrowsheader = v_field.v_row + 1;

            p_group.v_headerfields.Add(v_field);
        }
        /// <summary>
        /// Lê campos do relatório.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        private void ReadFields(System.Xml.XmlReader p_reader)
        {
            System.Xml.XmlReader v_item;

            this.v_numrowsdetail = 1;

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement() && p_reader.Name == "field")
                {
                    v_item = p_reader.ReadSubtree();
                    this.ReadField(v_item);
                    v_item.Close();
                }
            }
        }
        /// <summary>
        /// Lê grupos do relatório.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        private void ReadGroups(System.Xml.XmlReader p_reader)
        {
            System.Xml.XmlReader v_item;

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement() && p_reader.Name == "group")
                {
                    v_item = p_reader.ReadSubtree();
                    this.ReadGroup(v_item);
                    v_item.Close();
                }
            }
        }
Esempio n. 23
0
        private static void parseElement( System.Xml.XmlReader osm)
        {
            using(var element = osm.ReadSubtree())
            {
                string street = string.Empty;
                string city = string.Empty;
                int state = 0;

                while(element.Read())
                {

                    if(element.NodeType == System.Xml.XmlNodeType.Element && element.Name == "tag")
                    {
                        //readTag(element);
                        string tag = element.GetAttribute("k");
                        string value = element.GetAttribute("v");

                        switch (tag)
                        {
                            case "addr:city":
                                city = value;
                                state++;
                                break;

                            case "addr:street":
                                street = value;
                                state++;
                                break;

                        }

                    }
                    if(state == 2){
                        if(!mapData.ContainsKey(street)){
                        mapData.Add(street, new HashSet<string>());
                        }
                        mapData[street].Add(city);
                    }

                }
            } // use xml subtree
        }
Esempio n. 24
0
        private void ReadBackground(ref XmlReadState state, System.Xml.XmlReader node)
        {
            node.Read();
            if(!state.Silent) Console.WriteLine("Background shader");

            var shader = new Shader(Client, Shader.ShaderType.World) {Name = Guid.NewGuid().ToString()};

            Utilities.Instance.ReadNodeGraph(ref shader, node.ReadSubtree());

            state.Scene.AddShader(shader);
            state.Scene.Background.Shader = shader;
        }
        /// <summary>
        /// Lê campos de um cabeçalho de grupo.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        /// <param name="p_group">Grupo do relatório.</param>
        private void ReadGroupHeaderFields(System.Xml.XmlReader p_reader, Spartacus.Reporting.Group p_group)
        {
            System.Xml.XmlReader v_item;

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement() && p_reader.Name == "headerfield")
                {
                    v_item = p_reader.ReadSubtree();
                    this.ReadGroupHeaderField(v_item, p_group);
                    v_item.Close();
                }
            }
        }
Esempio n. 26
0
 private static void parseOsm(System.Xml.XmlTextReader xml)
 {
     using(var osm = xml.ReadSubtree())
     {
         while(osm.Read())
         {
             if(osm.NodeType == System.Xml.XmlNodeType.Element && (osm.Name == "Node" || osm.Name == "way" || osm.Name == "relation"))
             {
                 parseElement(osm);
             }
         }
     } // use xml subtree
 }
        /// <summary>
        /// Lê cabeçalho do relatório.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        private void ReadHeader(System.Xml.XmlReader p_reader)
        {
            System.Xml.XmlReader v_item;

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement())
                {
                    switch (p_reader.Name)
                    {
                        case "height":
                            this.v_header.SetHeight(p_reader.ReadString());
                            break;
                        case "object":
                            v_item = p_reader.ReadSubtree();
                            this.ReadHeaderObject(v_item);
                            v_item.Close();
                            break;
                        default:
                            break;
                    }
                }
            }

            this.v_header.v_border = this.v_settings.v_reportheaderborder;
        }
Esempio n. 28
0
        public void ReadFrom(System.Xml.XmlReader x)
        {
            XmlReader s = null;

            while (x.Read())
                switch (x.LocalName) {
                case "BinaryPath":
                    BinPath = x.ReadString ();
                    break;

                case "TargetConfiguration":
                    s = x.ReadSubtree ();

                    var t = new LinkTargetConfiguration ();
                    if(t.LoadFrom (this,s))
                        LinkTargetConfigurations [t.TargetType] = t;

                    s.Close ();
                    break;

                case "DefaultLibs":
                    s = x.ReadSubtree ();

                    while (s.Read())
                        if (s.LocalName == "lib")
                            DefaultLibraries.Add (s.ReadString ());

                    s.Close ();
                    break;

                case "Includes":
                    s = x.ReadSubtree ();

                    while (s.Read())
                        if (s.LocalName == "Path")
                            ParseCache.ParsedDirectories.Add (s.ReadString ());

                    s.Close ();
                    break;

                case "VersionId":
                    PredefinedVersionConstant = x.ReadString();
                    break;

                case "CompilerCommand":
                    SourceCompilerCommand = x.ReadString ();
                    break;

                case "Patterns":
                    s = x.ReadSubtree ();
                    ArgumentPatterns.ReadFrom (s);
                    s.Close ();
                    break;

                case "gdcLibPrefixing":
                    EnableGDCLibPrefixing = x.ReadString() == "true";
                    break;
                }
        }
        /// <summary>
        /// Lê informações sobre as configurações do relatório.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        private void ReadSettings(System.Xml.XmlReader p_reader)
        {
            this.v_settings = new Spartacus.Reporting.Settings();
            System.Xml.XmlReader v_item;

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement())
                {
                    switch (p_reader.Name)
                    {
                        case "layout":
                            if (p_reader.ReadString() == "PORTRAIT")
                                this.v_settings.v_layout = Spartacus.Reporting.PageLayout.PORTRAIT;
                            else
                                this.v_settings.v_layout = Spartacus.Reporting.PageLayout.LANDSCAPE;
                            break;
                        case "topmargin":
                            this.v_settings.SetMargin(Spartacus.Reporting.PageMargin.TOP, p_reader.ReadString());
                            break;
                        case "bottommargin":
                            this.v_settings.SetMargin(Spartacus.Reporting.PageMargin.BOTTOM, p_reader.ReadString());
                            break;
                        case "leftmargin":
                            this.v_settings.SetMargin(Spartacus.Reporting.PageMargin.LEFT, p_reader.ReadString());
                            break;
                        case "rightmargin":
                            this.v_settings.SetMargin(Spartacus.Reporting.PageMargin.RIGHT, p_reader.ReadString());
                            break;
                        case "dataheaderborder":
                            this.v_settings.v_dataheaderborder = new Spartacus.Reporting.Border(p_reader.ReadString());
                            break;
                        case "datafieldborder":
                            this.v_settings.v_datafieldborder = new Spartacus.Reporting.Border(p_reader.ReadString());
                            break;
                        case "groupheaderborder":
                            this.v_settings.v_groupheaderborder = new Spartacus.Reporting.Border(p_reader.ReadString());
                            break;
                        case "groupfooterborder":
                            this.v_settings.v_groupfooterborder = new Spartacus.Reporting.Border(p_reader.ReadString());
                            break;
                        case "reportheaderborder":
                            this.v_settings.v_reportheaderborder = new Spartacus.Reporting.Border(p_reader.ReadString());
                            break;
                        case "reportfooterborder":
                            this.v_settings.v_reportfooterborder = new Spartacus.Reporting.Border(p_reader.ReadString());
                            break;
                        case "dataheadercolor":
                            this.v_settings.v_dataheadercolor = this.v_settings.GetColor(p_reader.ReadString());
                            break;
                        case "datafieldevencolor":
                            this.v_settings.v_datafieldevencolor = this.v_settings.GetColor(p_reader.ReadString());
                            break;
                        case "datafieldoddcolor":
                            this.v_settings.v_datafieldoddcolor = this.v_settings.GetColor(p_reader.ReadString());
                            break;
                        case "groupheaderevencolor":
                            this.v_settings.v_groupheaderevencolor = this.v_settings.GetColor(p_reader.ReadString());
                            break;
                        case "groupheaderoddcolor":
                            this.v_settings.v_groupheaderoddcolor = this.v_settings.GetColor(p_reader.ReadString());
                            break;
                        case "groupfooterevencolor":
                            this.v_settings.v_groupfooterevencolor = this.v_settings.GetColor(p_reader.ReadString());
                            break;
                        case "groupfooteroddcolor":
                            this.v_settings.v_groupfooteroddcolor = this.v_settings.GetColor(p_reader.ReadString());
                            break;
                        case "reportheaderfont":
                            this.v_settings.v_reportheaderfont = new Spartacus.Reporting.Font();
                            v_item = p_reader.ReadSubtree();
                            this.ReadFont(this.v_settings.v_reportheaderfont, v_item);
                            v_item.Close();
                            break;
                        case "reportfooterfont":
                            this.v_settings.v_reportfooterfont = new Spartacus.Reporting.Font();
                            v_item = p_reader.ReadSubtree();
                            this.ReadFont(this.v_settings.v_reportfooterfont, v_item);
                            v_item.Close();
                            break;
                        case "dataheaderfont":
                            this.v_settings.v_dataheaderfont = new Spartacus.Reporting.Font();
                            v_item = p_reader.ReadSubtree();
                            this.ReadFont(this.v_settings.v_dataheaderfont, v_item);
                            v_item.Close();
                            break;
                        case "datafieldfont":
                            this.v_settings.v_datafieldfont = new Spartacus.Reporting.Font();
                            v_item = p_reader.ReadSubtree();
                            this.ReadFont(this.v_settings.v_datafieldfont, v_item);
                            v_item.Close();
                            break;
                        case "groupheaderfont":
                            this.v_settings.v_groupheaderfont = new Spartacus.Reporting.Font();
                            v_item = p_reader.ReadSubtree();
                            this.ReadFont(this.v_settings.v_groupheaderfont, v_item);
                            v_item.Close();
                            break;
                        case "groupfooterfont":
                            this.v_settings.v_groupfooterfont = new Spartacus.Reporting.Font();
                            v_item = p_reader.ReadSubtree();
                            this.ReadFont(this.v_settings.v_groupfooterfont, v_item);
                            v_item.Close();
                            break;
                        case "showdataheader":
                            if (p_reader.ReadString() == "TRUE")
                                this.v_settings.v_showdataheader = true;
                            else
                                this.v_settings.v_showdataheader = false;
                            break;
                        default:
                            break;
                    }
                }
            }
        }
Esempio n. 30
0
        public bool LoadFrom(DCompilerConfiguration cmpCfg,System.Xml.XmlReader x)
        {
            if (x.ReadState == ReadState.Initial)
                x.Read ();

            if (x.MoveToAttribute ("Target") &&
                !Enum.TryParse(x.ReadContentAsString(), true, out TargetType))
                    return false;

            while (x.Read())
                switch (x.LocalName) {
                // For backward compatibility keep on parsing this
                case "CompilerCommand":
                    cmpCfg.SourceCompilerCommand = x.ReadString ();
                    break;
                case "LinkerCommand":
                    Linker = x.ReadString ();
                    break;
                case "Patterns": // ditto
                    var s = x.ReadSubtree ();
                    cmpCfg.ArgumentPatterns.ReadFrom (s);
                    s.Close ();
                    break;
                case "DebugArgs":
                    s = x.ReadSubtree ();
                    DebugArguments.ReadFrom (cmpCfg, s);
                    s.Close ();
                    break;
                case "ReleaseArgs":
                    s = x.ReadSubtree ();
                    ReleaseArguments.ReadFrom (cmpCfg,s);
                    s.Close ();
                    break;
                }

            return true;
        }