Example #1
0
        /* =========================================================================================== */


        internal static Package CreatePackage(ISnPatch patch)
        {
            var package = new Package
            {
                ComponentId      = patch.ComponentId,
                ComponentVersion = patch.Version,
                Description      = patch.Description,
                ReleaseDate      = patch.ReleaseDate,
                PackageType      = patch.Type,
                ExecutionDate    = patch.ExecutionDate,
                ExecutionResult  = patch.ExecutionResult,
                ExecutionError   = patch.ExecutionError
            };

            Dependency[] dependencies;
            if (patch is SnPatch snPatch)
            {
                var selfDependency = new Dependency {
                    Id = snPatch.ComponentId, Boundary = snPatch.Boundary
                };
                if (patch.Dependencies == null)
                {
                    dependencies = new[] { selfDependency };
                }
                else
                {
                    var list = patch.Dependencies.ToList();
                    list.Insert(0, selfDependency);
                    dependencies = list.ToArray();
                }
            }
            else
            {
                dependencies = patch.Dependencies.ToArray();
            }

            package.Manifest = Manifest.Create(package, dependencies, false).ToXmlString();

            return(package);
        }
Example #2
0
 private void ModifyStateInDb(ISnPatch patch, ExecutionResult result, Exception exception)
 {
     PackageManager.SavePackage(Manifest.Create(patch), result, exception);
 }
Example #3
0
 private void WriteInitialStateToDb(ISnPatch patch)
 {
     PackageManager.SaveInitialPackage(Manifest.Create(patch));
 }