using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Halo3Map.Map;

namespace MetaEditor.Controls
{
    public partial class StringID : UserControl
    {
        private Map map;
        private int index;

        public StringID(int value, string name, Map Map)
        {
            map = Map;
            InitializeComponent();
            if (value <= map.StringsTable.Strings.Count)
            {
                comboBox1.Text = map.StringsTable.Strings[value].Name;
                LoadStringsList();
            }
            else
            {
                comboBox1.Text = "Error: Index out of bounds";
                LoadStringsList();
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            index = comboBox1.SelectedIndex;
        }

        private void LoadStringsList()
        {
            comboBox1.Items.Clear();
            for (int i = 0; i < map.StringsTable.Strings.Count; i++)
            {
                comboBox1.Items.Add(map.StringsTable.Strings[i].Name);
            }
        }
    }
}
