Пример #1
0
 public static string[] GetSupportAttributes()
 {
     string[] result;
     try
     {
         List <string> list           = new List <string>();
         XmlDocument   xmlDocumentDTD = DrawDriverXmlOp.GetXmlDocumentDTD();
         XmlCommomOp.xmlPath = DrawDriverXmlOp.strXmlDocumentDTDFilePath;
         XmlNode[] xmlNodeByTagname = XmlCommomOp.GetXmlNodeByTagname("SupportAttribute");
         if (xmlNodeByTagname == null || xmlNodeByTagname.Length <= 0)
         {
             result = null;
         }
         else
         {
             foreach (XmlNode xmlNode in xmlNodeByTagname[0])
             {
                 list.Add(xmlNode.Name);
             }
             result = list.ToArray();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(result);
 }
Пример #2
0
        public static bool SetRowsAttributeByXmlNode(XmlDocument doc)
        {
            XmlNodeReader xmlNodeReader = null;
            bool          result;

            try
            {
                if (doc == null)
                {
                    throw new NullReferenceException();
                }
                foreach (XmlNode node in doc.ChildNodes)
                {
                    DrawDriverXmlOp.NodeChildNodes(node);
                }
                result = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (xmlNodeReader != null)
                {
                    xmlNodeReader.Close();
                }
            }
            return(result);
        }
Пример #3
0
        public static bool SetRowsAttributeByXmlNode(string _TagName)
        {
            bool result;

            try
            {
                if (_TagName == null)
                {
                    throw new NullReferenceException();
                }
                XmlNode[] xmlNodeByTagname = XmlCommomOp.GetXmlNodeByTagname(_TagName);
                if (xmlNodeByTagname == null || xmlNodeByTagname.Length <= 0)
                {
                    result = false;
                }
                else
                {
                    for (int i = 0; i < xmlNodeByTagname.Length; i++)
                    {
                        DrawDriverXmlOp.SetRowsAttributeByXmlNode(xmlNodeByTagname[i]);
                    }
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Пример #4
0
        public static DrawInfo GetDrawInfoByXmlNode(XmlNode _node)
        {
            DrawInfo result;

            try
            {
                if (_node == null)
                {
                    throw new NullReferenceException();
                }
                string valueByAttribute = XmlCommomOp.GetValueByAttribute(_node, "Style");
                if (valueByAttribute == null)
                {
                    DrawDriverXmlOp.SetDrawInfoByXmlNode(_node);
                }
                DrawInfoString objString = new DrawInfoString();
                string[]       supportAttributeByXmlNode = DrawDriverXmlOp.GetSupportAttributeByXmlNode(_node);
                for (int i = 0; i < supportAttributeByXmlNode.Length; i++)
                {
                    DrawDriverXmlOp.SetStyle(ref objString, supportAttributeByXmlNode[i], _node, valueByAttribute);
                }
                DrawInfo drawInfo = CommonMethods.DrawInfoStringToDrawInfo(objString);
                result = drawInfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Пример #5
0
 private static void NodeChildNodes(XmlNode _node)
 {
     if (_node.HasChildNodes)
     {
         DrawDriverXmlOp.SetRowsAttributeByXmlNode(_node);
         foreach (XmlNode node in _node.ChildNodes)
         {
             DrawDriverXmlOp.NodeChildNodes(node);
         }
     }
 }
Пример #6
0
 public static string[] GetSupportChildTypeByXmlNode(XmlNode _node)
 {
     string[] result;
     try
     {
         if (_node == null)
         {
             throw new NullReferenceException();
         }
         List <string> list           = new List <string>();
         XmlDocument   xmlDocumentDTD = DrawDriverXmlOp.GetXmlDocumentDTD();
         XmlCommomOp.xmlPath = DrawDriverXmlOp.strXmlDocumentDTDFilePath;
         XmlNode[] xmlNodeByTagname = XmlCommomOp.GetXmlNodeByTagname(_node.Name);
         if (xmlNodeByTagname == null || xmlNodeByTagname.Length <= 0)
         {
             result = null;
         }
         else
         {
             XmlNode[] array = xmlNodeByTagname;
             for (int i = 0; i < array.Length; i++)
             {
                 XmlNode xmlNode    = array[i];
                 XmlNode parentNode = xmlNode.ParentNode;
                 if (parentNode != null)
                 {
                     if (parentNode.Name.ToLower().Trim().Equals("LabelContains".ToLower()))
                     {
                         XmlElement xmlElement = (XmlElement)xmlNode;
                         foreach (XmlAttribute xmlAttribute in xmlElement.Attributes)
                         {
                             if (xmlAttribute.Name.ToLower().Equals("Contains".ToLower()))
                             {
                                 string text = xmlAttribute.Value.ToLower();
                                 result = text.Split(new char[]
                                 {
                                     ','
                                 });
                                 return(result);
                             }
                         }
                     }
                 }
             }
             result = null;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(result);
 }
Пример #7
0
        public static bool SetRowsAttributeByXmlNode(XmlNode _node)
        {
            bool result;

            try
            {
                if (_node == null)
                {
                    throw new NullReferenceException();
                }
                string    input            = "";
                XmlNode[] xmlNodeByTagname = XmlCommomOp.GetXmlNodeByTagname("Style");
                if (xmlNodeByTagname != null && xmlNodeByTagname.Length > 0)
                {
                    input = xmlNodeByTagname[0].InnerText;
                }
                string     name       = _node.Name;
                string     str        = "";
                string     text       = "";
                XmlElement xmlElement = (XmlElement)_node;
                foreach (XmlAttribute xmlAttribute in xmlElement.Attributes)
                {
                    if (xmlAttribute.Name.ToLower().Equals("Class".ToLower()))
                    {
                        str = xmlAttribute.Value;
                    }
                    if (xmlAttribute.Name.ToLower().Equals("Style".ToLower()))
                    {
                        text = xmlAttribute.Value;
                    }
                }
                XmlCommomOp.DeleteNodeAttribute(_node, "Class");
                XmlCommomOp.DeleteNodeAttribute(_node, "Style");
                if (text.Trim().Length > 0)
                {
                    string[] array = text.Split(new char[]
                    {
                        ';'
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        string[] array2 = array[i].Split(new char[]
                        {
                            ':'
                        });
                        if (array2.Length >= 2)
                        {
                            if (!DrawDriverXmlOp.YNHaveAttribute(_node, array2[0].Trim().ToLower()))
                            {
                                XmlCommomOp.SetXmlAttribute(_node, array2[0].Trim().ToLower(), array2[1].ToLower());
                            }
                        }
                    }
                }
                Regex           regex           = new Regex("([^{}\\s]*?)([^{}]*?){([^{}]*?)}");
                MatchCollection matchCollection = regex.Matches(input);
                string[,] array3 = new string[matchCollection.Count, 2];
                for (int i = 0; i < matchCollection.Count; i++)
                {
                    string[] array4 = matchCollection[i].Value.Trim().Replace("\t", "").Replace("\r\n", "").Split(new char[]
                    {
                        '{'
                    });
                    if (array4.Length >= 2)
                    {
                        array3[i, 0] = array4[0].Trim();
                        array3[i, 1] = array4[1].Replace("}", "");
                    }
                }
                string[] array5 = DrawDriverXmlOp.GetStyle(array3, "." + str).Split(new char[]
                {
                    ';'
                });
                for (int i = 0; i < array5.Length; i++)
                {
                    string[] array2 = array5[i].Split(new char[]
                    {
                        ':'
                    });
                    if (array2.Length >= 2)
                    {
                        if (!DrawDriverXmlOp.YNHaveAttribute(_node, array2[0].Trim().ToLower()))
                        {
                            XmlCommomOp.SetXmlAttribute(_node, array2[0].Trim().ToLower(), array2[1].ToLower());
                        }
                    }
                }
                array5 = DrawDriverXmlOp.GetStyle(array3, name).Split(new char[]
                {
                    ';'
                });
                for (int i = 0; i < array5.Length; i++)
                {
                    string[] array2 = array5[i].Split(new char[]
                    {
                        ':'
                    });
                    if (array2.Length >= 2)
                    {
                        if (!DrawDriverXmlOp.YNHaveAttribute(_node, array2[0].Trim().ToLower()))
                        {
                            XmlCommomOp.SetXmlAttribute(_node, array2[0].Trim().ToLower(), array2[1].ToLower());
                        }
                    }
                }
                result = false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Пример #8
0
        public static DrawType GetDrawTypeByXmlNode(XmlNode _node)
        {
            DrawType result;

            try
            {
                if (_node == null)
                {
                    throw new NullReferenceException();
                }
                List <string> list           = new List <string>();
                XmlDocument   xmlDocumentDTD = DrawDriverXmlOp.GetXmlDocumentDTD();
                XmlCommomOp.xmlPath = DrawDriverXmlOp.strXmlDocumentDTDFilePath;
                XmlNode[] xmlNodeByTagname = XmlCommomOp.GetXmlNodeByTagname(_node.Name);
                if (xmlNodeByTagname == null || xmlNodeByTagname.Length <= 0)
                {
                    result = DrawType.None;
                }
                else
                {
                    XmlNode[] array = xmlNodeByTagname;
                    for (int i = 0; i < array.Length; i++)
                    {
                        XmlNode xmlNode    = array[i];
                        XmlNode parentNode = xmlNode.ParentNode;
                        if (parentNode != null)
                        {
                            if (parentNode.Name.ToLower().Trim().Equals("SupportLabels".ToLower()))
                            {
                                XmlElement xmlElement = (XmlElement)xmlNode;
                                foreach (XmlAttribute xmlAttribute in xmlElement.Attributes)
                                {
                                    if (xmlAttribute.Name.ToLower().Equals("DrawType".ToLower()))
                                    {
                                        string text = xmlAttribute.Value.ToLower();
                                        if (text.Equals("string"))
                                        {
                                            result = DrawType.String;
                                            return(result);
                                        }
                                        if (text.Equals("line"))
                                        {
                                            result = DrawType.Line;
                                            return(result);
                                        }
                                        if (text.Equals("image"))
                                        {
                                            result = DrawType.Image;
                                            return(result);
                                        }
                                        if (text.Equals("fillrectangle"))
                                        {
                                            result = DrawType.FillRectangle;
                                            return(result);
                                        }
                                        if (text.Equals("rectangle"))
                                        {
                                            result = DrawType.Rectangle;
                                            return(result);
                                        }
                                        if (text.Equals("circle"))
                                        {
                                            result = DrawType.Circle;
                                            return(result);
                                        }
                                        result = DrawType.None;
                                        return(result);
                                    }
                                }
                            }
                        }
                    }
                    result = DrawType.None;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }