WixSharp.Project.Project C# (CSharp) Method

Project() public method

Initializes a new instance of the Project class.
public Project ( string name ) : System
name string The name of the project. Typically it is the name of the product to be installed.
return System
        public Project(string name, params WixObject[] items)
        {
            Name = name;
            OutFileName = name;

            var dirs = new List<Dir>();
            var actions = new List<Action>();
            var regs = new List<RegValue>();
            var envvars = new List<EnvironmentVariable>();
            var props = new List<Property>();
            var bins = new List<Binary>();
            var users = new List<User>();
            var sqls = new List<SqlDatabase>();
            var certs = new List<Certificate>();

            //var collections = items.Where(x=>x is WixItems).Sel

            foreach (WixObject obj in items)
            {
                var rawItems = new List<WixObject>();
                if (obj is WixItems)
                    rawItems.AddRange((obj as WixItems).Items);
                else
                    rawItems.Add(obj);

                foreach (WixObject item in rawItems)
                {
                    if (item is LaunchCondition)
                        LaunchConditions.Add(item as LaunchCondition);
                    else if (item is Dir)
                        dirs.Add(item as Dir);
                    else if (item is Action)
                        actions.Add(item as Action);
                    else if (item is RegValue)
                        regs.Add(item as RegValue);
                    else if (item is EnvironmentVariable)
                        envvars.Add(item as EnvironmentVariable);
                    else if (item is RegFile)
                    {
                        var file = item as RegFile;
                        var values = Tasks.ImportRegFile(file.Path);
                        if (file.Feature != null)
                            values.ForEach(x => x.Feature = file.Feature);
                        regs.AddRange(values);
                    }
                    else if (item is Property || item is PropertyRef)
                        props.Add(item as Property);
                    else if (item is Binary)
                        bins.Add(item as Binary);
                    else if (item is WixGuid)
                        GUID = (item as WixGuid).Value;
                    else if (item is User)
                        users.Add(item as User);
                    else if (item is SqlDatabase)
                        sqls.Add(item as SqlDatabase);
                    else if (item is Certificate)
                        certs.Add(item as Certificate);
                    else
                        throw new Exception("Unexpected object type is among Project constructor arguments: " + item.GetType().Name);
                }
            }

            Dirs = dirs.ToArray();
            Actions = actions.ToArray();
            RegValues = regs.ToArray();
            Properties = props.ToArray();
            Binaries = bins.ToArray();
            EnvironmentVariables = envvars.ToArray();
            Users = users.ToArray();
            SqlDatabases = sqls.ToArray();
            Certificates = certs.ToArray();
        }

Same methods

Project::Project ( ) : System