Exemplo n.º 1
0
 public static void BindDataSource(this BetterListViewItem item, TaskListViewSourceItem source,
                                   BetterListView owner)
 {
     item.Tag = source;
     Refresh(item, owner);
     item.Group = source.Group;
 }
Exemplo n.º 2
0
    private BetterListView createList(ListViewItem item, BetterListView prefab)
    {
        BetterListView instance = Instantiate(prefab);

        instance.listViewItem = item; //Set list item prefab
        return(instance);
    }
Exemplo n.º 3
0
        public void prininte(Model.trip trip, BetterListView _bs = null)

        {
            bs   = _bs;
            Trip = trip;
            if (this.PrintObject == null)
            {
                this.PrintObject = new CustomControls.PrintObject("transport");
                this.PrintObject.PrintDocument.PrintPage += PrintDocument_PrintPage;
            }
            offset = 0;
            this.PrintObject.PrintDocument.Print();
        }
Exemplo n.º 4
0
        private void onDraw(object lvSender, BetterListViewDrawItemEventArgs eventArgs)
        {
            BetterListView lview = (BetterListView)lvSender;
            var            item  = eventArgs.Item;
            T   tag   = (T)item.Tag;
            var index = base.IndexOf(tag);

            item.ImageList.Images.Add(new Bitmap(1, 1));
            if (updateList[index] == false)
            {
                updateList[index] = true;
                CollumnDisplay2(tag, item);
            }
        }
Exemplo n.º 5
0
        private static void Refresh(BetterListViewItem item, BetterListView owner)
        {
            TaskListViewSourceItem source = item.DataSource();
            object dataObject             = source.DataObject;

            IEnumerable <BetterListViewColumnHeader> columns = owner.Columns;
            Dictionary <string, PropertyInfo>        props   = GetDataObjectProps(dataObject);

            int colCount = columns.Count(), subCount = item.SubItems.Count, subDiff = colCount - subCount;

            if (subDiff > 0)
            {
                List <BetterListViewSubItem> subItems = new List <BetterListViewSubItem>(subDiff);
                for (int i = 0; i < subDiff; i++)
                {
                    subItems.Add(new BetterListViewSubItem());
                }
                item.SubItems.AddRange(subItems);
            }

            int idx = -1;

            foreach (BetterListViewColumnHeader column in columns)
            {
                idx++;
                if (column.DisplayMember == string.Empty ||
                    !props.TryGetValue(column.DisplayMember, out var propertyInfo))
                {
                    continue;
                }

                BetterListViewSubItem subItem = item.SubItems[idx];
                object displayValue           = propertyInfo.GetValue(dataObject);
                string displayString          = displayValue?.ToString();
                if (subItem.Text != displayString)
                {
                    subItem.Text = displayString;
                }

                if (column.ValueMember != string.Empty &&
                    props.TryGetValue(column.ValueMember, out propertyInfo))
                {
                    subItem.Key = (IComparable)propertyInfo.GetValue(dataObject);
                }
                else
                {
                    subItem.Key = (IComparable)displayValue;
                }
            }
        }
