private void btnAdd_Click(object sender, EventArgs e)
        {
            if (IsWiiU)
            {
                UserData userDataNew = new UserData();
                userDataNew.SetValue(new int[0]);
                SelectedDataU = userDataNew;
                bool IsEdited = EditData();

                if (IsEdited)
                {
                    userData.Add(SelectedDataU.Name, SelectedDataU);
                    LoadUserData(SelectedDataU);
                }
            }
            else
            {
                ResNX.UserData userDataNew = new ResNX.UserData();
                userDataNew.SetValue(new int[0]);
                SelectedDataNX = userDataNew;
                bool IsEdited = EditData();

                if (IsEdited)
                {
                    userDataNX.Add(SelectedDataNX);
                    LoadUserData(SelectedDataNX);
                }
            }
        }
        private void listViewCustom1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewCustom1.SelectedItems.Count > 0)
            {
                btnScrolDown.Enabled = true;
                btnScrollUp.Enabled  = true;
                btnEdit.Enabled      = true;
                btnRemove.Enabled    = true;

                if (IsWiiU)
                {
                    SelectedDataU = userData[listViewCustom1.SelectedIndices[0]];
                }
                else
                {
                    SelectedDataNX = userDataNX[listViewCustom1.SelectedIndices[0]];
                }
            }
            else
            {
                SelectedDataU        = null;
                SelectedDataNX       = null;
                btnScrolDown.Enabled = false;
                btnScrollUp.Enabled  = false;
                btnEdit.Enabled      = false;
                btnRemove.Enabled    = false;
            }
        }
        private static List <ResNX.UserData> ConvertUserDataWiiU2Switch(ResU.ResDict <ResU.UserData> UserDataU)
        {
            var UserDataNX = new List <ResNX.UserData>();

            for (int i = 0; i < UserDataU.Count; i++)
            {
                var userData = new ResNX.UserData();
                userData.Name = UserDataU[i].Name;

                if (UserDataU[i].Type == ResU.UserDataType.Byte)
                {
                    userData.SetValue(UserDataU[i].GetValueByteArray());
                }
                if (UserDataU[i].Type == ResU.UserDataType.Int32)
                {
                    userData.SetValue(UserDataU[i].GetValueInt32Array());
                }
                if (UserDataU[i].Type == ResU.UserDataType.Single)
                {
                    userData.SetValue(UserDataU[i].GetValueSingleArray());
                }
                if (UserDataU[i].Type == ResU.UserDataType.String)
                {
                    userData.SetValue(UserDataU[i].GetValueStringArray());
                }
                if (UserDataU[i].Type == ResU.UserDataType.WString)
                {
                    userData.SetValue(UserDataU[i].GetValueStringArray());
                }

                UserDataNX.Add(userData);
            }

            return(UserDataNX);
        }
        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);
        }
        //Convert the user data from bntx
        public void LoadUserData(List <ResBNTX.UserData> UserDataList)
        {
            userDataNX = new List <ResNX.UserData>();

            listViewCustom1.Items.Clear();

            foreach (var item in UserDataList)
            {
                var userData = new ResNX.UserData();

                userData.Name = item.Name;
                if (item.Type == ResBNTX.UserDataType.Byte)
                {
                    userData.SetValue(item.GetValueByteArray());
                }
                if (item.Type == ResBNTX.UserDataType.String)
                {
                    userData.SetValue(item.GetValueStringArray());
                }
                if (item.Type == ResBNTX.UserDataType.WString)
                {
                    userData.SetValue(item.GetValueStringArray());
                }
                if (item.Type == ResBNTX.UserDataType.Single)
                {
                    userData.SetValue(item.GetValueSingleArray());
                }
                if (item.Type == ResBNTX.UserDataType.Int32)
                {
                    userData.SetValue(item.GetValueInt32Array());
                }

                userDataNX.Add(userData);
                LoadUserData(userData);
            }
        }
        public static ResNX.SkeletalAnim FSKAConvertWiiUToSwitch(ResU.SkeletalAnim skeletalAnimU)
        {
            ResNX.SkeletalAnim ska = new ResNX.SkeletalAnim();
            ska.Name       = skeletalAnimU.Name;
            ska.Path       = skeletalAnimU.Path;
            ska.FrameCount = skeletalAnimU.FrameCount;
            ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.None;

            if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Maya))
            {
                ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Maya;
            }
            if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Softimage))
            {
                ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Softimage;
            }
            if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Standard))
            {
                ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Standard;
            }

            ska.FrameCount  = skeletalAnimU.FrameCount;
            ska.BindIndices = skeletalAnimU.BindIndices;
            ska.BakedSize   = skeletalAnimU.BakedSize;
            ska.Loop        = skeletalAnimU.Loop;
            ska.Baked       = skeletalAnimU.Baked;
            foreach (var userDataU in skeletalAnimU.UserData)
            {
                var parser     = new UserDataParser();
                var userDataNX = new ResNX.UserData();
                parser.Type         = userDataU.Value.Type.ToString();
                parser.UserDataName = userDataU.Value.Name;
                userDataNX.Name     = parser.UserDataName;
                if (parser.Type == "Byte")
                {
                    userDataNX.SetValue(parser.GetBytes());
                }
                if (parser.Type == "Single")
                {
                    parser.LoadValues(userDataU.Value.GetValueSingleArray());
                }
                userDataNX.SetValue(parser.GetFloats());
                if (parser.Type == "Int32")
                {
                    userDataNX.SetValue(parser.GetInts());
                }
                if (parser.Type == "String")
                {
                    userDataNX.SetValue(parser.GetStringASCII());
                }
                if (parser.Type == "WString")
                {
                    userDataNX.SetValue(parser.GetStringUnicode());
                }
                ska.UserDatas.Add(userDataNX);
            }
            foreach (var boneAnimU in skeletalAnimU.BoneAnims)
            {
                var boneAnim = new ResNX.BoneAnim();
                ska.BoneAnims.Add(boneAnim);
                boneAnim.Name               = boneAnimU.Name;
                boneAnim.BeginRotate        = boneAnimU.BeginRotate;
                boneAnim.BeginTranslate     = boneAnimU.BeginTranslate;
                boneAnim.BeginBaseTranslate = boneAnimU.BeginBaseTranslate;
                var baseData = new ResNX.BoneAnimData();
                baseData.Translate      = boneAnimU.BaseData.Translate;
                baseData.Scale          = boneAnimU.BaseData.Scale;
                baseData.Rotate         = boneAnimU.BaseData.Rotate;
                baseData.Flags          = boneAnimU.BaseData.Flags;
                boneAnim.BaseData       = baseData;
                boneAnim.FlagsBase      = (ResNX.BoneAnimFlagsBase)boneAnimU.FlagsBase;
                boneAnim.FlagsCurve     = (ResNX.BoneAnimFlagsCurve)boneAnimU.FlagsCurve;
                boneAnim.FlagsTransform = (ResNX.BoneAnimFlagsTransform)boneAnimU.FlagsTransform;
                boneAnim.Curves         = ConvertAnimCurveWiiUToSwitch(boneAnimU.Curves);
            }

            return(ska);
        }