Пример #1
0
 public AddFolder2Group(PackageClass packageClass, GroupItem groupItem, string folder)
 {
   Init();
   _groupItem = groupItem;
   txt_folder.Text = folder;
   Package = packageClass;
 }
Пример #2
0
 /// <summary>
 /// Adds the specified group.
 /// </summary>
 /// <param name="item">The group item.</param>
 public void Add(GroupItem item)
 {
   Items.Add(item);
 }
Пример #3
0
    private void btn_done_Click(object sender, EventArgs e)
    {
      if (string.IsNullOrEmpty(txt_skinpath.Text))
      {
        MessageBox.Show("No skin folder specified !");
        return;
      }
      Package.GeneralInfo.Name = txt_name.Text;
      Package.GeneralInfo.Author = txt_author.Text;
      Package.GeneralInfo.Version = new VersionInfo()
                                      {
                                        Major = txt_version1.Text,
                                        Minor = txt_version2.Text,
                                        Build = txt_version3.Text,
                                        Revision = txt_version4.Text
                                      };
      string fontName = Path.GetFileName(txt_skinpath.Text);

      #region Skin 

      GroupItem skinGroup = new GroupItem("Skin files");
      FolderGroup skinfoldergroup = new FolderGroup()
                                      {
                                        DestinationFilename = "%Skin%\\" + fontName,
                                        Folder = txt_skinpath.Text,
                                        InstallType = "CopyFile",
                                        UpdateOption = UpdateOptionEnum.OverwriteIfOlder,
                                        Param1 = "",
                                        Recursive = true,
                                        Group = skinGroup.Name
                                      };
      Package.Groups.Add(skinGroup);
      Package.ProjectSettings.Add(skinfoldergroup);
      ProjectSettings.UpdateFiles(Package, skinfoldergroup);

      #endregion

      #region fonts 

      if (!string.IsNullOrEmpty(txt_font1.Text + txt_font2.Text + txt_font3.Text))
      {
        GroupItem fontGroup = new GroupItem("Font files");
        if (!string.IsNullOrEmpty(txt_font1.Text) && File.Exists(txt_font1.Text))
        {
          FileItem fileitem = new FileItem
                                {
                                  DestinationFilename =
                                    "%Skin%\\" + fontName + "\\Fonts\\" + Path.GetFileName(txt_font1.Text),
                                  InstallType = "CopyFont",
                                  LocalFileName = Path.GetFullPath(txt_font1.Text)
                                };
          fontGroup.Files.Add(fileitem);
        }

        if (!string.IsNullOrEmpty(txt_font2.Text) && File.Exists(txt_font2.Text))
        {
          FileItem fileitem = new FileItem
                                {
                                  DestinationFilename =
                                    "%Skin%\\" + fontName + "\\Fonts\\" + Path.GetFileName(txt_font2.Text),
                                  InstallType = "CopyFont",
                                  LocalFileName = Path.GetFullPath(txt_font2.Text)
                                };
          fontGroup.Files.Add(fileitem);
        }

        if (!string.IsNullOrEmpty(txt_font3.Text) && File.Exists(txt_font3.Text))
        {
          FileItem fileitem = new FileItem
                                {
                                  DestinationFilename =
                                    "%Skin%\\" + fontName + "\\Fonts\\" + Path.GetFileName(txt_font3.Text),
                                  InstallType = "CopyFont",
                                  LocalFileName = Path.GetFullPath(txt_font3.Text)
                                };
          fontGroup.Files.Add(fileitem);
        }

        Package.Groups.Add(fontGroup);
      }

      #endregion

      #region dlls %Plugins%

      if (!string.IsNullOrEmpty(txt_plugin_procces.Text + txt_plugin_window.Text + txt_plugin_exe.Text))
      {
        GroupItem dllGroup = new GroupItem("Plugin files");
        if (!string.IsNullOrEmpty(txt_plugin_procces.Text) && File.Exists(txt_plugin_procces.Text))
        {
          FileItem fileitem = new FileItem
                                {
                                  DestinationFilename =
                                    "%Plugins%\\process\\" + Path.GetFileName(txt_plugin_procces.Text),
                                  InstallType = "CopyFile",
                                  LocalFileName = Path.GetFullPath(txt_plugin_procces.Text)
                                };
          dllGroup.Files.Add(fileitem);
        }

        if (!string.IsNullOrEmpty(txt_plugin_window.Text) && File.Exists(txt_plugin_window.Text))
        {
          FileItem fileitem = new FileItem
                                {
                                  DestinationFilename =
                                    "%Plugins%\\Windows\\" + Path.GetFileName(txt_plugin_window.Text),
                                  InstallType = "CopyFile",
                                  LocalFileName = Path.GetFullPath(txt_plugin_window.Text)
                                };
          dllGroup.Files.Add(fileitem);
        }

        if (!string.IsNullOrEmpty(txt_plugin_exe.Text) && File.Exists(txt_plugin_exe.Text))
        {
          FileItem fileitem = new FileItem
                                {
                                  DestinationFilename =
                                    "%Base%\\" + Path.GetFileName(txt_plugin_exe.Text),
                                  InstallType = "CopyFile",
                                  LocalFileName = Path.GetFullPath(txt_plugin_exe.Text)
                                };
          dllGroup.Files.Add(fileitem);
        }

        Package.Groups.Add(dllGroup);
      }

      #endregion

      #region install sections

      Package.Sections.Add("Welcome Screen").WizardButtonsEnum = WizardButtonsEnum.NextCancel;
      Package.Sections.Add("Install Section").WizardButtonsEnum = WizardButtonsEnum.Next;
      var item = new ActionItem("InstallFiles")
                   {
                     Params =
                       new SectionParamCollection(
                       MpeInstaller.ActionProviders["InstallFiles"].GetDefaultParams())
                   };
      Package.Sections.Items[1].Actions.Add(item);
      Package.Sections.Add("Setup Complete").WizardButtonsEnum = WizardButtonsEnum.Finish;

      #endregion

      #region config

      if (radioButton1.Checked && File.Exists(txt_plugin_procces.Text))
        Package.GeneralInfo.Params[ParamNamesConst.CONFIG].Value = "%Plugins%\\process\\" +
                                                                   Path.GetFileName(txt_plugin_procces.Text);
      if (radioButton1.Checked && File.Exists(txt_plugin_window.Text))
        Package.GeneralInfo.Params[ParamNamesConst.CONFIG].Value = "%Plugins%\\Windows\\" +
                                                                   Path.GetFileName(txt_plugin_window.Text);
      if (radioButton1.Checked && File.Exists(txt_plugin_exe.Text))
        Package.GeneralInfo.Params[ParamNamesConst.CONFIG].Value = "%Base%\\" +
                                                                   Path.GetFileName(txt_plugin_exe.Text);
      if (File.Exists(txt_ico.Text))
      {
        string icofile = Path.GetFullPath(txt_ico.Text);
        Package.GeneralInfo.Params[ParamNamesConst.ICON].Value = icofile;
        Package.Sections.Items[0].Params[ParamNamesConst.SECTION_ICON].Value = icofile;
        Package.Sections.Items[1].Params[ParamNamesConst.SECTION_ICON].Value = icofile;
        Package.Sections.Items[2].Params[ParamNamesConst.SECTION_ICON].Value = icofile;
      }
      Package.GeneralInfo.Location = txt_mpe_folder.Text + "\\" + Package.GeneralInfo.Name + ".mpe1";

      #endregion

      Close();
    }
