Example #1
0
    void ScoutModeActivate()
    {
        goalSpot           = GetRandomGoalVector();
        timeSinceLastEvent = 0;
        antMode            = AntMode.Scout;
        List <Intersection> intersections = GameObject.FindObjectOfType <PheromoneManager>().GetIntersections(transform.position, goalSpot);

        if (GV.DRAW_ALL_PREDICTIONS)
        {
            foreach (Intersection i in intersections)
            {
                Instantiate(Resources.Load("Prefab/Marker"), i._intersectionPoint, Quaternion.identity);
            }
        }
        if (intersections.Count >= 1)
        {
            closestIntersection = intersections[0];
            for (int i = 1; i < intersections.Count; ++i)
            {
                if (closestIntersection._intersectionPoint.magnitude > intersections[i]._intersectionPoint.magnitude) //bit proccessor intensive, but saves on total updates
                {
                    closestIntersection = intersections[i];
                }
            }
        }
        else
        {
            closestIntersection = null;
        }
    }
		private string AntMode2String(AntMode ant)
		{
			string ans = "0";
			switch(ant)
			{
				case AntMode.Simple:
					break;
				case AntMode.Expert:
					ans = "1";
					break;
			}
			return ans;
		}
Example #3
0
 //
 void StartWanderMode()
 {
     antMode  = AntMode.Wander;
     goalSpot = GetRandomGoalVector();
 }
Example #4
0
 public void DEBUG_CordycepControl(Vector2 newGoal)
 {
     goalSpot           = newGoal;
     timeSinceLastEvent = 0;
     antMode            = AntMode.Scout;
 }
Example #5
0
    void ArriveAtNode(PheromoneNode pn)
    {
        if (lastVisitedNode)
        {
            lastVisitedNode.initialRoot = false;
        }
        int workingBackTrack = backtrackWeight;

        if (currentTrail) //since might get deleted during
        {
            if (holding != null && !holding.isZero())
            {
                currentTrail.strength += GV.BASE_PHER_STRENTH * GV.HOLDING_RES_PHER_MULTIPLIER;
            }
            else
            {
                currentTrail.strength += GV.BASE_PHER_STRENTH;
            }
        }
        else
        {
            workingBackTrack = 0;
        }
        int            totalWeight      = pn.GetTotalPhermoneWeights(currentTrail) + scoutingWeight + workingBackTrack;
        int            randomResult     = Random.Range(1, totalWeight + 1);
        PheromoneTrail isBackTrackTrail = currentTrail;

        if (hasBackTracked)
        {
            PheromoneTrail tempTrail = pn.SelectNewTrailByWeight(randomResult, currentTrail, workingBackTrack);
            currentTrail = pn.SelectNewTrailByWeight(randomResult, currentTrail, workingBackTrack);
            if (currentTrail == null || currentTrail.strength > tempTrail.strength)
            {
                currentTrail = tempTrail;
            }
            hasBackTracked = false;
        }
        else
        {
            currentTrail = pn.SelectNewTrailByWeight(randomResult, currentTrail, workingBackTrack);
        }
        if (currentTrail != null && isBackTrackTrail != null && isBackTrackTrail == currentTrail)
        {
            hasBackTracked = !hasBackTracked;
        }
        lastVisitedNode = pn;
        if (currentTrail)
        {
            if (currentTrail.GetOtherNode(pn) == null)
            {
                currentTrail.TrailDie();
            }
            else
            {
                goalSpot = currentTrail.GetOtherNode(pn).transform.position;
                antMode  = AntMode.Forage;
            }
        }
        else
        {
            ScoutModeActivate();
        }
    }
