Esempio n. 1
0
        private static ApplicationList FromXml(XmlReader reader)
        {
            ApplicationList list = new ApplicationList();

            // Read through the root node
            reader.ReadStartElement();

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name.Equals(Resources.Application) && !reader.IsEmptyElement)
                    {
                        ApplicationItem ai = ApplicationItem.FromXml(reader);
                        list.XmlErrors.AddRange(ai.XmlErrors);
                        list.applicationItems.Add(ai);
                    }
                    else if (reader.Name.Equals(Resources.InstallationOptions) && !reader.IsEmptyElement)
                    {
                        list.installationOptions = InstallationOptions.FromXml(reader);
                        list.XmlErrors.AddRange(list.installationOptions.XmlErrors);
                    }
                    else
                    {
                        list.XmlErrors.Add(String.Format("{0}: \"{1}\"", Resources.AppListXmlUnknown, reader.Name));
                    }
                }
            }
            return(list);
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize with an application item
        /// </summary>
        /// <param name="item"></param>
        public ApplicationDialog(ApplicationItem item)
        {
            InitializeComponent();
            this.applicationItem       = item;
            this.ApplicationName       = item.Name;
            this.DownloadUrl           = item.DownloadUrl;
            this.DownloadLatestVersion = item.Options.DownloadLatestVersion;
            this.SilentInstall         = item.Options.SilentInstall;
            this.InstallerArguments    = item.Options.InstallerArguments;
            this.Comment          = item.Comment;
            this.CheckedByDefault = item.Options.CheckedByDefault;
            this.InstallationRoot = item.Options.InstallationRoot;

            // if no app specific installation root, default to applist.installationroot.
            if (this.InstallationRoot == null || this.InstallationRoot.Length == 0)
            {
                this.InstallationRoot = InstallPadApp.AppList.InstallationOptions.InstallationRoot;
                // but preferences overrides applist installation options!
                if (InstallPadApp.Preferences.InstallationRoot != string.Empty)
                {
                    this.InstallationRoot = InstallPadApp.Preferences.InstallationRoot;
                }
            }

            Init();
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a list item and listens to its events
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        private ApplicationListItem CreateApplicationListItem(ApplicationItem item)
        {
            ApplicationListItem listItem = new ApplicationListItem(item);

            listItem.FinishedDownloading  += new EventHandler(HandleFinishedDownloading);
            listItem.FinishedInstalling   += new EventHandler(HandleFinishedInstalling);
            listItem.FinishedUnInstalling += new EventHandler(HandleFinishedUnInstalling);
            return(listItem);
        }
Esempio n. 4
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            this.saved = true;

            // If this wasn't used to edit an ApplicationItem, create a new one
            if (this.applicationItem == null)
            {
                this.applicationItem = new ApplicationItem();
            }

            ModifyApplicationItemFromDialog(this.applicationItem);

            this.Close();
        }
Esempio n. 5
0
        private static string ArgumentsForSilentInstall(ApplicationItem application)
        {
            // Coding in special rules here for apps. Each of these special rules should be moved
            // to another class, or a seperate file. Make sure there is a space before the command line arguments.

            // TODO: externalize this information. Put it in a .ini or .config file accessible by users?
            // Each rule should be on its own line; first, a regex to match the application name, and next to it,
            // the installer arguments that pertain to that app

            if (application.FileName.ToLower().EndsWith(".msi"))
            {
                return("/qn");
            }
            else if (application.FileName.ToLower().Contains("firefox"))
            {
                return("-ms");
            }
            else if (application.FileName.ToLower().Contains("itunessetup"))
            {
                // Args are: /s /v"SILENT_INSTALL=1 ALLUSERS=1 /qb"
                //return "/s /v\"SILENT_INSTALL=1 ALLUSERS=1 /qb\"";

                // Above is for the older iTunes. Newer itunes is just an exe that extracts to an msi.
                return("/qn");
            }
            else if (application.FileName.ToLower().Contains("quicktimeinstaller"))
            {
                // QuickTime is just an MSI, like iTunes
                return("/qn");
            }
            else if (application.FileName.ToLower().Contains("spybot"))
            {
                return("/VERYSILENT");
            }
            else if (application.FileName.ToLower().Contains("adberdr"))
            {
                // Adobe Acrobat Reader. Argh adobe...
                return("/S /w /v\"/qb-! /norestart EULA_ACCEPT=YES\"");
            }
            else
            {
                // This will work for most installers - /S for nullsoft installers, and -s for InstallShield
                return("/S -s");
            }
        }