Пример #4
0
 public InstallEventArgs(string description)
 {
   Group = new GroupItem();
   Item = new FileItem();
   Description = description;
 }
Пример #5
0
 public InstallEventArgs(GroupItem groupItem, FileItem fileItem)
 {
   Group = groupItem;
   Item = fileItem;
   Description = string.Empty;
 }
Пример #6
0
 public void Set(GroupItem item)
 {
   group = item;
   txt_name.Text = item.Name;
   txt_displayname.Text = item.DisplayName;
 }
Пример #7
0
 public AddFolder2Group(PackageClass packageClass, GroupItem groupItem)
 {
   Init();
   _groupItem = groupItem;
   Package = packageClass;
 }
    private static FileItem GetCommonItem(GroupItem groupItem)
    {
      var resp = new FileItem();
      if (groupItem.Files.Items.Count > 0)
      {
        resp.DestinationFilename = string.IsNullOrEmpty(groupItem.Files.Items[0].DestinationFilename)
                                     ? ""
                                     : Path.GetDirectoryName(groupItem.Files.Items[0].DestinationFilename);
        resp.UpdateOption = groupItem.Files.Items[0].UpdateOption;
        resp.InstallType = groupItem.Files.Items[0].InstallType;
        resp.Param1 = groupItem.Files.Items[0].Param1;

        foreach (FileItem item in groupItem.Files.Items)
        {
          if (string.IsNullOrEmpty(item.DestinationFilename) ||
              resp.DestinationFilename != Path.GetDirectoryName(item.DestinationFilename))
            resp.DestinationFilename = "";
          if (resp.UpdateOption != item.UpdateOption)
            resp.UpdateOption = UpdateOptionEnum.OverwriteIfOlder;
          if (resp.InstallType != item.InstallType)
            resp.InstallType = "CopyFile";
          if (resp.Param1 != item.Param1)
            resp.Param1 = string.Empty;
        }
      }
      return resp;
    }
 private void mnu_add_group_Click(object sender, EventArgs e)
 {
   GroupEdit dlg = new GroupEdit();
   GroupItem group = new GroupItem();
   group.Name = string.Format("Group{0}", Package.Groups.Items.Count);
   dlg.Set(group);
   if (dlg.ShowDialog() == DialogResult.OK)
   {
     AddGroup(dlg.Get());
     Package.Groups.Add(group);
   }
 }
 private TreeNode AddGroup(GroupItem group)
 {
   TreeNode node = new TreeNode
                     {
                       Text = group.Name,
                       Tag = group,
                       ToolTipText = group.DisplayName,
                       ImageKey = ImageKeyGroup,
                       SelectedImageKey = ImageKeyGroup
                     };
   treeView1.Nodes.Add(node);
   return node;
 }