internal static CellSetDataInformation Deserialize(XmlReader reader)
        {
            if (reader != null)
            {
                try
                {
                    CellSetDataInformation target = null;
                    if (reader.NodeType == XmlNodeType.Element &&
                        reader.Name == XML_PropertiesInformation)
                    {
                        target = new CellSetDataInformation();

                        reader.ReadStartElement(XML_PropertiesInformation);

                        // Типы
                        int i = 0;
                        while(reader.MoveToAttribute(XML_Type + i.ToString()))
                        {
                            String type = reader.GetAttribute(XML_Type + i.ToString());
                            if(!String.IsNullOrEmpty(type))
                            {
                                target.Types.Add(i, Type.GetType(type));
                                i++;
                            }
                        }
                        reader.ReadStartElement(XML_Types);
                        if (reader.NodeType == XmlNodeType.EndElement &&
                            reader.Name == XML_Types)
                        {
                            reader.ReadEndElement();
                        }

                        // Названия свойств ячеек
                        i = 0;
                        while (reader.MoveToAttribute(XML_Name + i.ToString()))
                        {
                            String name = reader.GetAttribute(XML_Name + i.ToString());
                            target.CellsPropertiesNames.Add(i, name);
                            i++;
                        }
                        reader.ReadStartElement(XML_CellsPropertiesNames);
                        if (reader.NodeType == XmlNodeType.EndElement &&
                            reader.Name == XML_CellsPropertiesNames)
                        {
                            reader.ReadEndElement();
                        }

                        // Значения
                        i = 0;
                        while (reader.MoveToAttribute(XML_Value + i.ToString()))
                        {
                            String formatString = reader.GetAttribute(XML_Value + i.ToString());
                            target.Values.Add(i, formatString);
                            i++;
                        }
                        reader.ReadStartElement(XML_Values);
                        if (reader.NodeType == XmlNodeType.EndElement &&
                            reader.Name == XML_Values)
                        {
                            reader.ReadEndElement();
                        } 

                        if (reader.NodeType == XmlNodeType.EndElement &&
                            reader.Name == XML_PropertiesInformation)
                        {
                            reader.ReadEndElement();
                        }
                    }
                    return target;
                }
                catch (XmlException ex)
                {
                    throw ex;
                    //return null;
                }
            }
            return null;
        }
示例#2
0
        internal static CellSetDataInformation Deserialize(XmlReader reader)
        {
            if (reader != null)
            {
                try
                {
                    CellSetDataInformation target = null;
                    if (reader.NodeType == XmlNodeType.Element &&
                        reader.Name == XML_PropertiesInformation)
                    {
                        target = new CellSetDataInformation();

                        reader.ReadStartElement(XML_PropertiesInformation);

                        // Типы
                        int i = 0;
                        while (reader.MoveToAttribute(XML_Type + i.ToString()))
                        {
                            String type = reader.GetAttribute(XML_Type + i.ToString());
                            if (!String.IsNullOrEmpty(type))
                            {
                                target.Types.Add(i, Type.GetType(type));
                                i++;
                            }
                        }
                        reader.ReadStartElement(XML_Types);
                        if (reader.NodeType == XmlNodeType.EndElement &&
                            reader.Name == XML_Types)
                        {
                            reader.ReadEndElement();
                        }

                        // Названия свойств ячеек
                        i = 0;
                        while (reader.MoveToAttribute(XML_Name + i.ToString()))
                        {
                            String name = reader.GetAttribute(XML_Name + i.ToString());
                            target.CellsPropertiesNames.Add(i, name);
                            i++;
                        }
                        reader.ReadStartElement(XML_CellsPropertiesNames);
                        if (reader.NodeType == XmlNodeType.EndElement &&
                            reader.Name == XML_CellsPropertiesNames)
                        {
                            reader.ReadEndElement();
                        }

                        // Значения
                        i = 0;
                        while (reader.MoveToAttribute(XML_Value + i.ToString()))
                        {
                            String formatString = reader.GetAttribute(XML_Value + i.ToString());
                            target.Values.Add(i, formatString);
                            i++;
                        }
                        reader.ReadStartElement(XML_Values);
                        if (reader.NodeType == XmlNodeType.EndElement &&
                            reader.Name == XML_Values)
                        {
                            reader.ReadEndElement();
                        }

                        if (reader.NodeType == XmlNodeType.EndElement &&
                            reader.Name == XML_PropertiesInformation)
                        {
                            reader.ReadEndElement();
                        }
                    }
                    return(target);
                }
                catch (XmlException ex)
                {
                    throw ex;
                    //return null;
                }
            }
            return(null);
        }