Ejemplo n.º 1
0
        //--------------------------------------------
        private void instExtention(Extention ex)
        {
            //ファイルタイプを登録
            Microsoft.Win32.RegistryKey regkey = Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(ex.ext);
            regkey.SetValue("", ex.fileType);
            regkey.Close();

            //ファイルタイプとその説明を登録
            Microsoft.Win32.RegistryKey shellkey = Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(ex.fileType);
            shellkey.SetValue("", ex.description);

            //動詞とその説明を登録
            shellkey = shellkey.CreateSubKey("shell\\" + verb);
            shellkey.SetValue("", verb_description);

            //コマンドラインを登録
            shellkey = shellkey.CreateSubKey("command");
            shellkey.SetValue("", commandline);
            shellkey.Close();

            //アイコンの登録
            Microsoft.Win32.RegistryKey iconkey = Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(ex.fileType + "\\DefaultIcon");
            iconkey.SetValue("", iconPath + "," + ex.iconIndex.ToString());
            iconkey.Close();
        }
Ejemplo n.º 2
0
        //--------------------------------------------
        private void Append(Extention ex)
        {
            Extention e = new Extention();

            e.ext         = ex.ext;
            e.fileType    = ex.fileType;
            e.description = ex.description;
            e.iconIndex   = ex.iconIndex;
            m_docExtentions.Add(e);
        }
Ejemplo n.º 3
0
        //--------------------------------------------
        private void uninstExtention(Extention ex)
        {
            Microsoft.Win32.RegistryKey regkey1 = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ex.ext, true);
            if (regkey1 != null)
            {
                Microsoft.Win32.Registry.ClassesRoot.DeleteSubKeyTree(ex.ext);
            }

            Microsoft.Win32.RegistryKey regkey2 = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ex.fileType, true);
            if (regkey2 != null)
            {
                Microsoft.Win32.Registry.ClassesRoot.DeleteSubKeyTree(ex.fileType);
            }
        }
Ejemplo n.º 4
0
        //--------------------------------------------
        public bool Add(Extention ex)
        {
            bool err = false;

            if (ex.ext == "")
            {
                err = true;
            }
            if (ex.fileType == "")
            {
                err = true;
            }
            if (ex.description == "")
            {
                err = true;
            }
            if (err == true)
            {
                return(false);
            }
            if (m_docExtentions.Count <= 0)
            {
                Append(ex);
            }
            else
            {
                int idx = FindExt(ex.ext);
                if (idx >= 0)
                {
                    m_docExtentions[idx].ext         = ex.ext;
                    m_docExtentions[idx].fileType    = ex.fileType;
                    m_docExtentions[idx].description = ex.description;
                    m_docExtentions[idx].iconIndex   = ex.iconIndex;
                }
                else
                {
                    Append(ex);
                }
            }
            return(true);
        }