Exemplo n.º 1
0
        /// <summary>
        /// Create an instance of the Dependency class and over-ride DatabasePackage default values, while using values provided for copy objects
        /// </summary>
        /// <param name="packageToCopyFrom">The package to copy the information from</param>
        /// <param name="deep">Set to true to copy list objects, false to use new lists</param>
        public Dependency(DatabasePackage packageToCopyFrom, bool deep) : base(packageToCopyFrom, deep)
        {
            InstallGroup = 2;
            PatchGroup   = 2;
            if (packageToCopyFrom is Dependency dep)
            {
#pragma warning disable CS0618 // Type or member is obsolete
                this.wasLogicalDependencyLegacy = dep.wasLogicalDependencyLegacy;
                this.DatabasePackageLogic       = new List <DatabaseLogic>();
                this.Dependencies = new List <DatabaseLogic>();
#pragma warning restore CS0618 // Type or member is obsolete

                if (deep)
                {
                    foreach (DatabaseLogic logic in dep.Dependencies)
                    {
                        this.Dependencies.Add(DatabaseLogic.Copy(logic));
                    }
                }
            }
            else if (packageToCopyFrom is SelectablePackage sp)
            {
                this.Dependencies = new List <DatabaseLogic>();
                if (deep)
                {
                    foreach (DatabaseLogic logic in sp.Dependencies)
                    {
                        this.Dependencies.Add(DatabaseLogic.Copy(logic));
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create an instance of the SelectablePackage class and over-ride DatabasePackage default values, while using values provided for copy objects
        /// </summary>
        /// <param name="packageToCopyFrom">The package to copy the information from</param>
        /// <param name="deep">Set to true to copy list objects, false to use new lists</param>
        public SelectablePackage(DatabasePackage packageToCopyFrom, bool deep) : base(packageToCopyFrom, deep)
        {
            InstallGroup = 4;
            PatchGroup   = 4;

            if (packageToCopyFrom is Dependency dep)
            {
                if (deep)
                {
                    foreach (DatabaseLogic file in dep.Dependencies)
                    {
                        this.Dependencies.Add(DatabaseLogic.Copy(file));
                    }
                }
            }
            else if (packageToCopyFrom is SelectablePackage sp)
            {
                this.Type    = sp.Type;
                this.Name    = "WRITE_NEW_NAME";
                this.Visible = sp.Visible;
                this.Size    = 0;

                this.UpdateComment = string.Empty;
                this.Description   = string.Empty;
                this.PopularMod    = false;
                this._Checked      = false;

                this.Level               = -2;
                this.UserFiles           = new List <UserFile>();
                this.Packages            = new List <SelectablePackage>();
                this.Medias              = new List <Media>();
                this.Dependencies        = new List <DatabaseLogic>();
                this.ConflictingPackages = string.Empty;
                this.ShowInSearchList    = sp.ShowInSearchList;

                if (deep)
                {
                    this.UpdateComment = sp.UpdateComment;
                    this.Description   = sp.Description;
                    this.PopularMod    = sp.PopularMod;
                    this._Checked      = sp._Checked;

                    foreach (UserFile file in this.UserFiles)
                    {
                        this.UserFiles.Add(UserFile.DeepCopy(file));
                    }

                    foreach (Media file in this.Medias)
                    {
                        this.Medias.Add(Media.Copy(file));
                    }

                    foreach (DatabaseLogic file in this.Dependencies)
                    {
                        this.Dependencies.Add(DatabaseLogic.Copy(file));
                    }
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Create a copy of the given DatabaseLogic object
 /// </summary>
 /// <param name="databaseLogicToCopy">The object to copy</param>
 /// <returns>A new DatabaseLogic object with the same values</returns>
 public static DatabaseLogic Copy(DatabaseLogic databaseLogicToCopy)
 {
     return(new DatabaseLogic()
     {
         Logic = databaseLogicToCopy.Logic,
         NotFlag = databaseLogicToCopy.NotFlag,
         PackageName = databaseLogicToCopy.PackageName,
         WillBeInstalled = databaseLogicToCopy.WillBeInstalled
     });
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create a copy of the given DatabaseLogic object
 /// </summary>
 /// <param name="databaseLogicToCopy">The object to copy</param>
 /// <returns>A new DatabaseLogic object with the same values</returns>
 public static DatabaseLogic Copy(DatabaseLogic databaseLogicToCopy)
 {
     return(new DatabaseLogic()
     {
         PackageName = databaseLogicToCopy.PackageName,
         PackageUID = databaseLogicToCopy.PackageUID,
         WillBeInstalled = databaseLogicToCopy.WillBeInstalled,
         NotFlag = databaseLogicToCopy.NotFlag,
         Logic = databaseLogicToCopy.Logic,
         RefrenceLinked = databaseLogicToCopy.RefrenceLinked,
         DependencyPackageRefrence = databaseLogicToCopy.DependencyPackageRefrence,
         ParentPackageRefrence = databaseLogicToCopy.ParentPackageRefrence
     });
 }