Ejemplo n.º 1
0
        /// <summary>
        /// ����ϵͳ��׺��Ϣ
        /// </summary>
        public static int FindExts(String user)
        {
            Exts0001 inet = new Exts0001();
            int size = 0;

            // HKEY_CLASSES_ROOT
            RegistryKey key1 = Registry.ClassesRoot;
            foreach (String key in key1.GetSubKeyNames())
            {
                // ����
                if (String.IsNullOrEmpty(key) || key == "*" || (key[0] != '.'))
                {
                    continue;
                }

                // ��ǰ��׺��ֵ
                RegistryKey key2 = key1.OpenSubKey(key);
                if (key2 == null)
                {
                    continue;
                }

                // ��׺����
                String exts = key;
                // MIME����
                String mime = ((String)key2.GetValue("Content Type") ?? "").ToLower();
                // ��׺����
                String desp = "";
                // �ļ�ͼ��
                byte[][] file = null;
                String temp = (String)key2.GetValue("");
                if (!String.IsNullOrEmpty(temp))
                {
                    key2 = key1.OpenSubKey(temp);
                    if (key2 != null)
                    {
                        desp = ((String)key2.GetValue("") ?? "").TrimEnd(' ', ',');
                        if (!desp.EndsWith("��"))
                        {
                            desp += '��';
                        }
                        key2 = key2.OpenSubKey("DefaultIcon");
                        if (key2 != null)
                        {
                            file = ReadByte(ReadIcon((String)key2.GetValue("")));
                        }
                    }
                }

                // ����׺�Ƿ����
                temp = exts;
                if (NeedExts(temp, mime))
                {
                    if (inet.exts(user, "5p39mfkCZQ6oKtK9fQfHtIaxydVdz7JU", temp, mime, desp, file))
                    {
                        size += 1;
                    }
                }
                // ��д
                temp = exts.ToUpper();
                if (exts != temp)
                {
                    if (NeedExts(temp, mime))
                    {
                        if (inet.exts(user, "5p39mfkCZQ6oKtK9fQfHtIaxydVdz7JU", temp, mime, "���" + exts, file))
                        {
                            size += 1;
                        }
                    }
                }
                // Сд
                temp = exts.ToLower();
                if (exts != temp)
                {
                    if (NeedExts(temp, mime))
                    {
                        if (inet.exts(user, "5p39mfkCZQ6oKtK9fQfHtIaxydVdz7JU", temp, mime, "���" + exts, file))
                        {
                            size += 1;
                        }
                    }
                }
            }

            return size;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ��׺�����ϴ�
        /// </summary>
        /// <returns></returns>
        private void SaveExts(Object obj)
        {
            const string user = "******";
            const string pwds = "5p39mfkCZQ6oKtK9fQfHtIaxydVdz7JU";

            int size = 0;
            if (obj != null)
            {
                ListView.ListViewItemCollection items = (ListView.ListViewItemCollection)obj;
                Exts0001 inet = new Exts0001();

                Image icon;
                foreach (ListViewItem item in items)
                {
                    if (!isInSave)
                    {
                        break;
                    }

                    // ��ʾ�ϴ���Ϣ
                    LB_ExtsInfo.BeginInvoke(new EventHandler(ShowInfo), "�����ϴ���׺ " + item.SubItems[0].Text);

                    // �ϴ���׺����
                    if (inet.exts(user, pwds, item.SubItems[0].Text, item.SubItems[1].Text, item.SubItems[3].Text, ReadByte(ReadIcon(item.SubItems[2].Text, out icon))))
                    {
                        size += 1;
                        LV_ExtsList.BeginInvoke(new EventHandler(ShowSave), item);
                    }
                }
            }

            // ��ʾ������
            LB_ExtsInfo.BeginInvoke(new EventHandler(ViewSave), String.Format("���ϴ��� {0} �����ݣ�", size));
        }