Exemplo n.º 6
0
/*
 *  Private Sub ProcessRuleIniFile(ByVal sRule$)
 *      Dim vRule As Variant, iMode%, sValue$, sHit$
 *      On Error GoTo Error:
 *      'IniFile rule syntax:
 *      '[inifile],[section],[value],[default data],[infected data]
 *      '* [inifile]          = "" -> abort
 *      ' * [section]         = "" -> abort
 *      '  * [value]          = "" -> abort
 *      '   * [default data]  = "" -> delete if found
 *      '    * [infected data]= "" -> fix if infected
 *
 *      'decrypt rule
 *      'sRule = Crypt(sRule, sProgramVersion)
 *
 *      If Right(sRule, 1) = Chr(0) Then sRule = Left(sRule, Len(sRule) - 1)
 *      vRule = Split(sRule, ",")
 *      If UBound(vRule) <> 4 Or _
 *         InStr(CStr(vRule(0)), ".ini") = 0 Then
 *          'spelling error or decrypting error
 *          Exit Sub
 *      End If
 *      If CStr(vRule(0)) = "" Then Exit Sub
 *      If CStr(vRule(1)) = "" Then Exit Sub
 *      If CStr(vRule(2)) = "" Then Exit Sub
 *      If CStr(vRule(4)) = "" Then iMode = 0
 *      If CStr(vRule(3)) = "" Then iMode = 1
 *
 *      If InStr(CStr(vRule(3)), "UserInit") > 0 Then vRule(3) = CStr(vRule(3)) & ","
 *
 *      If Left(CStr(vRule(0)), 3) = "REG" Then
 *          If Not bIsWinNT Then Exit Sub
 *
 *          If CStr(vRule(4)) = "" Then iMode = 2
 *          If CStr(vRule(3)) = "" Then iMode = 3
 *      End If
 *
 *      'iMode:
 *      ' 0 = check if value is infected
 *      ' 1 = check if value is present
 *      ' 2 = check if value is infected, in the Registry
 *      ' 3 = check if value is present, in the Registry
 *
 *      Select Case iMode
 *          Case 0
 *              'sValue = String(255, " ")
 *              'GetPrivateProfileString CStr(vRule(1)), CStr(vRule(2)), "", sValue, 255, CStr(vRule(0))
 *              'sValue = RTrim(sValue)
 *              sValue = IniGetString(CStr(vRule(0)), CStr(vRule(1)), CStr(vRule(2)))
 *              If Right(sValue, 1) = Chr(0) Then sValue = Left(sValue, Len(sValue) - 1)
 *              'If RightB(sValue, 2) = Chr(0) Then sValue = LeftB(sValue, LenB(sValue) - 2)
 *              If Trim(LCase(sValue)) <> LCase(CStr(vRule(3))) Then
 *                  If bIsWinNT And Trim(LCase(sValue)) <> vbNullString Then
 *                      sHit = "F0 - " & CStr(vRule(0)) & ": " & CStr(vRule(2)) & "=" & sValue
 *                      If IsOnIgnoreList(sHit) Then Exit Sub
 *                      If bMD5 Then sHit = sHit & GetFileFromAutostart(sValue)
 *                      frmMain.lstResults.AddItem sHit
 *                  End If
 *              End If
 *          Case 1
 *              'sValue = String(255, " ")
 *              'GetPrivateProfileString CStr(vRule(1)), CStr(vRule(2)), "", sValue, 255, CStr(vRule(0))
 *              'sValue = RTrim(sValue)
 *              sValue = IniGetString(CStr(vRule(0)), CStr(vRule(1)), CStr(vRule(2)))
 *              If Right(sValue, 1) = Chr(0) Then sValue = Left(sValue, Len(sValue) - 1)
 *              'If RightB(sValue, 2) = Chr(0) Then sValue = LeftB(sValue, LenB(sValue) - 2)
 *              If Trim(sValue) <> vbNullString Then
 *                  sHit = "F1 - " & CStr(vRule(0)) & ": " & CStr(vRule(2)) & "=" & sValue
 *                  If IsOnIgnoreList(sHit) Then Exit Sub
 *                  If bMD5 Then sHit = sHit & GetFileFromAutostart(sValue)
 *                  frmMain.lstResults.AddItem sHit
 *              End If
 *          Case 2
 *              'so far F2 is only reg:Shell and reg:UserInit
 *              sValue = RegGetString(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows NT\CurrentVersion\WinLogon", CStr(vRule(2)))
 *              If LCase(sValue) <> LCase(CStr(vRule(3))) Then
 *                  sHit = "F2 - " & CStr(vRule(0)) & ": " & CStr(vRule(2)) & "=" & sValue
 *                  If IsOnIgnoreList(sHit) Then Exit Sub
 *                  If bMD5 Then sHit = sHit & GetFileFromAutostart(sValue)
 *                  frmMain.lstResults.AddItem sHit
 *              End If
 *          Case 3
 *              'this is not really smart when more INIFile items get
 *              'added, but so far F3 is only reg:load and reg:run
 *              sValue = RegGetString(HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\Windows", CStr(vRule(2)))
 *              If sValue <> vbNullString Then
 *                  sHit = "F3 - " & CStr(vRule(0)) & ": " & CStr(vRule(2)) & "=" & sValue
 *                  If IsOnIgnoreList(sHit) Then Exit Sub
 *                  If bMD5 Then sHit = sHit & GetFileFromAutostart(sValue)
 *                  frmMain.lstResults.AddItem sHit
 *              End If
 *      End Select
 *      Exit Sub
 *
 *  Error:
 *      ErrorMsg "modMain_ProcessRuleIniFile", Err.Number, Err.Description, "sRule=" & sRule
 *  End Sub
 */

        #endregion

        private BetterListViewGroup GetGroup(BetterListView listView, IDetectionResultItem resultItem)
        {
            var result = listView.Groups.FirstOrDefault(f => f.Name.Equals(resultItem.ResultType.ToString()));

            if (result == null && resultItem.ResultType == ScanResultType.CustomAddIn && resultItem is ICustomAddInSection)
            {
                var customSection = (ICustomAddInSection)resultItem;

                result = listView.Groups.FirstOrDefault(f => f.Name.Equals(customSection.CustomAddInSection.Id));

                if (result == null)
                {
                    result = new BetterListViewGroup(customSection.CustomAddInSection.Id,
                                                     string.Format("{0} - {1}", customSection.CustomAddInSection.Id, customSection.CustomAddInSection.Text));
                    betterListView1.Groups.Add(result);
                }
            }

            return(result);
        }
Exemplo n.º 7
0
 public void SynchronizeScroll(BetterListView listView)
 {
     VScrollBar.Value = listView.VScrollProperties.Value;
 }
Exemplo n.º 8
0
 public SplitRouteView()
 {
     BetterListView.Unlock("CDD9355E-A18C-46d0-B5B8-B1086C2D75B6");
     InitializeComponent();
     this.Dock = DockStyle.Fill;
 }