Beispiel #1
0
    public MainForm(ProgramArguments args) : this()
    {
      try
      {
        if (File.Exists(args.PackageFile))
        {
          ApplicationSettings.Instance.DoUpdateInStartUp = false;
          InstallFile(args.PackageFile, args.Silent, false);
        }
        else if (args.Update)
        {
          ApplicationSettings.Instance.DoUpdateInStartUp = false;
          RefreshListControls();
          DoUpdateAll(false);
        }
        else if (args.MpQueue)
        {
          ApplicationSettings.Instance.DoUpdateInStartUp = false;
          if (args.Splash)
          {
            splashScreen.SetImg(args.BackGround);
            splashScreen.Show();
            splashScreen.Update();
          }
          ExecuteMpQueue();
          if (splashScreen.Visible)
            splashScreen.Close();
        }
        else if (args.UninstallPackage)
        {
          if (string.IsNullOrEmpty(args.PackageID)) return;
          PackageClass pc = MpeCore.MpeInstaller.InstalledExtensions.Get(args.PackageID);
          if (pc == null) return;

          UnInstall dlg = new UnInstall();
          dlg.Execute(pc, args.Silent);
        }
      }
      catch (Exception ex)
      {
        MessageBox.Show(ex.ToString());
      }
      finally
      {
        this.Close();
      }
    }
