示例#1
0
 private void UpdateSelectedPackage(object sender, MouseButtonEventArgs e)
 {
     if (String.IsNullOrWhiteSpace(tbNewVersion.Text))
     {
         DialogBox.Show("Error", "New Version has NOT been set!", "Alright");
     }
     else if (Lpkg.Version.Equals(tbNewVersion.Text))
     {
         DialogBox.Show("Error", "Entered Version is the same as previous!", "Alright");
     }
     else if (cbPackages.SelectedIndex == -1)
     {
         DialogBox.Show("Error", "No Package selected !", "Alright");
     }
     else
     {
         Lpkg.Version = tbNewVersion.Text;
         // move new debfile
         CommonFunctions.UpdateDebfile(Lpkg);
         // generate depictions
         DepictionEngineSileo.Create(Lpkg);
         DepictionEngineCydia.Create(Lpkg);
         // generate package entry
         CommonFunctions.GeneratePackageEntry(Lpkg);
         // serialize and save object entry
         InternalPackageManager.SerializeEntry(Lpkg);
     }
 }
        private async void UpdatePackages(object sender, MouseButtonEventArgs e)
        {
            if (isDebfileSelected != true && areFieldsSet() == false && isIconSelected && isBannerSelected)
            {
                DialogBox.Show("Error", "Some fields are missing, please check again!", "Alright");
            }
            else
            {
                // set package props
                tbAPProgress.Foreground = Brushes.Black;
                tbAPProgress.Text       = "Working...";
                await Task.Delay(2000);

                pkg.PackageID        = tbPackageID.Text;
                pkg.Name             = tbName.Text;
                pkg.Depends          = tbDepends.Text;
                pkg.Conflicts        = tbConflicts.Text;
                pkg.Maintainer       = tbMaintainer.Text;
                pkg.Author           = tbAuthor.Text;
                pkg.Version          = tbVersion.Text;
                pkg.Section          = cbSection.Text;
                pkg.MinIOS           = tbMinOS.Text;
                pkg.MaxIOS           = tbMaxOS.Text;
                pkg.DescriptionShort = tbDesc.Text;
                pkg.MD5      = CommonFunctions.calculateHash("MD5", pkg.FilePathLOCAL);
                pkg.SHA1     = CommonFunctions.calculateHash("SHA1", pkg.FilePathLOCAL);
                pkg.SHA256   = CommonFunctions.calculateHash("SHA256", pkg.FilePathLOCAL);
                pkg.FileSize = CommonFunctions.calculateFilesize(pkg.FilePathLOCAL).ToString();
                // be sure at this point everything is correctly named & moved into their directories
                CommonFunctions.MoveRepoFiles(pkg);
                pkg.RepoFilePath = Homescreen.prefs.Homepage + "/debs/" + pkg.PackageID + "_" + pkg.Version + ".deb";
                pkg.IconURL      = Homescreen.prefs.Homepage + "/assets/" + pkg.PackageID + "_icon.png";
                pkg.BannerURL    = Homescreen.prefs.Homepage + "/assets/" + pkg.PackageID + "_banner.png";
                // generate depictions
                DepictionEngineSileo.Create(pkg);
                DepictionEngineCydia.Create(pkg);
                // generate package entry
                CommonFunctions.GeneratePackageEntry(pkg);
                // create the corresponding bz2
                CommonFunctions.GenerateBZ2();
                // serialize and save object entry
                InternalPackageManager.SerializeEntry(pkg);
                // At this point we are done
                tbAPProgress.Text       = "Done!";
                tbAPProgress.Foreground = Brushes.Green;
            }
        }