Esempio n. 1
0
        internal override bool CanParseContent(SystemWindow sw)
        {
            uint LVM_GETITEMCOUNT = (0x1000 + 4);
            int  cnt = sw.SendGetMessage(LVM_GETITEMCOUNT);

            return(cnt != 0);
        }
Esempio n. 2
0
        internal override bool CanParseContent(SystemWindow sw)
        {
            uint LVM_GETITEMCOUNT = (0x1000 + 4);
            int  cnt = sw.SendGetMessage(LVM_GETITEMCOUNT);

            return(cnt != 0 || sw.ClassName == "SysListView32");
        }
Esempio n. 3
0
        internal override bool CanParseContent(SystemWindow sw)
        {
            if (strict)
            {
                const uint EM_GETLINECOUNT = 0xBA;
                return(sw.SendGetMessage(EM_GETLINECOUNT) != 0);
            }

            return(sw.Title != "");
        }
Esempio n. 4
0
        internal override WindowContent ParsePreviewContent(SystemWindow sw)
        {
            uint LVM_GETITEMCOUNT = (0x1000 + 4);
            int  cnt = sw.SendGetMessage(LVM_GETITEMCOUNT);

            if (cnt == 0 && sw.ClassName != "SysListView32")
            {
                throw new Exception();
            }
            SystemAccessibleObject o = SystemAccessibleObject.FromWindow(sw, AccessibleObjectID.OBJID_CLIENT);

            if (o.RoleIndex == 33)
            {
                return(new ListContent("DetailsListView", -1, null, new string[0]));
            }
            else
            {
                return(new ListContent("EmptyListView", -1, null, new string[0]));
            }
        }
Esempio n. 5
0
        internal override bool CanParseContent(SystemWindow sw)
        {
            int cnt = sw.SendGetMessage(TVM_GETCOUNT, 0);

            return(cnt != 0);
        }
Esempio n. 6
0
        protected override WindowContent ParseContent(SystemWindow sw)
        {
            uint LVM_GETITEMCOUNT = (0x1000 + 4);
            int  cnt = sw.SendGetMessage(LVM_GETITEMCOUNT);

            if (cnt == 0)
            {
                throw new Exception();
            }
            SystemAccessibleObject o = SystemAccessibleObject.FromWindow(sw, AccessibleObjectID.OBJID_CLIENT);

            if (o.RoleIndex == 33)
            {
                // are there column headers?
                int      cs  = o.Children.Length;
                string[] hdr = null;
                if (cs > 0)
                {
                    SystemAccessibleObject headers = o.Children[cs - 1];
                    if (headers.RoleIndex == 9 && headers.Window != sw)
                    {
                        SystemAccessibleObject hdrL = SystemAccessibleObject.FromWindow(headers.Window, AccessibleObjectID.OBJID_CLIENT);
                        hdr = new string[hdrL.Children.Length];
                        for (int i = 0; i < hdr.Length; i++)
                        {
                            if (hdrL.Children[i].RoleIndex != 25)
                            {
                                hdr = null;
                                break;
                            }
                            hdr[i] = hdrL.Children[i].Name;
                        }
                        if (hdr != null)
                        {
                            cs--;
                        }
                    }
                }
                List <string> values = new List <string>();
                for (int i = 0; i < cs; i++)
                {
                    if (o.Children[i].RoleIndex == 34)
                    {
                        string name = o.Children[i].Name;
                        if (hdr != null)
                        {
                            try
                            {
                                string cols = o.Children[i].Description;
                                if (cols == null && values.Count == 0)
                                {
                                    hdr = null;
                                }
                                else
                                {
                                    string        tmpCols = "; " + cols;
                                    List <string> usedHdr = new List <string>();
                                    foreach (string header in hdr)
                                    {
                                        string h = "; " + header + ": ";
                                        if (tmpCols.Contains(h))
                                        {
                                            usedHdr.Add(header);
                                            tmpCols = tmpCols.Substring(tmpCols.IndexOf(h) + h.Length);
                                        }
                                    }
                                    foreach (string header in hdr)
                                    {
                                        name += "\t";
                                        if (usedHdr.Count > 0 && usedHdr[0] == header)
                                        {
                                            if (!cols.StartsWith(header + ": "))
                                            {
                                                throw new Exception();
                                            }
                                            cols = cols.Substring(header.Length + 1);
                                            string elem;
                                            if (usedHdr.Count > 1)
                                            {
                                                int pos = cols.IndexOf("; " + usedHdr[1] + ": ");
                                                elem = cols.Substring(0, pos);
                                                cols = cols.Substring(pos + 2);
                                            }
                                            else
                                            {
                                                elem = cols;
                                                cols = "";
                                            }
                                            name += elem;
                                            usedHdr.RemoveAt(0);
                                        }
                                    }
                                }
                            }
                            catch (COMException ex)
                            {
                                if (ex.ErrorCode == -2147352573 && values.Count == 0)
                                {
                                    hdr = null;
                                }
                                else
                                {
                                    throw ex;
                                }
                            }
                        }
                        values.Add(name);
                    }
                }
                if (hdr != null)
                {
                    string lines = "", headers = "";
                    foreach (string h in hdr)
                    {
                        if (lines.Length > 0)
                        {
                            lines += "\t";
                        }
                        if (headers.Length > 0)
                        {
                            headers += "\t";
                        }
                        headers += h;
                        lines   += ListContent.Repeat('~', h.Length);
                    }
                    values.Insert(0, lines);
                    values.Insert(0, headers);
                    return(new ListContent("DetailsListView", -1, null, values.ToArray()));
                }
                else
                {
                    return(new ListContent("ListView", -1, null, values.ToArray()));
                }
            }
            else
            {
                return(new ListContent("EmptyListView", -1, null, new string[0]));
            }
        }