Example #6
0
        public void GetState()
        {
            // Automatically restores all controls from the database in the
            // tab pages on this form of the following types: CheckBox, ComboBox,
            // NumericUpDown, RadioButton, TextBox, and TrackBar (slider)

            ArrayList checkbox_list = new ArrayList();
            ArrayList combobox_list = new ArrayList();
            ArrayList numericupdown_list = new ArrayList();
            ArrayList radiobutton_list = new ArrayList();
            ArrayList textbox_list = new ArrayList();
            ArrayList trackbar_list = new ArrayList();

            //ArrayList controls = new ArrayList();	// list of controls to restore
            foreach(Control c in this.Controls)
            {
                if(c.GetType() == typeof(GroupBoxTS))	// if control is a groupbox, retrieve all subcontrols
                {
                    foreach(Control c2 in ((GroupBoxTS)c).Controls)
                    {
                        if(c2.Enabled)
                        {
                            if(c2.GetType() == typeof(CheckBoxTS))			// the control is a CheckBox
                                checkbox_list.Add(c2);
                            else if(c2.GetType() == typeof(ComboBoxTS))		// the control is a ComboBox
                                combobox_list.Add(c2);
                            else if(c2.GetType() == typeof(NumericUpDownTS))	// the control is a NumericUpDown
                                numericupdown_list.Add(c2);
                            else if(c2.GetType() == typeof(RadioButtonTS))	// the control is a RadioButton
                                radiobutton_list.Add(c2);
                            else if(c2.GetType() == typeof(TextBoxTS))		// the control is a TextBox
                                textbox_list.Add(c2);
                            else if(c2.GetType() == typeof(TrackBarTS))		// the control is a TrackBar (slider)
                                trackbar_list.Add(c2);
                        }
                    }
                }
                else
                {
                    if(c.Enabled)
                    {
                        if(c.GetType() == typeof(CheckBoxTS))				// the control is a CheckBox
                            checkbox_list.Add(c);
                        else if(c.GetType() == typeof(ComboBoxTS))		// the control is a ComboBox
                            combobox_list.Add(c);
                        else if(c.GetType() == typeof(NumericUpDownTS))	// the control is a NumericUpDown
                            numericupdown_list.Add(c);
                        else if(c.GetType() == typeof(RadioButtonTS))		// the control is a RadioButton
                            radiobutton_list.Add(c);
                        else if(c.GetType() == typeof(TextBoxTS))			// the control is a TextBox
                            textbox_list.Add(c);
                        else if(c.GetType() == typeof(TrackBarTS))		// the control is a TrackBar (slider)
                            trackbar_list.Add(c);
                    }
                }
            }

            ArrayList a = DB.GetVars("State");							// Get the saved list of controls
            a.Sort();
            int num_controls = checkbox_list.Count + combobox_list.Count +
                numericupdown_list.Count + radiobutton_list.Count +
                textbox_list.Count + trackbar_list.Count;

            foreach(string s in a)				// string is in the format "name,value"
            {
                string[] vals = s.Split('/');
                if(vals.Length > 2)
                {
                    for(int i=2; i<vals.Length; i++)
                        vals[1] += "/"+vals[i];
                }

                string name = vals[0];
                string val = vals[1];
                int num = 0;

                if(name.StartsWith("rx1_filters["))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int mode_index = Int32.Parse(name.Substring(start, length));

                    start = name.LastIndexOf("[")+1;
                    length = name.LastIndexOf("]")-start;
                    int filter_mode = Int32.Parse(name.Substring(start, length));

                    length = val.IndexOf(":");
                    string n = val.Substring(0, length);

                    start = val.IndexOf(":")+2;
                    length = val.IndexOf(",")-start;
                    int low = Int32.Parse(val.Substring(start, length));

                    start = val.IndexOf(",")+1;
                    int high = Int32.Parse(val.Substring(start));

                    rx1_filters[mode_index].SetFilter((Filter)filter_mode, low, high, n);
                }
                else if(name.StartsWith("rx2_filters["))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int mode_index = Int32.Parse(name.Substring(start, length));

                    start = name.LastIndexOf("[")+1;
                    length = name.LastIndexOf("]")-start;
                    int filter_mode = Int32.Parse(name.Substring(start, length));

                    length = val.IndexOf(":");
                    string n = val.Substring(0, length);

                    start = val.IndexOf(":")+2;
                    length = val.IndexOf(",")-start;
                    int low = Int32.Parse(val.Substring(start, length));

                    start = val.IndexOf(",")+1;
                    int high = Int32.Parse(val.Substring(start));

                    rx2_filters[mode_index].SetFilter((Filter)filter_mode, low, high, n);
                }
                else if(name.StartsWith("last_rx1_filter["))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int mode_index = Int32.Parse(name.Substring(start, length));

                    rx1_filters[mode_index].LastFilter = (Filter)Enum.Parse(typeof(Filter), val);
                }
                else if(name.StartsWith("last_rx2_filter["))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int mode_index = Int32.Parse(name.Substring(start, length));

                    rx2_filters[mode_index].LastFilter = (Filter)Enum.Parse(typeof(Filter), val);
                }
                else if(name.StartsWith("rx1_preamp_offset["))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int index = Int32.Parse(name.Substring(start, length));

                    rx1_preamp_offset[index] = float.Parse(val);
                }
                    /*else if(name.StartsWith("fwc_att_offset"))
                    {
                        int start = name.IndexOf("[")+1;
                        int length = name.IndexOf("]")-start;
                        int index = int.Parse(name.Substring(start, length));

                        fwc_att_offset[index] = float.Parse(val);
                    }*/
                else if(name.StartsWith("power_table"))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int index = int.Parse(name.Substring(start, length));

                    string[] list = val.Split('|');
                    for(int i=0; i<13 && i<list.Length; i++)
                        power_table[index][i] = float.Parse(list[i]);
                }
                else if(name.StartsWith("tx_carrier_table"))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int index = int.Parse(name.Substring(start, length));

                    string[] list = val.Split('|');
                    for(int i=0; i<4; i++)
                        tx_carrier_table[index][i] = int.Parse(list[i]);
                }
                else if(name.StartsWith("pa_bias_table"))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int index = int.Parse(name.Substring(start, length));

                    string[] list = val.Split('|');
                    for(int i=0; i<8 && i<list.Length; i++)
                        pa_bias_table[index][i] = int.Parse(list[i]);

                    if(fwc_init && current_model == Model.FLEX5000 && index == 0)
                    {
                        if(flex5000DebugForm != null && !flex5000DebugForm.IsDisposed)
                        {
                            for(int i=0; i<8; i++)
                                flex5000DebugForm.SetPAPot(i, (byte)pa_bias_table[index][i]);
                        }
                    }
                }
                else if(name.StartsWith("rx1_level_table"))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int index = int.Parse(name.Substring(start, length));

                    string[] list = val.Split('|');
                    for(int i=0; i<3; i++)
                        rx1_level_table[index][i] = float.Parse(list[i]);
                }
                else if(name.StartsWith("rx2_level_table"))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int index = int.Parse(name.Substring(start, length));

                    string[] list = val.Split('|');
                    for(int i=0; i<3; i++)
                        rx2_level_table[index][i] = float.Parse(list[i]);
                }
                else if(name.StartsWith("pa_bridge_table"))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int index = int.Parse(name.Substring(start, length));

                    string[] list = val.Split('|');
                    for(int i=0; i<6; i++)
                        pa_bridge_table[index][i] = float.Parse(list[i]);
                }
                else if(name.StartsWith("swr_table"))
                {
                    int start = name.IndexOf("[")+1;
                    int length = name.IndexOf("]")-start;
                    int index = int.Parse(name.Substring(start, length));

                    swr_table[index] = float.Parse(val);
                }
                else if(name.StartsWith("rx1_ant_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        rx1_ant_by_band[i] = (FWCAnt)int.Parse(list[i]);
                }
                else if(name.StartsWith("rx2_ant_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        rx2_ant_by_band[i] = (FWCAnt)int.Parse(list[i]);
                }
                else if(name.StartsWith("tx_ant_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        tx_ant_by_band[i] = (FWCAnt)int.Parse(list[i]);
                }
                else if(name.StartsWith("rx1_loop_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        rx1_loop_by_band[i] = Convert.ToBoolean(int.Parse(list[i]));
                }
                else if(name.StartsWith("rx1_preamp_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        rx1_preamp_by_band[i] = (PreampMode)(int.Parse(list[i]));
                }
                else if(name.StartsWith("rx2_preamp_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        rx2_preamp_by_band[i] = (PreampMode)(int.Parse(list[i]));
                }
                else if(name.StartsWith("power_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        power_by_band[i] = int.Parse(list[i]);
                }
                else if(name.StartsWith("rx1_agct_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        rx1_agct_by_band[i] = int.Parse(list[i]);
                }
                else if(name.StartsWith("rx2_agct_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        rx2_agct_by_band[i] = int.Parse(list[i]);
                }
                else if(name.StartsWith("tx1_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        tx1_by_band[i] = Convert.ToBoolean(int.Parse(list[i]));
                }
                else if(name.StartsWith("tx2_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        tx2_by_band[i] = Convert.ToBoolean(int.Parse(list[i]));
                }
                else if(name.StartsWith("tx3_by_band"))
                {
                    string[] list = val.Split('|');
                    for(int i=0; i<(int)Band.LAST; i++)
                        tx3_by_band[i] = Convert.ToBoolean(int.Parse(list[i]));
                }

                switch(name)
                {
                    case "rx2_res_offset":
                        rx2_res_offset = float.Parse(val);
                        break;
                    case "current_ant_mode":
                        current_ant_mode = (AntMode)int.Parse(val);
                        break;
                    case "rx1_ant":
                        rx1_ant = (FWCAnt)int.Parse(val);
                        break;
                    case "rx1_loop":
                        rx1_loop = bool.Parse(val);
                        break;
                    case "rx2_ant":
                        rx2_ant = (FWCAnt)int.Parse(val);
                        break;
                    case "tx_ant":
                        tx_ant = (FWCAnt)int.Parse(val);
                        break;
                    case "fwc_preamp_offset":
                        fwc_preamp_offset = float.Parse(val);
                        break;
                    case "fwc_last_cal_date_time":
                        fwc_last_cal_date_time = long.Parse(val);
                        break;
                    case "fwc_serial_num":
                        fwc_serial_num = uint.Parse(val);
                        break;
                    case "fwc_trx_serial_num":
                        fwc_trx_serial_num = uint.Parse(val);
                        break;
                    case "rx2_last_cal_date_time":
                        rx2_last_cal_date_time = long.Parse(val);
                        break;
                    case "rx2_serial_num":
                        rx2_serial_num = uint.Parse(val);
                        break;
                    case "rx2_trx_match_serial":
                        rx2_trx_match_serial = uint.Parse(val);
                        break;
                    case "rx2_fixed_gain":
                        rx2_fixed_gain = int.Parse(val);
                        break;
                    case "rx2_max_gain":
                        rx2_max_gain = int.Parse(val);
                        break;
                    case "band_160m_index":
                        band_160m_index = Int32.Parse(val);
                        break;
                    case "band_80m_index":
                        band_80m_index = Int32.Parse(val);
                        break;
                    case "band_60m_index":
                        band_60m_index = Int32.Parse(val);
                        break;
                    case "band_40m_index":
                        band_40m_index = Int32.Parse(val);
                        break;
                    case "band_30m_index":
                        band_30m_index = Int32.Parse(val);
                        break;
                    case "band_20m_index":
                        band_20m_index = Int32.Parse(val);
                        break;
                    case "band_17m_index":
                        band_17m_index = Int32.Parse(val);
                        break;
                    case "band_15m_index":
                        band_15m_index = Int32.Parse(val);
                        break;
                    case "band_12m_index":
                        band_12m_index = Int32.Parse(val);
                        break;
                    case "band_10m_index":
                        band_10m_index = Int32.Parse(val);
                        break;
                    case "band_6m_index":
                        band_6m_index = Int32.Parse(val);
                        break;
                    case "band_2m_index":
                        band_2m_index = Int32.Parse(val);
                        break;
                    case "band_wwv_index":
                        band_wwv_index = Int32.Parse(val);
                        break;
                    case "band_gen_index":
                        band_gen_index = Int32.Parse(val);
                        break;
                    case "band_vhf0_index":
                        band_vhf0_index = Int32.Parse(val);
                        break;
                    case "band_vhf1_index":
                        band_vhf1_index = Int32.Parse(val);
                        break;
                    case "band_vhf2_index":
                        band_vhf2_index = Int32.Parse(val);
                        break;
                    case "band_vhf3_index":
                        band_vhf3_index = Int32.Parse(val);
                        break;
                    case "band_vhf4_index":
                        band_vhf4_index = Int32.Parse(val);
                        break;
                    case "band_vhf5_index":
                        band_vhf5_index = Int32.Parse(val);
                        break;
                    case "band_vhf6_index":
                        band_vhf6_index = Int32.Parse(val);
                        break;
                    case "band_vhf7_index":
                        band_vhf7_index = Int32.Parse(val);
                        break;
                    case "band_vhf8_index":
                        band_vhf8_index = Int32.Parse(val);
                        break;
                    case "band_vhf9_index":
                        band_vhf9_index = Int32.Parse(val);
                        break;
                    case "band_vhf10_index":
                        band_vhf10_index = Int32.Parse(val);
                        break;
                    case "band_vhf11_index":
                        band_vhf11_index = Int32.Parse(val);
                        break;
                    case "band_vhf12_index":
                        band_vhf12_index = Int32.Parse(val);
                        break;
                    case "band_vhf13_index":
                        band_vhf13_index = Int32.Parse(val);
                        break;
                    case "current_datetime_mode":
                        CurrentDateTimeMode = (DateTimeMode)(Int32.Parse(val));
                        break;
                    case "wheel_tune_index":
                        wheel_tune_index = Int32.Parse(val);
                        break;
                    case "txtMemoryQuick":
                        txtMemoryQuick.Text = val;
                        break;
                    case "rx1_display_cal_offset":
                        RX1DisplayCalOffset = float.Parse(val);
                        break;
                    case "rx1_meter_cal_offset":
                        rx1_meter_cal_offset = float.Parse(val);
                        break;
                    case "quick_save_mode":
                        quick_save_mode = (DSPMode)(Int32.Parse(val));
                        break;
                    case "quick_save_filter":
                        quick_save_filter = (Filter)(Int32.Parse(val));
                        break;
                    case "vfob_dsp_mode":
                        vfob_dsp_mode = (DSPMode)(Int32.Parse(val));
                        break;
                    case "vfob_filter":
                        vfob_filter = (Filter)(Int32.Parse(val));
                        break;
                    case "console_top":
                        num = Int32.Parse(val);
                        /*if((num < 0) || (num > Screen.PrimaryScreen.Bounds.Height && Screen.AllScreens.Length == 1))
                            num = 0;*/
                        this.Top = num;
                        break;
                    case "console_left":
                        num = Int32.Parse(val);
                        /*if((num < 0) || (num > Screen.PrimaryScreen.Bounds.Width && Screen.AllScreens.Length == 1))
                            num = 0;*/
                        this.Left = num;
                        break;
                    case "console_width":
                        if(dpi <= 96) this.Width = int.Parse(val);
                        break;
                    case "console_height":
                        if(dpi <= 96) this.Height = int.Parse(val);
                        break;
                    case "setup_top":
                        num = Int32.Parse(val);
                        /*if((num < 0) || (num > Screen.PrimaryScreen.Bounds.Height && Screen.AllScreens.Length == 1))
                            num = 0;*/
                        SetupForm.Top = num;
                        break;
                    case "setup_left":
                        num = Int32.Parse(val);
                        /*if((num < 0) || (num > Screen.PrimaryScreen.Bounds.Width && Screen.AllScreens.Length == 1))
                            num = 0;*/
                        SetupForm.Left = num;
                        break;
                    case "mem_top":
                        num = Int32.Parse(val);
                        /*if((num < 0) || (num > Screen.PrimaryScreen.Bounds.Height && Screen.AllScreens.Length == 1))
                            num = 0;*/
                        MemForm.Top = num;
                        break;
                    case "mem_left":
                        num = Int32.Parse(val);
                        /*if((num < 0) || (num > Screen.PrimaryScreen.Bounds.Width && Screen.AllScreens.Length == 1))
                            num = 0;*/
                        MemForm.Left = num;
                        break;
                    case "SetupWizard":
                        if(val == "1")
                            run_setup_wizard = false;
                        break;
                    case "show_alpha_warning":
                        show_alpha_warning = bool.Parse(val);
                        break;
                    case "rx1_image_gain_table":
                        string[] list = val.Split('|');
                        for(int i=0; i<=(int)Band.B6M && i < list.Length; i++)
                            rx1_image_gain_table[i] = float.Parse(list[i]);
                        break;
                    case "rx1_image_phase_table":
                        list = val.Split('|');
                        for(int i=0; i<=(int)Band.B6M && i < list.Length; i++)
                            rx1_image_phase_table[i] = float.Parse(list[i]);
                        break;
                    case "rx2_image_gain_table":
                        list = val.Split('|');
                        for(int i=0; i<=(int)Band.B6M && i < list.Length; i++)
                            rx2_image_gain_table[i] = float.Parse(list[i]);
                        break;
                    case "rx2_image_phase_table":
                        list = val.Split('|');
                        for(int i=0; i<=(int)Band.B6M && i < list.Length; i++)
                            rx2_image_phase_table[i] = float.Parse(list[i]);
                        break;
                    case "tx_image_gain_table":
                        list = val.Split('|');
                        for(int i=0; i<=(int)Band.B6M && i < list.Length; i++)
                            tx_image_gain_table[i] = float.Parse(list[i]);
                        break;
                    case "tx_image_phase_table":
                        list = val.Split('|');
                        for(int i=0; i<=(int)Band.B6M && i < list.Length; i++)
                            tx_image_phase_table[i] = float.Parse(list[i]);
                        break;
                }
            }

            // restore saved values to the controls
            foreach(string s in a)				// string is in the format "name,value"
            {
                string[] vals = s.Split('/');
                string name = vals[0];
                string val = vals[1];

                if(s.StartsWith("chk"))			// control is a CheckBox
                {
                    for(int i=0; i<checkbox_list.Count; i++)
                    {	// look through each control to find the matching name
                        CheckBoxTS c = (CheckBoxTS)checkbox_list[i];
                        if(c.Name.Equals(name))		// name found
                        {
                            c.Checked = bool.Parse(val);	// restore value
                            i = checkbox_list.Count+1;
                        }
                        if(i == checkbox_list.Count)
                            MessageBox.Show("Control not found: "+name, "GetState Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else if(s.StartsWith("combo"))	// control is a ComboBox
                {
                    for(int i=0; i<combobox_list.Count; i++)
                    {	// look through each control to find the matching name
                        ComboBoxTS c = (ComboBoxTS)combobox_list[i];
                        if(c.Name.Equals(name))		// name found
                        {
                            c.Text = val;	// restore value
                            i = combobox_list.Count+1;
                        }
                        if(i == combobox_list.Count)
                            MessageBox.Show("Control not found: "+name, "GetState Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else if(s.StartsWith("ud"))
                {
                    for(int i=0; i<numericupdown_list.Count; i++)
                    {	// look through each control to find the matching name
                        NumericUpDownTS c = (NumericUpDownTS)numericupdown_list[i];
                        if(c.Name.Equals(name))		// name found
                        {
                            decimal num = decimal.Parse(val);

                            if(num > c.Maximum) num = c.Maximum;		// check endpoints
                            else if(num < c.Minimum) num = c.Minimum;
                            c.Value = num;			// restore value
                            i = numericupdown_list.Count+1;
                        }
                        if(i == numericupdown_list.Count)
                            MessageBox.Show("Control not found: "+name, "GetState Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else if(s.StartsWith("rad"))
                {	// look through each control to find the matching name
                    for(int i=0; i<radiobutton_list.Count; i++)
                    {
                        RadioButtonTS c = (RadioButtonTS)radiobutton_list[i];
                        if(c.Name.Equals(name))		// name found
                        {
                            if(!val.ToLower().Equals("true") && !val.ToLower().Equals("false"))
                                val = "True";
                            c.Checked = bool.Parse(val);	// restore value
                            i = radiobutton_list.Count+1;
                        }
                        if(i == radiobutton_list.Count)
                            MessageBox.Show("Control not found: "+name, "GetState Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else if(s.StartsWith("txt"))
                {	// look through each control to find the matching name
                    for(int i=0; i<textbox_list.Count; i++)
                    {
                        TextBoxTS c = (TextBoxTS)textbox_list[i];
                        if(c.Name.Equals(name))		// name found
                        {
                            c.Text = val;	// restore value
                            i = textbox_list.Count+1;
                        }
                        if(i == textbox_list.Count)
                            MessageBox.Show("Control not found: "+name, "GetState Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else if(s.StartsWith("tb"))
                {
                    // look through each control to find the matching name
                    for(int i=0; i<trackbar_list.Count; i++)
                    {
                        TrackBarTS c = (TrackBarTS)trackbar_list[i];
                        if(c.Name.Equals(name))		// name found
                        {
                            c.Value = Int32.Parse(val);
                            i = trackbar_list.Count+1;
                        }
                        if(i == trackbar_list.Count)
                            MessageBox.Show("Control not found: "+name, "GetState Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }

            Common.ForceFormOnScreen(this);
            Common.ForceFormOnScreen(SetupForm);
            Common.ForceFormOnScreen(MemForm);
        }