Exemplo n.º 1
0
        public static string ToXml(BymlFileData data)
        {
            CustomStringWriter str = new CustomStringWriter(Encoding.GetEncoding(932));
            XmlTextWriter      xr;

            xr            = new XmlTextWriter(str);
            xr.Formatting = System.Xml.Formatting.Indented;
            xr.WriteStartDocument();
            xr.WriteStartElement("Root");
            xr.WriteStartElement("isBigEndian");
            xr.WriteAttributeString("Value", (data.byteOrder == Syroot.BinaryData.ByteOrder.BigEndian).ToString());
            xr.WriteEndElement();
            xr.WriteStartElement("BymlFormatVersion");
            xr.WriteAttributeString("Value", data.Version.ToString());
            xr.WriteEndElement();
            xr.WriteStartElement("SupportPaths");
            xr.WriteAttributeString("Value", data.SupportPaths.ToString());
            xr.WriteEndElement();

            xr.WriteStartElement("BymlRoot");
            WriteNode(data.RootNode, null, xr);
            xr.WriteEndElement();

            xr.WriteEndElement();
            xr.Close();
            return(str.ToString());
        }
Exemplo n.º 2
0
        public static string MakeXML(ref Dictionary <string, string> ccnt_r)
        {
            CustomStringWriter str = new CustomStringWriter(Encoding.Default);
            XmlTextWriter      xr;

            xr            = new XmlTextWriter(str);
            xr.Formatting = System.Xml.Formatting.Indented;
            xr.WriteStartDocument();
            xr.WriteStartElement("Root");
            xr.WriteStartElement("isBigEndian");
            xr.WriteAttributeString("Value", "False");
            xr.WriteEndElement();
            xr.WriteStartElement("BymlFormatVersion");
            xr.WriteAttributeString("Value", ((uint)1).ToString());
            xr.WriteEndElement();
            xr.WriteStartElement("C0"); //Byml Root
            foreach (string k in ccnt_r.Keys.ToArray())
            {
                xr.WriteStartElement("C1");
                xr.WriteStartElement("A0");
                xr.WriteAttributeString("Name", "ClassName");
                xr.WriteAttributeString("StringValue", ccnt_r[k]);
                xr.WriteEndElement();
                xr.WriteStartElement("A0");
                xr.WriteAttributeString("Name", "ObjectName");
                xr.WriteAttributeString("StringValue", k);
                xr.WriteEndElement();
                xr.WriteEndElement();
            }
            xr.WriteEndElement();
            xr.WriteEndElement();
            xr.Close();
            return(str.ToString());
        }