FRBDK/SpriteEditor/FileAssociationHelper.cs
/// <summary>
/// Associates the currently running executable with the file <see cref="Extension"/>
/// </summary>
Associates the currently running executable with the file
Associates the currently running executable with the file
public void Associate()
        {
            if (!string.IsNullOrEmpty(_x10) && (!this._isEditor || !this._isOpener))
            {
                RegistryKey x10RegKey = GetCreateSubKey(Registry.ClassesRoot, _x10, _x10AssociationKeyName);
                _x10AssociationKeyName = x10RegKey.GetValue(string.Empty).ToString();
                RegistryKey x10AssociationSubKey = GetCreateSubKey(Registry.ClassesRoot, _x10AssociationKeyName);
                RegistryKey shell = GetCreateSubKey(x10AssociationSubKey, "shell");
                if (!_isEditor)
                {
                    RegistryKey edit = GetCreateSubKey(shell, "edit");
                    RegistryKey editCommand = GetCreateSubKey(edit, "command");
                    editCommand.SetValue(string.Empty, _assemblyCommand);
                }
                if (!_isOpener)
                {
                    RegistryKey open = GetCreateSubKey(shell, "open");
                    RegistryKey openCommand = GetCreateSubKey(open, "command");
                    openCommand.SetValue(string.Empty, _assemblyCommand);
                }
                this.CheckStatus();
            }
        }
public void Associate ( ) { if ( ! string . IsNullOrEmpty ( _x10 ) && ( ! this . _isEditor || ! this . _isOpener ) ) { RegistryKey x10RegKey = GetCreateSubKey ( Registry . ClassesRoot , _x10 , _x10AssociationKeyName ) ; _x10AssociationKeyName = x10RegKey . GetValue ( string . Empty ) . ToString ( ) ; RegistryKey x10AssociationSubKey = GetCreateSubKey ( Registry . ClassesRoot , _x10AssociationKeyName ) ; RegistryKey shell = GetCreateSubKey ( x10AssociationSubKey , " " ) ; if ( ! _isEditor ) { RegistryKey edit = GetCreateSubKey ( shell , " " ) ; RegistryKey editCommand = GetCreateSubKey ( edit , " " ) ; editCommand . SetValue ( string . Empty , _assemblyCommand ) ; } if ( ! _isOpener ) { RegistryKey open = GetCreateSubKey ( shell , " " ) ; RegistryKey openCommand = GetCreateSubKey ( open , " " ) ; openCommand . SetValue ( string . Empty , _assemblyCommand ) ; } this . CheckStatus ( ) ; } }
Associates the currently running executable with the file
Associates the currently running executable with the file