Ejemplo n.º 1
0
        /// <summary>
        /// Saves the package builder data to disk.
        /// </summary>
        /// <param name="outputPath">Path to save the output builder to.</param>
        public void Save(string outputPath)
        {
            Serialize.ClickThrough ct = new Serialize.ClickThrough();

            // package serialization
            Serialize.Package package = new Serialize.Package();
            package.AddChild(this.manufacturerName);

            Serialize.Feed feed = new Serialize.Feed();
            if (this.updateUrl != null)
            {
                feed.Content = this.updateUrl.AbsoluteUri;
            }
            package.AddChild(feed);

            if (this.description.Content != null && this.description.Content.Length > 0)
            {
                package.AddChild(this.description);
            }
            ct.AddChild(package);

            // application serialization
            Serialize.Application application = new Serialize.Application();
            application.AddChild(this.applicationName);
            application.AddChild(this.applicationRoot);
            application.AddChild(this.applicationEntry);

            if (this.icon.Content != null && this.icon.Content.Length > 0)
            {
                application.AddChild(icon);
            }
            ct.AddChild(application);

            Serialize.PreviousPackage previousPackage = new Serialize.PreviousPackage();
            previousPackage.Content = this.previousPackagePath;
            ct.AddChild(previousPackage);

            // serialize the data to disk
            using (StreamWriter sw = new StreamWriter(outputPath))
            {
                XmlTextWriter writer = new XmlTextWriter(sw);
                writer.Formatting  = Formatting.Indented;
                writer.Indentation = 4;

                ct.OutputXml(writer);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves the package builder data to disk.
        /// </summary>
        /// <param name="outputPath">Path to save the output builder to.</param>
        public void Save(string outputPath)
        {
            Serialize.ClickThrough ct = new Serialize.ClickThrough();

            // package serialization
            Serialize.Package package = new Serialize.Package();
            package.AddChild(this.manufacturerName);

            Serialize.Feed feed = new Serialize.Feed();
            if (this.updateUrl != null)
            {
                feed.Content = this.updateUrl.AbsoluteUri;
            }
            package.AddChild(feed);

            if (this.description.Content != null && this.description.Content.Length > 0)
            {
                package.AddChild(this.description);
            }
            ct.AddChild(package);

            // application serialization
            Serialize.Application application = new Serialize.Application();
            application.AddChild(this.applicationName);
            application.AddChild(this.applicationRoot);
            application.AddChild(this.applicationEntry);

            if (this.icon.Content != null && this.icon.Content.Length > 0)
            {
                application.AddChild(icon);
            }
            ct.AddChild(application);

            Serialize.PreviousPackage previousPackage = new Serialize.PreviousPackage();
            previousPackage.Content = this.previousPackagePath;
            ct.AddChild(previousPackage);

            // serialize the data to disk
            using (StreamWriter sw = new StreamWriter(outputPath))
            {
                XmlTextWriter writer = new XmlTextWriter(sw);
                writer.Formatting = Formatting.Indented;
                writer.Indentation = 4;

                ct.OutputXml(writer);
            }
        }