예제 #1
0
        public static string ToXml(PTCL.Header header)
        {
            var root = new EmitterSetData();

            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(EmitterSetData));
            XmlWriter     output       = XmlWriter.Create(stringWriter, settings);

            serializer.Serialize(output, root, ns);
            return(stringWriter.ToString());
        }
예제 #2
0
            public void Write(FileWriter writer, PTCL.Header header)
            {
                switch (Signature)
                {
                case "GRSN":
                    SaveHeader(writer, header, BinaryDataBytes, 4096);
                    break;

                case "GRSC":
                    SaveHeader(writer, header, BinaryDataBytes, 4096);
                    break;

                case "G3PR":
                    SaveHeader(writer, header, ((BFRES)BinaryData).Save(), 4096);
                    //  SaveHeader(writer, header, BinaryDataBytes, 4096);
                    break;

                case "GRTF":
                    SaveHeader(writer, header, ((BNTX)BinaryData).Save(), 4096);
                    // SaveHeader(writer, header, BinaryDataBytes, 4096);
                    break;

                case "EMTR":
                    //Write all the data first
                    long _emitterPos = writer.Position;
                    writer.Write(data);
                    foreach (var child in ChildSections)
                    {
                        child.Write(writer, header);
                    }

                    using (writer.TemporarySeek(_emitterPos + BinaryDataOffset + 16 + 64, SeekOrigin.Begin))
                    {
                        ((Emitter)BinaryData).Write(writer, header);
                    }
                    break;

                default:
                    writer.Write(data);
                    foreach (var child in ChildSections)
                    {
                        child.Write(writer, header);
                    }
                    break;
                }


                /*      writer.Write(Signature);
                *     writer.Write(SectionSize);
                *     writer.Write(SubSectionOffset);
                *     writer.Write(NextSectionOffset);
                *     writer.Write(Unkown);
                *     writer.Write(Unkown3);
                *     writer.Write(SubSectionCount);*/
            }
예제 #3
0
        public void Load(System.IO.Stream stream)
        {
            Text = FileName;

            FileReader reader = new FileReader(stream);

            reader.Seek(4096, System.IO.SeekOrigin.Begin);

            PTCL pctl = new PTCL();

            pctl.Text = "Output.pctl";
            Nodes.Add(pctl);

            PTCL.Header Header = new PTCL.Header();
            Header.Read(reader, pctl);
        }