Пример #1
0
        public static Serialize.ApplicationList GetApplicationList()
        {
            Serialize.Application     con  = null;
            Serialize.ApplicationList coll = new Serialize.ApplicationList();

            using (TurbineModelContainer container = new TurbineModelContainer())
            {
                System.Data.Objects.ObjectQuery <Turbine.Data.Application> query = container.Applications;
                foreach (Turbine.Data.Application entity in query)
                {
                    con        = new Serialize.Application();
                    con.Name   = entity.Name;
                    con.Inputs = new Serialize.InputTypeList();

                    foreach (InputFileType i in entity.InputFileTypes)
                    {
                        con.Inputs.Add(new Serialize.InputType()
                        {
                            Name = i.Name, Type = i.Type, Required = i.Required
                        });
                    }
                    coll.Add(con);
                }
            }
            return(coll);
        }
Пример #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);
            }
        }
Пример #3
0
        public static Serialize.Application GetApplication(string appname)
        {
            Serialize.Application con = null;
            using (TurbineModelContainer container = new TurbineModelContainer())
            {
                var entity = container.Applications.Single <Turbine.Data.Application>(s => s.Name == appname);
                con        = new Serialize.Application();
                con.Name   = entity.Name;
                con.Inputs = new Serialize.InputTypeList();

                foreach (InputFileType i in entity.InputFileTypes)
                {
                    con.Inputs.Add(new Serialize.InputType()
                    {
                        Name = i.Name, Type = i.Type, Required = i.Required
                    });
                }
            }
            return(con);
        }
Пример #4
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);
            }
        }