Sha256: a3bae7e5524446a7b13bb6a561383d5e2093e1bcdafd4e552d6b35146b5e5659

Contents?: true

Size: 1.4 KB

Versions: 17

Compression:

Stored size: 1.4 KB

Contents

module VirtualBox
  module COM
    class MSCOMInterface < BaseInterface
      # The VirtualBox and Session interfaces, both of which are extremely
      # important in interfacing with the VirtualBox API. Once these have been
      # initialized, all other parts of the API can be accessed via these
      # instances.
      attr_reader :virtualbox
      attr_reader :session

      def initialize
        super
        initialize_mscom
      end

      def initialize_mscom
        require 'win32ole'

        interface_dir = File.expand_path(File.join(File.dirname(__FILE__), "interface"))
        Dir[File.join(interface_dir, "*")].each do |f|
          return if File.directory?(f) && initialize_for_version(File.basename(f))
        end
      end

      def initialize_for_version(version)
        COM::Util.set_interface_version(version)

        @virtualbox = COM::Util.versioned_interface(:VirtualBox).new(Implementer::MSCOM, self, WIN32OLE.new("VirtualBox.VirtualBox"))
        @session = COM::Util.versioned_interface(:Session).new(Implementer::MSCOM, self, WIN32OLE.new("VirtualBox.Session"))

        vb_version = @virtualbox.version

        # Check if they match or not.
        return false if vb_version.length == version.length
        (0...(version.length)).each do |i|
          next if version[i,1] == "x"
          return false if version[i,1] != vb_version[i,1]
        end

        true
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
virtualbox-0.9.2 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.9.1 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.9.0 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.8.6 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.8.5 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.8.4 lib/virtualbox/com/mscom_interface.rb
velir_virtualbox-0.8.4 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.8.3 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.8.2 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.8.1 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.8.0 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.7.9 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.7.8 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.7.7 lib/virtualbox/com/mscom_interface.rb
virtualbox-0.7.6 lib/virtualbox/com/mscom_interface.rb
bbrowning-virtualbox-0.7.6.dev lib/virtualbox/com/mscom_interface.rb
virtualbox-0.7.5 lib/virtualbox/com/mscom_interface.rb