예제 #1
0
 /// <summary>
 /// 将CodeBox信息写入XML文件
 /// </summary>
 /// <param name="writer">XML对象</param>
 /// <param name="box">CodeBox对象</param>
 public static void WriteCodeBoxAribute(XmlTextWriter writer, CodeBox box)
 {
     writer.WriteStartElement("CodeBox");
     writer.WriteAttributeString("Title", box.Title);
     writer.WriteAttributeString("HitText", box.Hint);
     writer.WriteAttributeString("PositionX", box.GetPosition().X.ToString());
     writer.WriteAttributeString("PositionY", box.GetPosition().Y.ToString());
     writer.WriteAttributeString("ID", box.Id.ToString());
     writer.WriteAttributeString("CodeBoxType", box.CodeBoxType.ToString());
     writer.WriteAttributeString("SystemCodeString", box.SystemCodeString);
     writer.WriteAttributeString("ReturnValueName", box.ReturnValueName);
     ///写入左边属性
     writer.WriteStartElement("LeftXAribute");
     foreach (XAribute node in box.LeftAribute.Children)
     {
         WriteXAribute(writer, node);
     }
     ///结束写入左边边属性
     writer.WriteEndElement();
     writer.WriteStartElement("RightXAribute");
     foreach (XAribute node in box.RightAribute.Children)
     {
         WriteXAribute(writer, node);
     }
     ///结束写入右边属性
     writer.WriteEndElement();
     writer.WriteEndElement();
 }
예제 #2
0
        /// <summary>
        /// 更新Codebox的内容
        /// </summary>
        /// <param name="update">更新内容的节点</param>
        /// <param name="codeboxfather">父节点</param>
        /// <param name="box">代码块</param>
        public static void UpdateCodeBoxAribute(XmlDocument update, XmlElement codeboxfather, CodeBox box)
        {
            XmlElement codedata = update.CreateElement("CodeBox");

            codedata.SetAttribute("Title", box.Title);
            codedata.SetAttribute("HitText", box.Hint);
            codedata.SetAttribute("PositionX", box.GetPosition().X.ToString());
            codedata.SetAttribute("PositionY", box.GetPosition().Y.ToString());
            codedata.SetAttribute("ID", box.Id.ToString());
            codedata.SetAttribute("CodeBoxType", box.CodeBoxType.ToString());
            codedata.SetAttribute("SystemCodeString", box.SystemCodeString);
            codedata.SetAttribute("ReturnValueName", box.ReturnValueName);
            ///更新左边属性
            XmlElement LeftXAributedata = update.CreateElement("LeftXAribute");

            foreach (XAribute node in box.LeftAribute.Children)
            {
                UpdateXAribute(update, LeftXAributedata, node);
            }
            codedata.AppendChild(LeftXAributedata);
            ///更新右边边属性
            XmlElement RightXAributedata = update.CreateElement("RightXAribute");

            foreach (XAribute node in box.RightAribute.Children)
            {
                UpdateXAribute(update, RightXAributedata, node);
            }
            codedata.AppendChild(RightXAributedata);
            ///添加节点
            codeboxfather.AppendChild(codedata);
        }