private void LoadUserData(ResNX.UserData item)
        {
            ListViewItem listItem = new ListViewItem();

            listItem.Text = item.Name;
            listItem.SubItems.Add(item.Type.ToString());

            string value = "";

            switch (item.Type)
            {
            case ResNX.UserDataType.WString:
            case ResNX.UserDataType.String:
                if (item.GetValueStringArray() != null)
                {
                    foreach (var val in item.GetValueStringArray())
                    {
                        value += $" {val}";
                    }
                }
                break;

            case ResNX.UserDataType.Single:
                if (item.GetValueSingleArray() != null)
                {
                    foreach (var val in item.GetValueSingleArray())
                    {
                        value += $" {val}";
                    }
                }
                break;

            case ResNX.UserDataType.Int32:
                if (item.GetValueInt32Array() != null)
                {
                    foreach (var val in item.GetValueInt32Array())
                    {
                        value += $" {val}";
                    }
                }
                break;

            case ResNX.UserDataType.Byte:
                if (item.GetValueByteArray() != null)
                {
                    foreach (var val in item.GetValueByteArray())
                    {
                        value += $" {val}";
                    }
                }
                break;
            }
            listItem.SubItems.Add(value);

            listViewCustom1.Items.Add(listItem);
        }
        private bool EditData()
        {
            if (SelectedDataU != null)
            {
                UserDataParser parser = new UserDataParser();
                parser.UserDataName = SelectedDataU.Name;
                parser.Type         = SelectedDataU.Type.ToString();

                switch (SelectedDataU.Type)
                {
                case UserDataType.WString:
                case UserDataType.String:
                    if (SelectedDataU.GetValueStringArray() != null)
                    {
                        parser.LoadValues(SelectedDataU.GetValueStringArray());
                    }
                    break;

                case UserDataType.Single:
                    if (SelectedDataU.GetValueSingleArray() != null)
                    {
                        parser.LoadValues(SelectedDataU.GetValueSingleArray());
                    }
                    break;

                case UserDataType.Int32:
                    if (SelectedDataU.GetValueInt32Array() != null)
                    {
                        parser.LoadValues(SelectedDataU.GetValueInt32Array());
                    }
                    break;

                case UserDataType.Byte:
                    if (SelectedDataU.GetValueByteArray() != null)
                    {
                        parser.LoadValues(SelectedDataU.GetValueByteArray());
                    }
                    break;
                }
                if (parser.ShowDialog() == DialogResult.OK)
                {
                    SelectedDataU.Name = parser.UserDataName;

                    if (parser.Type == "Byte")
                    {
                        SelectedDataU.SetValue(parser.GetBytes());
                    }
                    if (parser.Type == "Single")
                    {
                        SelectedDataU.SetValue(parser.GetFloats());
                    }
                    if (parser.Type == "Int32")
                    {
                        SelectedDataU.SetValue(parser.GetInts());
                    }
                    if (parser.Type == "String")
                    {
                        SelectedDataU.SetValue(parser.GetStringASCII());
                    }
                    if (parser.Type == "WString")
                    {
                        SelectedDataU.SetValue(parser.GetStringUnicode(), true);
                    }

                    LoadUserData(userData);
                    return(true);
                }
            }
            else if (SelectedDataNX != null)
            {
                UserDataParser parser = new UserDataParser();
                parser.UserDataName = SelectedDataNX.Name;
                parser.Type         = SelectedDataNX.Type.ToString();

                switch (SelectedDataNX.Type)
                {
                case ResNX.UserDataType.WString:
                case ResNX.UserDataType.String:
                    if (SelectedDataNX.GetValueStringArray() != null)
                    {
                        parser.LoadValues(SelectedDataNX.GetValueStringArray());
                    }
                    break;

                case ResNX.UserDataType.Single:
                    if (SelectedDataNX.GetValueSingleArray() != null)
                    {
                        parser.LoadValues(SelectedDataNX.GetValueSingleArray());
                    }
                    break;

                case ResNX.UserDataType.Int32:
                    if (SelectedDataNX.GetValueInt32Array() != null)
                    {
                        parser.LoadValues(SelectedDataNX.GetValueInt32Array());
                    }
                    break;

                case ResNX.UserDataType.Byte:
                    if (SelectedDataNX.GetValueByteArray() != null)
                    {
                        parser.LoadValues(SelectedDataNX.GetValueByteArray());
                    }
                    break;
                }
                if (parser.ShowDialog() == DialogResult.OK)
                {
                    SelectedDataNX.Name = parser.UserDataName;

                    if (parser.Type == "Byte")
                    {
                        SelectedDataNX.SetValue(parser.GetBytes());
                    }
                    if (parser.Type == "Single")
                    {
                        SelectedDataNX.SetValue(parser.GetFloats());
                    }
                    if (parser.Type == "Int32")
                    {
                        SelectedDataNX.SetValue(parser.GetInts());
                    }
                    if (parser.Type == "String")
                    {
                        SelectedDataNX.SetValue(parser.GetStringASCII());
                    }
                    if (parser.Type == "WString")
                    {
                        SelectedDataNX.SetValue(parser.GetStringUnicode());
                    }

                    LoadUserData(userDataNX);
                    return(true);
                }
            }
            return(false);
        }