Beispiel #2
0
    public void InstallFile(string file, bool silent, bool gui)
    {
      if (!File.Exists(file))
      {
        if (!silent)
          MessageBox.Show("File not found !");
        return;
      }

      if (IsOldFormat(file))
      {
        if (!silent)
          MessageBox.Show("This is an old format file (mpi).  The extension will NOT be installed. ");
        return;
      }
      MpeCore.MpeInstaller.Init();
      PackageClass pak = new PackageClass();
      pak = pak.ZipProvider.Load(file);
      if (pak == null)
      {
        if (!silent)
          MessageBox.Show("Wrong file format !");
        return;
      }
      if (pak.CheckDependency(false))
      {
        PackageClass installedPak = MpeCore.MpeInstaller.InstalledExtensions.Get(pak.GeneralInfo.Id);
        if (installedPak != null)
        {
          if (pak.GeneralInfo.Params[ParamNamesConst.FORCE_TO_UNINSTALL_ON_UPDATE].GetValueAsBool())
          {
            if (!silent)
              if (
                MessageBox.Show(
                  "Another version of this extension is installed\nand needs to be uninstalled first.\nDo you want to continue?\n" +
                  "Old extension version: " + installedPak.GeneralInfo.Version + "\n" +
                  "New extension version: " + pak.GeneralInfo.Version,
                  "Install extension", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)
                return;
            UnInstall dlg = new UnInstall();
            dlg.Execute(installedPak, true);
            pak.CopyGroupCheck(installedPak);
          }
          else
          {
			  MpeCore.MpeInstaller.InstalledExtensions.Remove(installedPak);
          }
        }
        if (gui)
          this.Hide();
        pak.Silent = silent;
        pak.StartInstallWizard();
        if (gui)
        {
          SetFilterForKnownExtensionsList();
          RefreshListControls();
          this.Show();
        }
      }
      else
      {
        if (!silent)
        {
          if (MessageBox.Show("Dependency check error! Install aborted!\nWould you like to view more details?", pak.GeneralInfo.Name, 
            MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
          {
            DependencyForm frm = new DependencyForm(pak);
            frm.ShowDialog();
          }
        }
      }
    }
Beispiel #3
0
 private void extensionListControl_UnInstallExtension(object sender, PackageClass packageClass)
 {
   UnInstall dlg = new UnInstall();
   if (dlg.Execute(packageClass, false))
   {
     RefreshListControls();
   }
 }
Beispiel #4
0
 private bool DoUpdate(PackageClass packageClass, PackageClass newpackageClass, bool silent)
 {
   string newPackageLoacation = ExtensionUpdateDownloader.GetPackageLocation(newpackageClass, Client_DownloadProgressChanged, Client_DownloadFileCompleted);
   if (!File.Exists(newPackageLoacation))
   {
     if (!silent)
       MessageBox.Show("Can't locate the installer package. Update aborted");
     return false;
   }
   PackageClass pak = new PackageClass();
   pak = pak.ZipProvider.Load(newPackageLoacation);
   if (pak == null)
   {
     if (!silent)
       MessageBox.Show("Invalid package format ! Update aborted !");
     return false;
   }
   if (pak.GeneralInfo.Id != newpackageClass.GeneralInfo.Id ||
       pak.GeneralInfo.Version.CompareTo(newpackageClass.GeneralInfo.Version) < 0)
   {
     if (!silent)
       MessageBox.Show("Invalid update information ! Update aborted!");
     return false;
   }
   if (!pak.CheckDependency(false))
   {
     if (!silent)
     {
       if (MessageBox.Show("Dependency check error! Update aborted!\nWould you like to view more details?", pak.GeneralInfo.Name,
         MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
       {
         DependencyForm frm = new DependencyForm(pak);
         frm.ShowDialog();
       }
     }
     return false;
   }
   if (!silent)
     if (
       MessageBox.Show(
         "This operation will update the extension " + packageClass.GeneralInfo.Name + " to the version " +
         pak.GeneralInfo.Version + " \n Do you want to continue ? ", "Install extension", MessageBoxButtons.YesNo,
         MessageBoxIcon.Exclamation) != DialogResult.Yes)
       return false;
   // only uninstall previous version, if the new package has the setting to force uninstall of previous version on update
   if (pak.GeneralInfo.Params[ParamNamesConst.FORCE_TO_UNINSTALL_ON_UPDATE].GetValueAsBool())
   {
     UnInstall dlg = new UnInstall();
     dlg.Execute(packageClass, true);
   }
   else
   {
     MpeCore.MpeInstaller.InstalledExtensions.Remove(packageClass);
   }
   pak.CopyGroupCheck(packageClass);
   pak.Silent = true;
   pak.StartInstallWizard();
   return true;
 }
Beispiel #5
0
    private void extensionListControl_InstallExtension(object sender, PackageClass packageClass)
    {
      string newPackageLoacation = ExtensionUpdateDownloader.GetPackageLocation(packageClass, Client_DownloadProgressChanged, Client_DownloadFileCompleted);
      if (!File.Exists(newPackageLoacation))
      {
        MessageBox.Show("Can't locate the installer package. Install aborted");
        return;
      }
      PackageClass pak = new PackageClass();
      pak = pak.ZipProvider.Load(newPackageLoacation);
      if (pak == null)
      {
        MessageBox.Show("Package loading error ! Install aborted!");
        try
        {
          if (newPackageLoacation != packageClass.GeneralInfo.Location)
            File.Delete(newPackageLoacation);
        }
        catch { }
        return;
      }
      if (!pak.CheckDependency(false))
      {
        if (MessageBox.Show("Dependency check error! Install aborted!\nWould you like to view more details?", pak.GeneralInfo.Name,
          MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
        {
          DependencyForm frm = new DependencyForm(pak);
          frm.ShowDialog();
        }
        pak.ZipProvider.Dispose();
        try
        {
          if (newPackageLoacation != packageClass.GeneralInfo.Location)
            File.Delete(newPackageLoacation);
        }
        catch { }
        return;
      }

      if (packageClass.GeneralInfo.Version.CompareTo(pak.GeneralInfo.Version) != 0)
      {
        if (MessageBox.Show(
          string.Format(@"Downloaded version of {0} is {1} and differs from your selected version: {2}!
Do you want to continue ?",packageClass.GeneralInfo.Name, pak.GeneralInfo.Version,packageClass.GeneralInfo.Version), "Install extension", MessageBoxButtons.YesNo,
          MessageBoxIcon.Error) != DialogResult.Yes)
        return;
      }

      if (
        MessageBox.Show(
          "This operation will install " + packageClass.GeneralInfo.Name + " version " +
          pak.GeneralInfo.Version + "\n Do you want to continue ?", "Install extension", MessageBoxButtons.YesNo,
          MessageBoxIcon.Exclamation) != DialogResult.Yes)
        return;
      this.Hide();
      packageClass = MpeCore.MpeInstaller.InstalledExtensions.Get(packageClass.GeneralInfo.Id);
      if (packageClass != null)
      {
        if (pak.GeneralInfo.Params[ParamNamesConst.FORCE_TO_UNINSTALL_ON_UPDATE].GetValueAsBool())
        {
          if (
            MessageBox.Show(
              "Another version of this extension is installed\nand needs to be uninstalled first.\nDo you want to continue?\n" +
              "Old extension version: " + packageClass.GeneralInfo.Version + "\n" +
              "New extension version: " + pak.GeneralInfo.Version,
              "Install extension", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)
          {
            this.Show();
            return;
          }
          UnInstall dlg = new UnInstall();
          dlg.Execute(packageClass, false);
        }
        else
        {
          MpeCore.MpeInstaller.InstalledExtensions.Remove(packageClass);
        }
        pak.CopyGroupCheck(packageClass);
      }
      pak.StartInstallWizard();
      RefreshListControls();
      pak.ZipProvider.Dispose();
      try
      {
        if (newPackageLoacation != packageClass.GeneralInfo.Location)
          File.Delete(newPackageLoacation);
      }
      catch { }
      this.Show();
    }
Beispiel #6
0
 public void ExecuteQueue()
 {
   //UpdateList(true);
   QueueCommandCollection collection = QueueCommandCollection.Load();
   // close all MP processes without message box, because executing the queue is called from within MP from GUI plugin which warns the user already
   if (collection.Items.Count > 0) Util.KillAllMediaPortalProcesses(true);
   foreach (QueueCommand item in collection.Items)
   {
     switch (item.CommandEnum)
     {
       case CommandEnum.Install:
         {
           PackageClass packageClass = MpeCore.MpeInstaller.KnownExtensions.Get(item.TargetId,
                                                                                item.TargetVersion.
                                                                                  ToString());
           if (packageClass == null)
             continue;
           splashScreen.SetInfo("Installing " + packageClass.GeneralInfo.Name);
           string newPackageLoacation = ExtensionUpdateDownloader.GetPackageLocation(packageClass, Client_DownloadProgressChanged, Client_DownloadFileCompleted);
           InstallFile(newPackageLoacation, true, false);
         }
         break;
       case CommandEnum.Uninstall:
         {
           PackageClass packageClass = MpeCore.MpeInstaller.InstalledExtensions.Get(item.TargetId);
           if (packageClass == null)
             continue;
           splashScreen.SetInfo("UnInstalling " + packageClass.GeneralInfo.Name);
           UnInstall dlg = new UnInstall();
           dlg.Execute(packageClass, true);
         }
         break;
       default:
         break;
     }
   }
   collection.Items.Clear();
   collection.Save();
 }
Beispiel #7
0
 public void ExecuteQueue()
 {
   //UpdateList(true);
   QueueCommandCollection collection = QueueCommandCollection.Load();
   foreach (QueueCommand item in collection.Items)
   {
     switch (item.CommandEnum)
     {
       case CommandEnum.Install:
         {
           PackageClass packageClass = MpeCore.MpeInstaller.KnownExtensions.Get(item.TargetId,
                                                                                item.TargetVersion.
                                                                                  ToString());
           if (packageClass == null)
             continue;
           splashScreen.SetInfo("Installing " + packageClass.GeneralInfo.Name);
           string newPackageLoacation = ExtensionUpdateDownloader.GetPackageLocation(packageClass, Client_DownloadProgressChanged, Client_DownloadFileCompleted);
           InstallFile(newPackageLoacation, true, false);
         }
         break;
       case CommandEnum.Uninstall:
         {
           PackageClass packageClass = MpeCore.MpeInstaller.InstalledExtensions.Get(item.TargetId);
           if (packageClass == null)
             continue;
           splashScreen.SetInfo("UnInstalling " + packageClass.GeneralInfo.Name);
           UnInstall dlg = new UnInstall();
           dlg.Execute(packageClass, true);
         }
         break;
       default:
         break;
     }
   }
   collection.Items.Clear();
   collection.Save();
 }