Esempio n. 7
0
 internal override bool CanParseContent(SystemWindow sw)
 {
     int cnt = sw.SendGetMessage(TVM_GETCOUNT, 0);
     return cnt != 0;
 }
Esempio n. 8
0
 internal override WindowContent ParseContent(SystemWindow sw)
 {
     uint LVM_GETITEMCOUNT = (0x1000 + 4);
     int cnt = sw.SendGetMessage(LVM_GETITEMCOUNT);
     if (cnt == 0) throw new Exception();
     SystemAccessibleObject o = SystemAccessibleObject.FromWindow(sw, AccessibleObjectID.OBJID_CLIENT);
     if (o.RoleIndex == 33)
     {
         // are there column headers?
         int cs = o.Children.Length;
         string[] hdr = null;
         if (cs > 0)
         {
             SystemAccessibleObject headers = o.Children[cs - 1];
             if (headers.RoleIndex == 9 && headers.Window != sw)
             {
                 SystemAccessibleObject hdrL = SystemAccessibleObject.FromWindow(headers.Window, AccessibleObjectID.OBJID_CLIENT);
                 hdr = new string[hdrL.Children.Length];
                 for (int i = 0; i < hdr.Length; i++)
                 {
                     if (hdrL.Children[i].RoleIndex != 25)
                     {
                         hdr = null;
                         break;
                     }
                     hdr[i] = hdrL.Children[i].Name;
                 }
                 if (hdr != null)
                 {
                     cs--;
                 }
             }
         }
         List<string> values = new List<string>();
         for (int i = 0; i < cs; i++)
         {
             if (o.Children[i].RoleIndex == 34)
             {
                 string name = o.Children[i].Name;
                 if (hdr != null)
                 {
                     try
                     {
                         string cols = o.Children[i].Description;
                         if (cols == null && values.Count == 0) { hdr = null; }
                         else
                         {
                             string tmpCols = "; " + cols;
                             List<string> usedHdr = new List<string>();
                             foreach (string header in hdr)
                             {
                                 string h = "; " + header + ": ";
                                 if (tmpCols.Contains(h))
                                 {
                                     usedHdr.Add(header);
                                     tmpCols = tmpCols.Substring(tmpCols.IndexOf(h) + h.Length);
                                 }
                             }
                             foreach (string header in hdr)
                             {
                                 name += "\t";
                                 if (usedHdr.Count > 0 && usedHdr[0] == header)
                                 {
                                     if (!cols.StartsWith(header + ": "))
                                         throw new Exception();
                                     cols = cols.Substring(header.Length + 1);
                                     string elem;
                                     if (usedHdr.Count > 1)
                                     {
                                         int pos = cols.IndexOf("; " + usedHdr[1] + ": ");
                                         elem = cols.Substring(0, pos);
                                         cols = cols.Substring(pos + 2);
                                     }
                                     else
                                     {
                                         elem = cols;
                                         cols = "";
                                     }
                                     name += elem;
                                     usedHdr.RemoveAt(0);
                                 }
                             }
                         }
                     }
                     catch (COMException ex)
                     {
                         if (ex.ErrorCode == -2147352573 && values.Count == 0)
                         {
                             hdr = null;
                         }
                         else
                         {
                             throw ex;
                         }
                     }
                 }
                 values.Add(name);
             }
         }
         if (hdr != null)
         {
             string lines = "", headers = "";
             foreach (string h in hdr)
             {
                 if (lines.Length > 0) lines += "\t";
                 if (headers.Length > 0) headers += "\t";
                 headers += h;
                 lines += ListContent.Repeat('~', h.Length);
             }
             values.Insert(0, lines);
             values.Insert(0, headers);
             return new ListContent("DetailsListView", -1, null, values.ToArray());
         }
         else
         {
             return new ListContent("ListView", -1, null, values.ToArray());
         }
     }
     else
     {
         return new ListContent("EmptyListView", -1, null, new string[0]);
     }
 }
