Ejemplo n.º 1
0
 /// <summary>
 /// Reads the current configuration file from the app's configuration.
 ///
 /// TODO: use reflection to do this.
 /// </summary>
 public static void ReadConfiguration()
 {
     Drive0Image             = (string)Properties.Settings.Default["Drive0Image"];
     Drive1Image             = (string)Properties.Settings.Default["Drive1Image"];
     SystemType              = (SystemType)Properties.Settings.Default["SystemType"];
     HostAddress             = (byte)Properties.Settings.Default["HostAddress"];
     HostPacketInterfaceName = (string)Properties.Settings.Default["HostPacketInterfaceName"];
     HostPacketInterfaceType = (PacketInterfaceType)Properties.Settings.Default["HostPacketInterfaceType"];
     AlternateBootType       = (AlternateBootType)Properties.Settings.Default["AlternateBootType"];
     BootAddress             = (ushort)Properties.Settings.Default["BootAddress"];
     BootFile         = (ushort)Properties.Settings.Default["BootFile"];
     InterlaceDisplay = (bool)Properties.Settings.Default["InterlaceDisplay"];
     ThrottleSpeed    = (bool)Properties.Settings.Default["ThrottleSpeed"];
 }
Ejemplo n.º 2
0
 private static void ReadConfigurationWindows()
 {
     AudioDACCapturePath     = Properties.Settings.Default.AudioDACCapturePath;
     Drive0Image             = Properties.Settings.Default.Drive0Image;
     Drive1Image             = Properties.Settings.Default.Drive1Image;
     SystemType              = (SystemType)Properties.Settings.Default.SystemType;
     HostAddress             = Properties.Settings.Default.HostAddress;
     HostPacketInterfaceName = Properties.Settings.Default.HostPacketInterfaceName;
     HostPacketInterfaceType = (PacketInterfaceType)Properties.Settings.Default.HostPacketInterfaceType;
     AlternateBootType       = (AlternateBootType)Properties.Settings.Default.AlternateBootType;
     BootAddress             = Properties.Settings.Default.BootAddress;
     BootFile              = Properties.Settings.Default.BootFile;
     InterlaceDisplay      = Properties.Settings.Default.InterlaceDisplay;
     ThrottleSpeed         = Properties.Settings.Default.ThrottleSpeed;
     EnableAudioDAC        = Properties.Settings.Default.EnableAudioDAC;
     EnableAudioDACCapture = Properties.Settings.Default.EnableAudioDACCapture;
     AudioDACCapturePath   = Properties.Settings.Default.AudioDACCapturePath;
 }
Ejemplo n.º 3
0
        private void PopulateNetworkAdapterList(PacketInterfaceType encapType)
        {
            //
            // Populate the list with the interfaces available on the machine, for the
            // type of encapsulation being used.
            //
            HostInterfaceGroupBox.Enabled = encapType != PacketInterfaceType.None;

            EthernetInterfaceListBox.Items.Clear();


            // Add the "Use no interface" option
            EthernetInterfaceListBox.Items.Add(
                new EthernetInterface("None", "No network adapter"));


            switch (encapType)
            {
            // For UDP we show all interfaces that support IPV4, for Raw Ethernet we show only Ethernet interfaces.
            case PacketInterfaceType.UDPEncapsulation:
            {
                NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();

                foreach (NetworkInterface iface in interfaces)
                {
                    if (iface.Supports(NetworkInterfaceComponent.IPv4))
                    {
                        EthernetInterfaceListBox.Items.Add(new EthernetInterface(iface.Name, iface.Description));
                    }
                }
            }
            break;

            // Add all interfaces that PCAP knows about.
            case PacketInterfaceType.EthernetEncapsulation:
                if (Configuration.HostRawEthernetInterfacesAvailable)
                {
                    foreach (LivePacketDevice device in LivePacketDevice.AllLocalMachine)
                    {
                        EthernetInterfaceListBox.Items.Add(new EthernetInterface(device.GetNetworkInterface().Name, device.GetNetworkInterface().Description));
                    }
                }
                break;

            case PacketInterfaceType.None:
                // Add nothing.
                break;
            }


            //
            // Select the one that is already selected (if any)
            //
            EthernetInterfaceListBox.SelectedIndex = 0;

            if (!string.IsNullOrEmpty(Configuration.HostPacketInterfaceName))
            {
                for (int i = 0; i < EthernetInterfaceListBox.Items.Count; i++)
                {
                    EthernetInterface iface = (EthernetInterface)EthernetInterfaceListBox.Items[i];

                    if (iface.Name == Configuration.HostPacketInterfaceName)
                    {
                        EthernetInterfaceListBox.SelectedIndex = i;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void PopulateNetworkAdapterList(PacketInterfaceType encapType)
        {
            //
            // Populate the list with the interfaces available on the machine, for the
            // type of encapsulation being used.
            //
            HostInterfaceGroupBox.Enabled = encapType != PacketInterfaceType.None;

            EthernetInterfaceListBox.Items.Clear();


            // Add the "Use no interface" option
            EthernetInterfaceListBox.Items.Add(
                new EthernetInterface("None", "No network adapter"));


            switch (encapType)
            {
            // For UDP we show all interfaces that support IPV4, for Raw Ethernet we show only Ethernet interfaces.
            case PacketInterfaceType.UDPEncapsulation:
            {
                NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();

                foreach (NetworkInterface iface in interfaces)
                {
                    if (iface.Supports(NetworkInterfaceComponent.IPv4))
                    {
                        EthernetInterfaceListBox.Items.Add(new EthernetInterface(iface.Name, iface.Description));
                    }
                }
            }
            break;

            // Add all interfaces that PCAP knows about.
            case PacketInterfaceType.EthernetEncapsulation:
                if (Configuration.HostRawEthernetInterfacesAvailable)
                {
                    foreach (WinPcapDevice device in CaptureDeviceList.Instance)
                    {
                        //
                        // NCap seems to return some interfaces with a null FriendlyName; empirically these
                        // are not real network adapters that would typically be used with ContrAlto so we
                        // will not display them here.
                        //
                        if (!string.IsNullOrWhiteSpace(device.Interface.FriendlyName))
                        {
                            EthernetInterfaceListBox.Items.Add(new EthernetInterface(device.Interface.FriendlyName, device.Interface.Description));
                        }
                    }
                }
                break;

            case PacketInterfaceType.None:
                // Add nothing.
                break;
            }

            //
            // Select the one that is already selected (if any)
            //
            EthernetInterfaceListBox.SelectedIndex = 0;

            if (!string.IsNullOrEmpty(Configuration.HostPacketInterfaceName))
            {
                for (int i = 0; i < EthernetInterfaceListBox.Items.Count; i++)
                {
                    EthernetInterface iface = (EthernetInterface)EthernetInterfaceListBox.Items[i];

                    if (iface.Name == Configuration.HostPacketInterfaceName)
                    {
                        EthernetInterfaceListBox.SelectedIndex = i;
                        break;
                    }
                }
            }
        }