Esempio n. 6
0
        public void ModifyApplicationItemFromDialog(ApplicationItem item)
        {
            item.Name        = this.ApplicationName;
            item.DownloadUrl = this.DownloadUrl;
            item.Comment     = this.Comment;
            item.Options.DownloadLatestVersion = this.DownloadLatestVersion;
            item.Options.SilentInstall         = this.SilentInstall;
            item.Options.InstallerArguments    = this.InstallerArguments;
            item.Options.CheckedByDefault      = this.CheckedByDefault;

            item.DetectVersion();

            // Setting InstallationRoot is disabled for now until the rules are decided.
            // Could allow setting Options, but probably wouldn't want to allow setting
            // AppList, and\or Preferences.  Might be confusing either way.

            // Maybe there should be no GUI for installation root except via preferences.
        }
        /// <summary>
        /// Initialize this with the information from an ApplicationItem
        /// </summary>
        /// <param name="application"></param>
        public ApplicationListItem(ApplicationItem application)
            : this()
        {
            this.ApplicationItem = application;
            this.Controls.Add(downloadErrorBox);
            AddErrorBoxes();

            downloader = new FileDownloader();
            ProxyOptions options = InstallPadApp.AppList.InstallationOptions.ProxyOptions;

            if (options != null)
            {
                downloader.Proxy = options.ProxyFromOptions();
            }

            downloader.ProgressChanged  += new DownloadProgressHandler(downloader_ProgressChanged);
            downloader.DownloadComplete += new EventHandler(downloader_DownloadComplete);

            this.Checked = this.ApplicationItem.Options.CheckedByDefault;
            this.labelName.MouseClick += new MouseEventHandler(labelName_MouseClick);
        }
Esempio n. 8
0
        /// <summary>
        /// Initialize with an application item
        /// </summary>
        /// <param name="item"></param>
        public ApplicationDialog(ApplicationItem item)
        {
            InitializeComponent();
            this.applicationItem = item;
            this.ApplicationName = item.Name;
            this.DownloadUrl = item.DownloadUrl;
            this.DownloadLatestVersion = item.Options.DownloadLatestVersion;
            this.SilentInstall = item.Options.SilentInstall;
            this.InstallerArguments = item.Options.InstallerArguments;
            this.Comment = item.Comment;
            this.CheckedByDefault = item.Options.CheckedByDefault;
            this.InstallationRoot = item.Options.InstallationRoot;

            // if no app specific installation root, default to applist.installationroot.
            if (this.InstallationRoot==null || this.InstallationRoot.Length == 0)
            {
                this.InstallationRoot = InstallPadApp.AppList.InstallationOptions.InstallationRoot;
                // but preferences overrides applist installation options!
                if (InstallPadApp.Preferences.InstallationRoot != string.Empty)
                    this.InstallationRoot = InstallPadApp.Preferences.InstallationRoot;
            }

            Init();
        }
Esempio n. 9
0
        public static ApplicationItem FromXml(XmlReader reader)
        {
            ApplicationItem item = new ApplicationItem();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    if (reader.Name == Resources.Name)
                    {
                        if (reader.IsEmptyElement == false)
                        {
                            item.Name = reader.ReadString();
                            reader.ReadEndElement();
                        }
                    }
                    else if (reader.Name == Resources.FileUrl)
                    {
                        if (reader.IsEmptyElement == false)
                        {
                            item.DownloadUrl = reader.ReadString();
                            reader.ReadEndElement();
                        }
                    }
                    else if (reader.Name == Resources.Comment)
                    {
                        if (reader.IsEmptyElement == false)
                        {
                            item.Comment = reader.ReadString();
                            reader.ReadEndElement();
                        }
                    }
                    // Get the HomePage URL and link Caption.
                    else if (reader.Name == Resources.HomePageUrl)
                    {
                        if (reader.IsEmptyElement == false)
                        {
                            item.HomePageUrl = reader.ReadString();
                            reader.ReadEndElement();
                        }
                    }
                    else if (reader.Name == Resources.Options)
                    {
                        item.Options = ApplicationItemOptions.FromXml(reader);
                        item.XmlErrors.AddRange(item.options.XmlErrors);
                    }
                    else
                    {
                        item.XmlErrors.Add(
                            String.Format("{0}: \"{1}\"", Resources.AppListUnknownElement, reader.Name));
                    }
                    break;

                case XmlNodeType.EndElement:
                    if (reader.Name == Resources.Application)
                    {
                        item.DetectVersion();
                        return(item);
                    }
                    break;
                }
            }
            item.DetectVersion();
            return(item);
        }
Esempio n. 10
0
 /// <summary>
 /// Creates a list item and listens to its events
 /// </summary>
 /// <param name="?"></param>
 /// <returns></returns>
 private ApplicationListItem CreateApplicationListItem(ApplicationItem item)
 {
     ApplicationListItem listItem = new ApplicationListItem(item);
     listItem.FinishedDownloading += new EventHandler(HandleFinishedDownloading);
     listItem.FinishedInstalling += new EventHandler(HandleFinishedInstalling);
     listItem.FinishedUnInstalling += new EventHandler(HandleFinishedUnInstalling);
     return listItem;
 }
