예제 #1
0
        /// <summary>
        /// Decompress zip archive file.
        /// </summary>
        /// <param name="zipfile">The zip file full filepath.</param>
        /// <param name="extensionstodecompress">The extension of file in the zipfile that are unzipped.</param>
        /// <returns>True if decompress zipfile succeeded.</returns>
        public bool DecompressZipFile(string zipfile, string[] extensionstodecompress)
        {
            bool succeeded = false;

            if (Directory.Exists(this.storefolder) && File.Exists(zipfile))
            {
                ZipStorer zip = null;
                try
                {
                    zip = ZipStorer.Open(zipfile, FileAccess.Read);
                    List <ZipStorer.ZipFileEntry> dir = zip.ReadCentralDir();
                    foreach (ZipStorer.ZipFileEntry entry in dir)
                    {
                        for (int i = 0; i < extensionstodecompress.Length; i++)
                        {
                            if (entry.FilenameInZip.EndsWith(extensionstodecompress[i]))
                            {
                                // disable plugin for as we are updating.
                                PluginsManager.DisablePlugin(entry.FilenameInZip);

                                // extract file
                                if (zip.ExtractFile(entry, Path.Combine(this.storefolder, entry.FilenameInZip)))
                                {
                                    Log.Write(LogType.info, "Extracting " + entry.FilenameInZip + " succeeded.");
                                }
                                else
                                {
                                    Log.Write(LogType.exception, "Extracting " + entry.FilenameInZip + " failed.");
                                }
                            }
                        }
                    }

                    succeeded = true;
                }
                catch (Exception)
                {
                    succeeded = false;
                }
                finally
                {
                    if (zip != null)
                    {
                        zip.Close();
                    }
                }
            }

            return(succeeded);
        }
예제 #2
0
        /// <summary>
        /// Set the tooltips for this control
        /// </summary>
        public void SetControlTooltip(ToolTip tooltip)
        {
            this.tooltip = tooltip;
            if (this.btnPluginsStatus.Length != PluginsManager.InstalledPlugins.Length)
            {
                Log.Write(LogType.exception, "Number of buttons plugins not equal to number of installed buttons, abort SetButtonTooltip");
                return;
            }

            for (int i = 0; i < PluginsManager.InstalledPlugins.Length; i++)
            {
                this.SetButtonTooltip(this.btnPluginsStatus[i], PluginsManager.IsPluginEnabled(PluginsManager.InstalledPlugins[i]));
            }
        }
예제 #3
0
        /// <summary>
        /// Downloading of plugin compleet.
        /// </summary>
        /// <param name="newfiles">Array of files downloads.</param>
        private void downloader_DownloadCompleet(string[] newpluginfile)
        {
            RSAVerify rsaverify = new RSAVerify();

            if (!rsaverify.CheckFileSignatureAndDisplayErrors(newpluginfile[0], this.selectedplugindetails.Signature))
            {
                return;
            }

            this.DecompressDownload(newpluginfile[0]);
            PluginsManager.LoadPlugins();
            this.pluginGrid.DrawAllPluginsDetails(this.tabPagePluginsInstalled.ClientRectangle.Width);
            this.tabControlPlugins.SelectedTab = this.tabPagePluginsInstalled;
        }
예제 #4
0
        /// <summary>
        /// Downloading of a list of allplugins is compleet, parser results and display items in chlbxAvailiblePlugins.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">RunWorkerCompletedEvent Arguments</param>
        private void httputil_allplugins_DownloadCompleet(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            string response = (string)e.Result;

            this.lbxAvailablePlugins.Items.Clear();
            this.lbxAvailablePlugins.Enabled = true;
            if (!xmlUtil.ParserListPlugins(response, PluginsManager.GetIPluginVersion(), this.lbxAvailablePlugins))
            {
                this.SetAvailablePluginsNetwork(false);
            }
            else
            {
                this.SetAvailablePluginsNetwork(true);
            }
        }
