/// <summary>
        /// Creates an instance of the DatabasePackage class based on the provided DatabasePackage
        /// </summary>
        /// <param name="packageToCopy">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 DatabasePackage(DatabasePackage packageToCopy, bool deep)
        {
            this.PackageName  = packageToCopy.PackageName;
            this.Version      = packageToCopy.Version;
            this.Timestamp    = packageToCopy.Timestamp;
            this.ZipFile      = packageToCopy.ZipFile;
            this.CRC          = packageToCopy.CRC;
            this.StartAddress = packageToCopy.StartAddress;
            this.EndAddress   = packageToCopy.EndAddress;
            this.LogAtInstall = packageToCopy.LogAtInstall;
            this.Triggers     = new List <string>();
            this.DevURL       = packageToCopy.DevURL;
            this.InstallGroup = packageToCopy.InstallGroup;
            this.PatchGroup   = packageToCopy.PatchGroup;
            //don't call the property for enabled, just the internal field
            this._Enabled = packageToCopy._Enabled;

            if (deep)
            {
                foreach (string s in packageToCopy.Triggers)
                {
                    this.Triggers.Add(s);
                }
            }
        }
Exemplo n.º 2
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.º 3
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.º 4
0
 /// <summary>
 /// Creates an instance of the DatabasePackage class based on the provided DatabasePackage
 /// </summary>
 /// <param name="packageToCopy">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 DatabasePackage(DatabasePackage packageToCopy, bool deep)
 {
     this.PackageName  = packageToCopy.PackageName;
     this.Version      = packageToCopy.Version;
     this.Timestamp    = packageToCopy.Timestamp;
     this.ZipFile      = packageToCopy.ZipFile;
     this.CRC          = packageToCopy.CRC;
     this.StartAddress = packageToCopy.StartAddress;
     this.EndAddress   = packageToCopy.EndAddress;
     this.LogAtInstall = packageToCopy.LogAtInstall;
     this.Triggers     = packageToCopy.Triggers;
     this.DevURL       = packageToCopy.DevURL;
     this.InstallGroup = packageToCopy.InstallGroup;
     this.PatchGroup   = packageToCopy.PatchGroup;
     this.Maintainers  = packageToCopy.Maintainers;
     this.UID          = packageToCopy.UID;
     //don't call the property for enabled, just the internal field
     this._Enabled = packageToCopy._Enabled;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Gets a list of fields (including from base classes) that can be parsed as xml elements
 /// </summary>
 /// <returns>The string list</returns>
 new public static List <string> FieldsToXmlParseNodes()
 {
     return(DatabasePackage.FieldsToXmlParseNodes().Concat(DependencyElementsToXmlParseNodes).ToList());
 }
Exemplo n.º 6
0
 /// <summary>
 /// Gets a list of fields (including from base classes) that can be parsed as xml attributes
 /// </summary>
 /// <returns>The string list</returns>
 new public static List <string> FieldsToXmlParseAttributes()
 {
     //https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/versioning-with-the-override-and-new-keywords
     return(DatabasePackage.FieldsToXmlParseAttributes());
 }
 /// <summary>
 /// Gets a list of fields (including from base classes) that can be parsed as xml attributes
 /// </summary>
 /// <returns>The string list</returns>
 new public static List <string> FieldsToXmlParseAttributes()
 {
     return(DatabasePackage.FieldsToXmlParseAttributes().Concat(SelectableElementsToXmlParseAttributes).ToList());
 }