Esempio n. 11
0
        public static ApplicationItem FromXml(XmlReader reader)
        {
            ApplicationItem item = new ApplicationItem();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        if (reader.Name == Resources.Name)
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                item.Name = reader.ReadString();
                                reader.ReadEndElement();
                            }
                        }
                        else if (reader.Name == Resources.FileUrl)
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                item.DownloadUrl = reader.ReadString();
                                reader.ReadEndElement();
                            }
                        }
                        else if (reader.Name == Resources.Comment)
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                item.Comment = reader.ReadString();
                                reader.ReadEndElement();
                            }
                        }
                        // Get the HomePage URL and link Caption.
                        else if (reader.Name == Resources.HomePageUrl)
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                item.HomePageUrl = reader.ReadString();
                                reader.ReadEndElement();
                            }
                        }
                        else if (reader.Name == Resources.Options)
                        {
                            item.Options = ApplicationItemOptions.FromXml(reader);
                            item.XmlErrors.AddRange(item.options.XmlErrors);
                        }
                        else
                        {
                            item.XmlErrors.Add(
                                String.Format("{0}: \"{1}\"", Resources.AppListUnknownElement, reader.Name));
                        }
                        break;
                    case XmlNodeType.EndElement:
                        if (reader.Name == Resources.Application)
                        {
                            item.DetectVersion();
                            return item;
                        }
                        break;
                }
            }
            item.DetectVersion();
            return item;
        }
Esempio n. 12
0
        public void ModifyApplicationItemFromDialog(ApplicationItem item)
        {
            item.Name = this.ApplicationName;
            item.DownloadUrl = this.DownloadUrl;
            item.Comment = this.Comment;
            item.Options.DownloadLatestVersion = this.DownloadLatestVersion;
            item.Options.SilentInstall = this.SilentInstall;
            item.Options.InstallerArguments = this.InstallerArguments;
            item.Options.CheckedByDefault = this.CheckedByDefault;

            item.DetectVersion();

            // Setting InstallationRoot is disabled for now until the rules are decided.
            // Could allow setting Options, but probably wouldn't want to allow setting
            // AppList, and\or Preferences.  Might be confusing either way.

            // Maybe there should be no GUI for installation root except via preferences.
        }
Esempio n. 13
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            this.saved = true;

            // If this wasn't used to edit an ApplicationItem, create a new one
            if (this.applicationItem == null)
                this.applicationItem = new ApplicationItem();

            ModifyApplicationItemFromDialog(this.applicationItem);
            
            this.Close();
        }
Esempio n. 14
0
        /// <summary>
        /// Initialize this with the information from an ApplicationItem
        /// </summary>
        /// <param name="application"></param>
        public ApplicationListItem(ApplicationItem application)
            : this()
        {
            this.ApplicationItem = application;
            this.Controls.Add(downloadErrorBox);
            AddErrorBoxes();

            downloader = new FileDownloader();
            ProxyOptions options = InstallPadApp.AppList.InstallationOptions.ProxyOptions;
            if (options != null)
                downloader.Proxy = options.ProxyFromOptions();

            downloader.ProgressChanged += new DownloadProgressHandler(downloader_ProgressChanged);
            downloader.DownloadComplete += new EventHandler(downloader_DownloadComplete);

            this.Checked = this.ApplicationItem.Options.CheckedByDefault;
            this.labelName.MouseClick += new MouseEventHandler(labelName_MouseClick);
        }
        private static string ArgumentsForSilentInstall(ApplicationItem application)
        {
            // Coding in special rules here for apps. Each of these special rules should be moved
            // to another class, or a seperate file. Make sure there is a space before the command line arguments.

            // TODO: externalize this information. Put it in a .ini or .config file accessible by users?
            // Each rule should be on its own line; first, a regex to match the application name, and next to it,
            // the installer arguments that pertain to that app

            if (application.FileName.ToLower().EndsWith(".msi"))
            {
                return "/qn";
            }else if (application.FileName.ToLower().Contains("firefox"))
                return "-ms";
            else if (application.FileName.ToLower().Contains("itunessetup"))
            {
                // Args are: /s /v"SILENT_INSTALL=1 ALLUSERS=1 /qb"
                //return "/s /v\"SILENT_INSTALL=1 ALLUSERS=1 /qb\"";

                // Above is for the older iTunes. Newer itunes is just an exe that extracts to an msi.
                return "/qn";
            }
            else if (application.FileName.ToLower().Contains("quicktimeinstaller"))
            {
                // QuickTime is just an MSI, like iTunes
                return "/qn";
            }
            else if (application.FileName.ToLower().Contains("spybot"))
            {
                return "/VERYSILENT";
            }
            else if (application.FileName.ToLower().Contains("adberdr"))
            {
                // Adobe Acrobat Reader. Argh adobe...
                return "/S /w /v\"/qb-! /norestart EULA_ACCEPT=YES\"";
            }
            else
                // This will work for most installers - /S for nullsoft installers, and -s for InstallShield
                return "/S -s";
        }