Esempio n. 1
0
 public bool RemoveFrom(List <MsUpdate> Updates, MsUpdate Update)
 {
     for (int i = 0; i < Updates.Count; i++)
     {
         if (Updates[i] == Update)
         {
             Updates.RemoveAt(i);
             return(true);
         }
     }
     return(false);
 }
Esempio n. 2
0
 private void updateView_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (updateView.SelectedItems.Count == 1)
     {
         MsUpdate Update = (MsUpdate)updateView.SelectedItems[0].Tag;
         lblSupport.Links[0].LinkData = Update.SupportUrl;
         lblSupport.Links[0].Visited  = false;
         lblSupport.Visible           = true;
         toolTip.SetToolTip(lblSupport, Update.SupportUrl);
     }
     else
     {
         lblSupport.Visible = false;
     }
 }
Esempio n. 3
0
        private void LoadUpdates()
        {
            string INIPath = Program.appPath + @"\updates.ini";

            foreach (string KB in Program.IniEnumSections(INIPath))
            {
                if (KB.Length == 0)
                {
                    continue;
                }

                MsUpdate Update = new MsUpdate();
                Update.KB   = KB;
                Update.UUID = Program.IniReadValue(Update.KB, "UUID", "", INIPath);

                Update.Title       = Program.IniReadValue(Update.KB, "Title", "", INIPath);
                Update.Description = Program.IniReadValue(Update.KB, "Info", "", INIPath);
                Update.Category    = Program.IniReadValue(Update.KB, "Category", "", INIPath);

                try { Update.Date = DateTime.Parse(Program.IniReadValue(Update.KB, "Date", "", INIPath)); } catch { }
                Update.Size = (decimal)MiscFunc.parseInt(Program.IniReadValue(Update.KB, "Size", "0", INIPath));

                Update.SupportUrl = Program.IniReadValue(Update.KB, "SupportUrl", "", INIPath);
                Update.Downloads.AddRange(Program.IniReadValue(Update.KB, "Downloads", "", INIPath).Split('|'));

                Update.State      = (MsUpdate.UpdateState)MiscFunc.parseInt(Program.IniReadValue(Update.KB, "State", "0", INIPath));
                Update.Attributes = MiscFunc.parseInt(Program.IniReadValue(Update.KB, "Attributes", "0", INIPath));
                Update.ResultCode = MiscFunc.parseInt(Program.IniReadValue(Update.KB, "ResultCode", "0", INIPath));
                Update.HResult    = MiscFunc.parseInt(Program.IniReadValue(Update.KB, "HResult", "0", INIPath));

                switch (Update.State)
                {
                case MsUpdate.UpdateState.Pending: mPendingUpdates.Add(Update); break;

                case MsUpdate.UpdateState.Installed: mInstalledUpdates.Add(Update); break;

                case MsUpdate.UpdateState.Hidden: mHiddenUpdates.Add(Update); break;

                case MsUpdate.UpdateState.History: mUpdateHistory.Add(Update); break;
                }
            }
        }
Esempio n. 4
0
        void LoadList(List <MsUpdate> List)
        {
            updateView.Items.Clear();
            ListViewItem[] items = new ListViewItem[List.Count];
            for (int i = 0; i < List.Count; i++)
            {
                MsUpdate Update = List[i];
                string   State  = "";
                switch (Update.State)
                {
                case MsUpdate.UpdateState.History:
                    switch ((OperationResultCode)Update.ResultCode)
                    {
                    case OperationResultCode.orcNotStarted: State = "Not Started"; break;

                    case OperationResultCode.orcInProgress: State = "In Progress"; break;

                    case OperationResultCode.orcSucceeded: State = "Succeeded"; break;

                    case OperationResultCode.orcSucceededWithErrors: State = "Succeeded with Errors"; break;

                    case OperationResultCode.orcFailed: State = "Failed"; break;

                    case OperationResultCode.orcAborted: State = "Aborted"; break;
                    }
                    State += " (0x" + String.Format("{0:X8}", Update.HResult) + ")";
                    break;

                default:
                    if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Beta) != 0)
                    {
                        State = "Beta ";
                    }

                    if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Installed) != 0)
                    {
                        State += "Installed";
                        if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Uninstallable) != 0)
                        {
                            State += " Removable";
                        }
                    }
                    else if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Hidden) != 0)
                    {
                        State += "Hidden";
                        if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Downloaded) != 0)
                        {
                            State += " Downloaded";
                        }
                    }
                    else
                    {
                        if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Downloaded) != 0)
                        {
                            State += "Downloaded";
                        }
                        else
                        {
                            State += "Pending";
                        }
                        if ((Update.Attributes & (int)MsUpdate.UpdateAttr.AutoSelect) != 0)
                        {
                            State += " (!)";
                        }
                        if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Mandatory) != 0)
                        {
                            State += " Manatory";
                        }
                    }

                    if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Exclusive) != 0)
                    {
                        State += ", Exclusive";
                    }

                    if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Reboot) != 0)
                    {
                        State += ", Needs Reboot";
                    }
                    break;
                }

                items[i] = new ListViewItem(new string[] {
                    Update.Title,
                    Update.Category,
                    Update.KB,
                    FileOps.FormatSize(Update.Size),
                    Update.Date.ToString("dd.MM.yyyy"),
                    State
                });

                items[i].Tag = Update;

                ListViewGroup lvg = updateView.Groups[Update.Category];
                if (lvg == null)
                {
                    lvg = updateView.Groups.Add(Update.Category, Update.Category);
                    ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible);
                }
                items[i].Group = lvg;
            }
            updateView.Items.AddRange(items);

            // Note: this has caused issues in the past
            //updateView.SetGroupState(ListViewGroupState.Collapsible);
        }