Ejemplo n.º 1
0
        /// <summary>
        /// Packageを保存します。
        /// </summary>
        /// <param name="info"></param>
        public override void SavePackage(XmlContentsPackageWriteInfo info)
        {
            string             filename = info.FileName;
            XmlContentsPackage package  = info.Package;
            XmlWriter          writer   = XmlWriter.Create(filename, new XmlWriterSettings()
            {
                Indent = true, IndentChars = "\t"
            });


            try {
                writer.WriteStartDocument();
                writer.WriteStartElement(package.PackageRootElement);
                writer.WriteAttributeString(package.PackageRootCountAttribute, package.XmlContentsTable.Count.ToString());
                writer.WriteAttributeString(package.PackageRootVersionAttribute, this.Version);
                foreach (XmlContents contents in package.XmlContentsTable.Values)
                {
                    XmlContentsWriteInfo contentsInfo = new XmlContentsWriteInfo()
                    {
                        Writer   = writer,
                        Contents = contents
                    };
                    this.SaveContents(contentsInfo);
                    //contents.SaveFile(writer);
                }
                writer.WriteEndElement();
                writer.WriteEndDocument();
            }
            finally {
                if (writer != null)
                {
                    writer.Close();
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 派生クラスでオーバーライドされると、Packageの保存を行うメソッドを定義します。
 /// </summary>
 /// <param name="info"></param>
 public abstract void SavePackage(XmlContentsPackageWriteInfo info);