예제 #5
0
        /// <summary>
        /// Get if this a plugin that is installed.
        /// </summary>
        /// <returns>True if a plugin with this name is installed.</returns>
        public bool IsInstalledPlugin()
        {
            if (string.IsNullOrEmpty(this.name))
            {
                Log.Write(LogType.error, "Cannot figure out if plugin is installed because plugin name unknow.");
                return(false);
            }

            string[] installedpluginnames = PluginsManager.GetInstalledPlugins();
            for (int i = 0; i < installedpluginnames.Length; i++)
            {
                if (this.name.Equals(installedpluginnames[i], StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #6
0
        /// <summary>
        /// Get if this plugindetails is of newer version than installed.
        /// </summary>
        /// <returns>True if newer DownloadDetailsPlugin version is newer than installed.</returns>
        public bool IsNewerVersion()
        {
            if (string.IsNullOrEmpty(this.name) || string.IsNullOrEmpty(this.version))
            {
                Log.Write(LogType.error, "DownloadDetailsPlugin name and/or versions is unknown.");
                return(false);
            }

            short[] installedpluginversion = PluginsManager.GetPluginVersionByName(this.name);
            short[] availablepluginversion = Program.ParserVersionString(this.version);
            if (Program.CompareVersions(availablepluginversion, installedpluginversion) > 0)
            {
                // 1 if availablepluginversion is higher than installedpluginversion
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #7
0
        /// <summary>
        /// Plugin toggle enabled.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event argument</param>
        private void PluginGrid_Click(object sender, EventArgs e)
        {
            Button btn         = (Button)sender;
            string dllfilename = (string)btn.Tag;

            if (PluginsManager.IsPluginEnabled(dllfilename))
            {
                PluginsManager.DisablePlugin(dllfilename);
            }
            else
            {
                PluginsManager.EnablePlugin(dllfilename);
            }

            int pos = this.FindPos(dllfilename);

            if (pos >= 0)
            {
                this.SetPluginStatus(pos, dllfilename);
            }

            PluginsManager.SaveEnabledPlugins();
            Program.RestartTrayicon();
        }
예제 #8
0
        public static void Main(string[] args)
        {
            /*
             * a suggestion to "protect" against insecure Dynamic Library Loading vulnerability in windows
             * it does not fix it, it makes it harder to exploit insecure dll loading.
             * NoteFly uses APPDATA, TEMP and SystemRoot variables.
             * A subfolder in %APPDATA% is where NoteFly stores it program settings, skins settings, log etc.
             * %TEMP% is needs for logging if appdatafolder is not found.
             * %SystemRoot% is required by the LinkLabel control to work properly.
             * %SystemDrive% is required by NET framework.
             * Plugin developers should not rely on environment variables.
             */
            Program.LoadPlatformOs();
            if (Program.CurrentOS == OS.WINDOWS)
            {
                System.Collections.IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                foreach (System.Collections.DictionaryEntry de in environmentVariables)
                {
                    string currentvariable = de.Key.ToString();
                    if (!currentvariable.Equals("APPDATA", StringComparison.OrdinalIgnoreCase) &&
                        !currentvariable.Equals("SystemRoot", StringComparison.OrdinalIgnoreCase) &&
                        !currentvariable.Equals("SystemDrive", StringComparison.OrdinalIgnoreCase) &&
                        !currentvariable.Equals("TEMP", StringComparison.OrdinalIgnoreCase))
                    {
                        Environment.SetEnvironmentVariable(de.Key.ToString(), null);
                    }
                }

                SetDllDirectory(string.Empty); // removes current working directory as dll search path, but requires kernel32.dll by itself to be looked up.
            }

#if DEBUG
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
#endif

            System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(UnhanledThreadExceptionHandler);
            System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.CatchException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledExceptionHandler);
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(true);
            if (!xmlUtil.LoadSettings())
            {
                // settings.xml does not exist create default settings.xml file
                xmlUtil.WriteDefaultSettings();
                xmlUtil.LoadSettings();
            }

            Program.SetCulture(Settings.ProgramLanguage);
#if DEBUG
            stopwatch.Stop();
            Log.Write(LogType.info, "Settings load time: " + stopwatch.ElapsedMilliseconds + " ms");
#endif
            bool   visualstyle;
            bool   resetpositions;
            bool   newnote = false;
            string newnotetitle;
            string newnotecontent;
            ParserArguments(args, out visualstyle, out resetpositions, out newnote, out newnotetitle, out newnotecontent);
            if (Program.CurrentOS == OS.WINDOWS)
            {
                if (!Settings.ProgramSuspressWarnAdmin)
                {
                    // Security measure, show warning if runned with dangerous administrator rights.
                    System.Security.Principal.WindowsIdentity  identity  = System.Security.Principal.WindowsIdentity.GetCurrent();
                    System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(identity);
                    if (principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator))
                    {
                        string program_runasadministrator           = Strings.T("You are now running {0} as elevated Administrator.\nWhich is not recommended for security.\nPress OK if your understand the risks of running as administrator and want to hide this message in the future.", Program.AssemblyTitle);
                        string program_runasadministratortitle      = Strings.T("Elevated administrator");
                        System.Windows.Forms.DialogResult dlganswer = System.Windows.Forms.MessageBox.Show(program_runasadministrator, program_runasadministratortitle, System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning);
                        if (dlganswer == System.Windows.Forms.DialogResult.OK)
                        {
                            Settings.ProgramSuspressWarnAdmin = true;
                            if (!System.IO.Directory.Exists(Program.AppDataFolder))
                            {
                                Directory.CreateDirectory(Program.AppDataFolder);
                            }

                            xmlUtil.WriteSettings();
                        }
                    }
                }
            }

            if (visualstyle)
            {
                if (Program.CurrentOS == OS.WINDOWS)
                {
                    System.Windows.Forms.Application.EnableVisualStyles();
                }
            }

            bool pluginsupdated = false;
            if (Settings.ProgramPluginsAllEnabled)
            {
                pluginsupdated = PluginsManager.UpdatePluginReplaceFiles();
            }

            if (!pluginsupdated)
            {
                if (Program.CheckInstancesRunning() > 1)
                {
                    string program_alreadyrunning            = Strings.T("{0} is already running.\nLoad another instance? (not recommended)", Program.AssemblyTitle);
                    string program_alreadyrunningtitle       = Strings.T("already running");
                    System.Windows.Forms.DialogResult dlgres = System.Windows.Forms.MessageBox.Show(program_alreadyrunning, program_alreadyrunningtitle, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation);
                    if (dlgres == System.Windows.Forms.DialogResult.No)
                    {
                        // shutdown by don't continue this Main method
                        return;
                    }
                }
            }

            SyntaxHighlight.InitHighlighter();
            Program.notes = new Notes(resetpositions);
            if (Settings.ProgramPluginsAllEnabled)
            {
                PluginsManager.LoadPlugins();
            }

            Program.notes.ShowNotesVisible();
            formmanager = new FormManager(notes);
            trayicon    = new TrayIcon(formmanager);

            if (!Settings.ProgramFirstrunned)
            {
                // disable the firstrun the next time.
                Settings.ProgramFirstrunned = true;
                Settings.UpdatecheckUseGPG  = false;
                GPGVerifyWrapper gpgverif = new GPGVerifyWrapper();
                if (!string.IsNullOrEmpty(gpgverif.GetGPGPath()) && gpgverif != null)
                {
                    Settings.UpdatecheckGPGPath = gpgverif.GetGPGPath();
                    Settings.UpdatecheckUseGPG  = true;
                }

                gpgverif = null;
                Log.Write(LogType.info, "firstrun occur");
                xmlUtil.WriteSettings();
            }

            if (!Settings.ProgramLastrunVersion.Equals(Program.AssemblyVersionAsString, StringComparison.Ordinal))
            {
                Settings.ProgramLastrunVersion = Program.AssemblyVersionAsString;
                xmlUtil.WriteSettings();
                Log.Write(LogType.info, "Updated ProgramLastrunVersion setting.");

                if (PluginsManager.EnabledPlugins != null)
                {
                    for (int p = 0; p < PluginsManager.EnabledPlugins.Count; p++)
                    {
                        PluginsManager.EnabledPlugins[p].ProgramUpgraded();
                    }
                }
            }

            if (Settings.UpdatecheckEverydays > 0)
            {
                DateTime lastupdate = DateTime.Parse(Settings.UpdatecheckLastDate);
                if (lastupdate.AddDays(Settings.UpdatecheckEverydays) <= DateTime.Now)
                {
                    Settings.UpdatecheckLastDate = UpdateGetLatestVersion();
                    xmlUtil.WriteSettings();
                }
            }

            if (newnote)
            {
                formmanager.OpenNewNote(newnotetitle, newnotecontent);
            }
            else
            {
                newnotetitle   = null;
                newnotecontent = null;
            }

            SyntaxHighlight.DeinitHighlighter();
            System.Windows.Forms.Application.Run();
        }
예제 #9
0
        /// <summary>
        /// Draw details of a plugin.
        /// </summary>
        /// <param name="pluginpos">The position of the plugin in allplugins array.</param>
        /// <param name="dllfilename">The dll filename of the plugin assemble.</param>
        /// <param name="gridwith">The width of the plugingrid control.</param>
        private void DrawPluginDetails(int pluginpos, string dllfilename, int gridwith)
        {
            System.Reflection.Assembly pluginassembly = null;
            try
            {
                pluginassembly = System.Reflection.Assembly.LoadFrom(Path.Combine(Settings.ProgramPluginsFolder, dllfilename));
            }
            catch (BadImageFormatException badimgformat)
            {
                Log.Write(LogType.exception, badimgformat.Message);
            }

            this.tlpnlPlugins[pluginpos] = new System.Windows.Forms.TableLayoutPanel();
            Label lblPluginTitle           = new System.Windows.Forms.Label();
            Label lblTextPluginVersion     = new System.Windows.Forms.Label();
            Label lblPluginVersion         = new System.Windows.Forms.Label();
            Label lblTextPluginAuthor      = new System.Windows.Forms.Label();
            Label lblPluginAuthor          = new System.Windows.Forms.Label();
            Label lblTextPluginDescription = new System.Windows.Forms.Label();
            Label lblPluginDescription     = new System.Windows.Forms.Label();

            this.btnPluginsStatus[pluginpos] = new Button();
            this.tlpnlPlugins[pluginpos].SuspendLayout();
            this.tlpnlPlugins[pluginpos].Padding     = new Padding(0);
            this.tlpnlPlugins[pluginpos].Margin      = new Padding(0);
            this.tlpnlPlugins[pluginpos].ColumnCount = 3;
            this.tlpnlPlugins[pluginpos].ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 24.0000F));
            this.tlpnlPlugins[pluginpos].ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 52.0000F));
            this.tlpnlPlugins[pluginpos].ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 24.0000F));
            this.tlpnlPlugins[pluginpos].Controls.Add(lblPluginTitle, 0, 0);
            this.tlpnlPlugins[pluginpos].Controls.Add(this.btnPluginsStatus[pluginpos], 1, 0);
            this.tlpnlPlugins[pluginpos].Controls.Add(lblTextPluginVersion, 0, 1);
            this.tlpnlPlugins[pluginpos].Controls.Add(lblPluginVersion, 1, 1);
            this.tlpnlPlugins[pluginpos].Controls.Add(lblTextPluginAuthor, 0, 2);
            this.tlpnlPlugins[pluginpos].Controls.Add(lblPluginAuthor, 1, 2);
            this.tlpnlPlugins[pluginpos].Controls.Add(lblTextPluginDescription, 0, 3);
            this.tlpnlPlugins[pluginpos].Controls.Add(lblPluginDescription, 1, 3);
            this.tlpnlPlugins[pluginpos].Location = new System.Drawing.Point(3, pluginpos * 100);
            this.tlpnlPlugins[pluginpos].Name     = "tlpnlPlugin";
            this.tlpnlPlugins[pluginpos].RowCount = 4;
            this.tlpnlPlugins[pluginpos].RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
            this.tlpnlPlugins[pluginpos].RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 18F));
            this.tlpnlPlugins[pluginpos].RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 18F));
            this.tlpnlPlugins[pluginpos].RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 23F));
            this.tlpnlPlugins[pluginpos].Size     = new System.Drawing.Size(gridwith, 99);
            this.tlpnlPlugins[pluginpos].TabIndex = 4;

            // lblPluginTitle
            lblPluginTitle.AutoSize = true;
            this.tlpnlPlugins[pluginpos].SetColumnSpan(lblPluginTitle, 2);
            lblPluginTitle.Font     = new System.Drawing.Font("Microsoft Sans Serif", 14.00F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (byte)0);
            lblPluginTitle.Location = new System.Drawing.Point(3, 0);
            lblPluginTitle.Name     = "lblPluginTitle";
            lblPluginTitle.Size     = new System.Drawing.Size(240, 25);
            lblPluginTitle.TabIndex = 1;
            lblPluginTitle.UseCompatibleTextRendering = true;
            if (pluginassembly != null)
            {
                lblPluginTitle.Text = PluginsManager.GetPluginName(pluginassembly);
            }
            else
            {
                lblPluginTitle.Text = dllfilename;
            }

            // lblTextPluginVersion
            lblTextPluginVersion.AutoSize = true;
            lblTextPluginVersion.Location = new System.Drawing.Point(3, 37);
            lblTextPluginVersion.Name     = "lblTextPluginVersion";
            lblTextPluginVersion.Size     = new System.Drawing.Size(44, 13);
            lblTextPluginVersion.TabIndex = 6;
            lblTextPluginVersion.UseCompatibleTextRendering = true;
            lblTextPluginVersion.Text = Strings.T("version:");

            // lblPluginVersion
            lblPluginVersion.AutoSize = true;
            this.tlpnlPlugins[pluginpos].SetColumnSpan(lblPluginVersion, 2);
            lblPluginVersion.Location = new System.Drawing.Point(102, 37);
            lblPluginVersion.Name     = "lblPluginVersion";
            lblPluginVersion.TabIndex = 7;
            lblTextPluginVersion.UseCompatibleTextRendering = true;
            if (pluginassembly != null)
            {
                lblPluginVersion.Text = PluginsManager.GetPluginVersion(pluginassembly);
            }

            if (File.Exists(Path.Combine(Program.GetNewPluginFolder(false), dllfilename)))
            {
                lblPluginVersion.Text += " " + Strings.T("(restart {0} to update)", Program.AssemblyTitle);
            }

            // lblTextPluginAuthor
            lblTextPluginAuthor.AutoSize = true;
            lblTextPluginAuthor.Location = new System.Drawing.Point(3, 53);
            lblTextPluginAuthor.Name     = "lblTextPluginAuthor";
            lblTextPluginAuthor.Size     = new System.Drawing.Size(40, 13);
            lblTextPluginAuthor.TabIndex = 8;
            lblTextPluginAuthor.UseCompatibleTextRendering = true;
            lblTextPluginAuthor.Text = Strings.T("author:");

            // lblPluginAuthor
            lblPluginAuthor.AutoSize = true;
            this.tlpnlPlugins[pluginpos].SetColumnSpan(lblPluginAuthor, 2);
            lblPluginAuthor.Location = new System.Drawing.Point(102, 53);
            lblPluginAuthor.Name     = "lblPluginAuthor";
            lblPluginAuthor.TabIndex = 9;
            lblPluginAuthor.UseCompatibleTextRendering = true;
            if (pluginassembly != null)
            {
                lblPluginAuthor.Text = PluginsManager.GetPluginAuthor(pluginassembly);
            }

            // lblTextPluginDescription
            lblTextPluginDescription.AutoSize = true;
            lblTextPluginDescription.Location = new System.Drawing.Point(3, 70);
            lblTextPluginDescription.Name     = "lblTextPluginDescription";
            lblTextPluginDescription.Size     = new System.Drawing.Size(68, 13);
            lblTextPluginDescription.TabIndex = 10;
            lblTextPluginDescription.UseCompatibleTextRendering = true;
            lblTextPluginDescription.Text = Strings.T("description:");

            // lblPluginDescription
            lblPluginDescription.AutoSize = true;
            this.tlpnlPlugins[pluginpos].SetColumnSpan(lblPluginDescription, 2);
            lblPluginDescription.Location = new System.Drawing.Point(102, 70);
            lblPluginDescription.Name     = "lblPluginDescription";
            lblPluginDescription.TabIndex = 11;
            lblPluginDescription.UseCompatibleTextRendering = true;
            if (pluginassembly != null)
            {
                lblPluginDescription.Text = PluginsManager.GetPluginDescription(pluginassembly);
            }
            else
            {
                lblPluginDescription.Text = Strings.T("Failed Loading the {0} file.", dllfilename);
            }

            this.btnPluginsStatus[pluginpos].Location = new System.Drawing.Point(230, 20);
            this.btnPluginsStatus[pluginpos].Name     = "btnTogglePluginStatus" + pluginpos;
            this.btnPluginsStatus[pluginpos].Tag      = dllfilename;
            this.btnPluginsStatus[pluginpos].Size     = new System.Drawing.Size(148, 23);
            this.btnPluginsStatus[pluginpos].TabIndex = 0;
            this.btnPluginsStatus[pluginpos].UseVisualStyleBackColor = true;
            this.btnPluginsStatus[pluginpos].Click += new EventHandler(this.PluginGrid_Click);
            Controls.Add(this.tlpnlPlugins[pluginpos]);

            this.SetPluginStatus(pluginpos, dllfilename);
            this.tlpnlPlugins[pluginpos].ResumeLayout(false);
            this.tlpnlPlugins[pluginpos].PerformLayout();
        }
