Example #1
0
        //Validate if upgrade package is correct.
        internal static bool CheckUpgradeDetail(string upgradeFolder)
        {
            var releaseNotes = Path.Combine(upgradeFolder, UpgradePackageUltility.ReleaseNoteFile);

            if (File.Exists(releaseNotes))
            {
                UpgradePackage activePackage;
                var            packages = UpgradePackageUltility.LoadUpgradePackagesReleaseNotes(releaseNotes, out activePackage);

                if (packages != null && packages.Count > 0)
                {
                    if (activePackage != null && !string.IsNullOrEmpty(activePackage.PackageName))
                    {
                        var packageFile = Path.Combine(upgradeFolder,
                                                       string.Format("{0}{1}", activePackage.PackageName,
                                                                     UpgradePackageUltility.PackageFileExtension));

                        if (File.Exists(packageFile))
                        {
                            return(true);
                        }
                    }
                }
            }
            else
            {
                return(false);
            }

            return(false);
        }
Example #2
0
        //Clean up local folder, then release current upgrade package.
        private static void CleanAndRelease(string zipFilePath, string targetPath)
        {
            //Upgrade package not found, do nothing.
            if (string.IsNullOrEmpty(zipFilePath) || string.IsNullOrEmpty(targetPath))
            {
                return;
            }

            CleanUpgradePackage(targetPath);

            //Unpack the upgrade package zip to USB.
            UpgradePackageUltility.ExtractToDirectory(zipFilePath, targetPath);
        }