Esempio n. 9
0
 internal override bool CanParseContent(SystemWindow sw)
 {
     uint LVM_GETITEMCOUNT = (0x1000 + 4);
     int cnt = sw.SendGetMessage(LVM_GETITEMCOUNT);
     return cnt != 0;
 }
 internal override bool CanParseContent(SystemWindow sw)
 {
     if (strict)
     {
         uint EM_GETLINECOUNT = 0xBA;
         return sw.SendGetMessage(EM_GETLINECOUNT) != 0;
     }
     else
     {
         return sw.Title != "";
     }
 }
Esempio n. 11
0
        internal override bool CanParseContent(SystemWindow sw)
        {
            int cnt = sw.SendGetMessage(TVM_GETCOUNT, 0);

            return(cnt != 0 || sw.ClassName == "SysTreeView32");
        }
Esempio n. 12
0
 internal override bool CanParseContent(SystemWindow sw)
 {
     int cnt = sw.SendGetMessage(TVM_GETCOUNT, 0);
     return cnt != 0 || sw.ClassName == "SysTreeView32";
 }
Esempio n. 13
0
 internal override WindowContent ParsePreviewContent(SystemWindow sw)
 {
     uint LVM_GETITEMCOUNT = (0x1000 + 4);
     int cnt = sw.SendGetMessage(LVM_GETITEMCOUNT);
     if (cnt == 0 && sw.ClassName != "SysListView32") throw new Exception();
     SystemAccessibleObject o = SystemAccessibleObject.FromWindow(sw, AccessibleObjectID.OBJID_CLIENT);
     if (o.RoleIndex == 33)
     {
         return new ListContent("DetailsListView", -1, null, new string[0]);
     }
     else
     {
         return new ListContent("EmptyListView", -1, null, new string[0]);
     }
 }
Esempio n. 14
0
 internal override bool CanParseContent(SystemWindow sw)
 {
     uint LVM_GETITEMCOUNT = (0x1000 + 4);
     int cnt = sw.SendGetMessage(LVM_GETITEMCOUNT);
     return cnt != 0 || sw.ClassName == "SysListView32";
 }