예제 #10
0
        /// <summary>
        /// Parser results of versions requested plugins, and set tabpage with plugin update visible
        /// if there are plugin update(s) are available.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event arguments</param>
        private void httputil_pluginsversions_compleet(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            string result = (string)e.Result;

            if (result == null)
            {
                return;
            }

            if (result.Length < 1)
            {
                return;
            }

            this.updatableplugins = new List <DownloadDetailsPlugin>();
            XmlDocument xmldoc = new XmlDocument();

            xmldoc.LoadXml(result);
            XmlNodeList xmlnodelist = xmldoc.SelectNodes("/plugins/plugin");

            foreach (XmlNode xmlnode in xmlnodelist)
            {
                if (xmlnode.ChildNodes.Count == 1)
                {
                    const int MAXLENMESSAGE = 500;
                    string    errormessage  = xmlnode.ChildNodes[0].InnerText;
                    if (errormessage.Length > MAXLENMESSAGE)
                    {
                        errormessage = errormessage.Substring(0, MAXLENMESSAGE);
                    }

                    Log.Write(LogType.error, errormessage);
                }
                else if (xmlnode.ChildNodes.Count > 1)
                {
                    bool minversionipluginokay = true;
                    DownloadDetailsPlugin downloaddetailsplugin = new DownloadDetailsPlugin();
                    for (int i = 0; (i < xmlnode.ChildNodes.Count && minversionipluginokay); ++i)
                    {
                        switch (xmlnode.ChildNodes[i].Name)
                        {
                        case "name":
                            downloaddetailsplugin.Name = xmlnode.ChildNodes[i].InnerText;
                            break;

                        case "version":
                            downloaddetailsplugin.Version = xmlnode.ChildNodes[i].InnerText;
                            break;

                        case "downloadurl":
                            downloaddetailsplugin.DownloadUrl = xmlnode.ChildNodes[i].InnerText;
                            break;

                        case "signature":
                            downloaddetailsplugin.Signature = xmlnode.ChildNodes[i].InnerText;
                            break;

                        case "minversioniplugin":
                            short[] pluginipluginversionneeded = new short[] { 0, 0, 0 };
                            try
                            {
                                pluginipluginversionneeded = Program.ParserVersionString(xmlnode.ChildNodes[i].InnerText);
                            }
                            catch (Exception)
                            {
                                Log.Write(LogType.error, "Server returned unknown minversioniplugin.");
                            }

                            if (Program.CompareVersions(pluginipluginversionneeded, PluginsManager.GetIPluginVersion()) > 1)
                            {
                                minversionipluginokay = false;
                            }

                            break;
                        }
                    }

                    if (downloaddetailsplugin.IsInstalledPlugin() && minversionipluginokay)
                    {
                        if (downloaddetailsplugin.IsNewerVersion())
                        {
                            this.updatableplugins.Add(downloaddetailsplugin);
                        }
                    }
                }
            }

            if (this.updatableplugins.Count > 0)
            {
                this.SetTabPageUpdatesVisible(true);
                this.tabControlPlugins.SelectedTab = this.tabPagePluginsUpdates;
            }

            for (int i = 0; i < this.updatableplugins.Count; i++)
            {
                this.chxlbxPluginUpdates.Items.Add(this.updatableplugins[i].Name, PLUGINUPDATECHECKEDDEFAULT);
            }
        }