예제 #1
0
        public static BFLAN.Header FromXml(string text)
        {
            BFLAN.Header header = new BFLAN.Header();

            XmlSerializer serializer = new XmlSerializer(typeof(XmlRoot));
            XmlRoot       flyt       = (XmlRoot)serializer.Deserialize(new StringReader(text));

            return(header);
        }
예제 #2
0
        public static string ToXml(BFLAN.Header header)
        {
            XmlRoot root = new XmlRoot();

            root.head = new Head();
            root.body = new Body();

            var generator = new Generator();

            root.head.generator = generator;
            generator.name      = "ST";
            generator.version   = "1.0"
            ;
            var create = new Create();

            root.head.create = create;
            create.date      = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss");

            BinaryInfo info = new BinaryInfo();

            info.layout.name     = header.AnimationTag.Name;
            info.version.major   = (byte)header.VersionMajor;
            info.version.minor   = (byte)header.VersionMinor;
            info.version.micro   = (byte)header.VersionMicro;
            info.version.micro2  = (byte)header.VersionMicro2;
            root.head.binaryInfo = info;

            AnimTag  tag      = new AnimTag();
            AnimInfo animInfo = new AnimInfo();

            if (header.AnimationInfo.Loop)
            {
                tag.animLoop = AnimLoopType.Loop;
            }

            tag.descendingBind = header.AnimationTag.ChildBinding;
            tag.name           = header.AnimationTag.Name;
            tag.fileName       = header.AnimationTag.Name;
            tag.startFrame     = header.AnimationTag.StartFrame;
            tag.endFrame       = header.AnimationTag.EndFrame;
            tag.group          = new Group[header.AnimationTag.Groups.Count];
            for (int i = 0; i < header.AnimationTag.Groups.Count; i++)
            {
                tag.group[i]      = new Group();
                tag.group[i].name = header.AnimationTag.Groups[i];
            }

            root.body.animTag[0] = tag;
            root.body.lan[0]     = animInfo;

            var bflanInfo   = header.AnimationInfo;
            var animContent = new AnimContent();

            animInfo.animContent    = new AnimContent[1];
            animInfo.animContent[0] = animContent;
            animInfo.startFrame     = bflanInfo.FrameSize;



            XmlWriterSettings settings = new XmlWriterSettings
            {
                Encoding    = Encoding.UTF8,
                Indent      = true,
                IndentChars = "  ",
            };


            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

            ns.Add("", "");

            XmlDocument    doc     = new XmlDocument();
            XmlDeclaration xmldecl = doc.CreateXmlDeclaration("1.0", null, null);

            xmldecl.Encoding   = "UTF-8";
            xmldecl.Standalone = "yes";

            var           stringWriter = new StringWriter();
            XmlSerializer serializer   = new XmlSerializer(typeof(XmlRoot));
            XmlWriter     output       = XmlWriter.Create(stringWriter, settings);

            serializer.Serialize(output, root, ns);
            return(stringWriter.ToString());
        }
예제 #3
0
 public static string ToXml(BFLAN.Header header)
 {
     return("");
 }
예제 #4
0
 public static BFLAN.Header FromXml(string text)
 {
     BFLAN.Header header = new BFLAN.Header();
     return(header);
 }