Example #1
0
        /// <summary>
        /// Saves the package builder data to disk.
        /// </summary>
        /// <param name="path">Path to save the fabricator information.</param>
        public override void Save(string path)
        {
            IA.IsolatedApp isolatedApp = new IA.IsolatedApp();

            // Serialize out the package information.
            IA.Package package = new IA.Package();
            isolatedApp.AddChild(package);

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

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

            if (this.updateRate > 0)
            {
                IA.UpdateRate updateRate = new IA.UpdateRate();
                updateRate.Content = this.updateRate;
                package.AddChild(updateRate);
            }

            if (this.packageId != Guid.Empty)
            {
                IA.Id id = new IA.Id();
                id.Content = this.packageId.ToString();
                package.AddChild(id);
            }

            if (this.manufacturer != null && this.manufacturer.Length > 0)
            {
                IA.Manufacturer manufacturer = new IA.Manufacturer();
                manufacturer.Content = this.manufacturer;
                package.AddChild(manufacturer);
            }

            if (this.appVersion != null)
            {
                IA.Version version = new IA.Version();
                version.Content = this.appVersion.ToString();
                package.AddChild(version);
            }

            // Serialize out the application information.
            IA.Application application = new IA.Application();
            isolatedApp.AddChild(application);

            if (this.details != null && this.details.Length > 0)
            {
                IA.Details details = new IA.Details();
                details.Content = this.details;
                application.AddChild(details);
            }

            if (this.entryPoint != null && this.entryPoint.Length > 0)
            {
                IA.EntryPoint entryPoint = new IA.EntryPoint();
                entryPoint.Content = this.entryPoint;
                application.AddChild(entryPoint);
            }

            if (this.iconPath != null && this.iconPath.Length > 0)
            {
                IA.Icon icon = new IA.Icon();
                icon.Content = this.iconPath;
                application.AddChild(icon);
            }

            if (this.appId != Guid.Empty)
            {
                IA.Id id = new IA.Id();
                id.Content = this.appId.ToString();
                application.AddChild(id);
            }

            if (this.name != null && this.name.Length > 0)
            {
                IA.Name name = new IA.Name();
                name.Content = this.name;
                application.AddChild(name);
            }

            if (this.source != null && this.source.Length > 0)
            {
                IA.Source source = new IA.Source();
                source.Content = this.source;
                application.AddChild(source);
            }

            // Serialize out the previous package path if there is one.
            if (this.previousFeedUrl != null)
            {
                IA.PreviousFeed previousFeed = new IA.PreviousFeed();
                previousFeed.Content = this.previousFeedUrl.AbsoluteUri;
                isolatedApp.AddChild(previousFeed);
            }

            // Serialize the data to disk.
            using (StreamWriter sw = new StreamWriter(path))
            {
                XmlTextWriter writer = null;
                try
                {
                    writer = new XmlTextWriter(sw);
                    writer.Formatting = Formatting.Indented;
                    writer.Indentation = 4;

                    isolatedApp.OutputXml(writer);
                }
                finally
                {
                    if (writer != null)
                    {
                        writer.Close();
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Saves the package builder data to disk.
        /// </summary>
        /// <param name="path">Path to save the fabricator information.</param>
        public override void Save(string path)
        {
            IA.IsolatedApp isolatedApp = new IA.IsolatedApp();

            // Serialize out the package information.
            IA.Package package = new IA.Package();
            isolatedApp.AddChild(package);

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

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

            if (this.updateRate > 0)
            {
                IA.UpdateRate updateRate = new IA.UpdateRate();
                updateRate.Content = this.updateRate;
                package.AddChild(updateRate);
            }

            if (this.packageId != Guid.Empty)
            {
                IA.Id id = new IA.Id();
                id.Content = this.packageId.ToString();
                package.AddChild(id);
            }

            if (this.manufacturer != null && this.manufacturer.Length > 0)
            {
                IA.Manufacturer manufacturer = new IA.Manufacturer();
                manufacturer.Content = this.manufacturer;
                package.AddChild(manufacturer);
            }

            if (this.appVersion != null)
            {
                IA.Version version = new IA.Version();
                version.Content = this.appVersion.ToString();
                package.AddChild(version);
            }

            // Serialize out the application information.
            IA.Application application = new IA.Application();
            isolatedApp.AddChild(application);

            if (this.details != null && this.details.Length > 0)
            {
                IA.Details details = new IA.Details();
                details.Content = this.details;
                application.AddChild(details);
            }

            if (this.entryPoint != null && this.entryPoint.Length > 0)
            {
                IA.EntryPoint entryPoint = new IA.EntryPoint();
                entryPoint.Content = this.entryPoint;
                application.AddChild(entryPoint);
            }

            if (this.iconPath != null && this.iconPath.Length > 0)
            {
                IA.Icon icon = new IA.Icon();
                icon.Content = this.iconPath;
                application.AddChild(icon);
            }

            if (this.appId != Guid.Empty)
            {
                IA.Id id = new IA.Id();
                id.Content = this.appId.ToString();
                application.AddChild(id);
            }

            if (this.name != null && this.name.Length > 0)
            {
                IA.Name name = new IA.Name();
                name.Content = this.name;
                application.AddChild(name);
            }

            if (this.source != null && this.source.Length > 0)
            {
                IA.Source source = new IA.Source();
                source.Content = this.source;
                application.AddChild(source);
            }

            // Serialize out the previous package path if there is one.
            if (this.previousFeedUrl != null)
            {
                IA.PreviousFeed previousFeed = new IA.PreviousFeed();
                previousFeed.Content = this.previousFeedUrl.AbsoluteUri;
                isolatedApp.AddChild(previousFeed);
            }

            // Serialize the data to disk.
            using (StreamWriter sw = new StreamWriter(path))
            {
                XmlTextWriter writer = null;
                try
                {
                    writer             = new XmlTextWriter(sw);
                    writer.Formatting  = Formatting.Indented;
                    writer.Indentation = 4;

                    isolatedApp.OutputXml(writer);
                }
                finally
                {
                    if (writer != null)
                    {
                        writer.Close();
                    }
                }
            }
        }