private void showPatternDetails(Patterns.patternDetails pDetails, bool doEnable)
        {
            txtPatternAFilename.Text = pDetails.filename;
            txtPatternAKey.Text = pDetails.key;
            txtPatternAName.Text = pDetails.name;
            if (pDetails.Linked.ToLower() == "true") { chkPatternALinked.Checked = true; }
            else { chkPatternALinked.Checked = false; }

            txtPatternARGBMask.Text = pDetails.rgbmask;
            txtPatternASpecular.Text = pDetails.specmap;
            txtPatternATiling.Text = pDetails.Tiling;

            switch (pDetails.type)
            {
                case "solidColor":
                    cmbPatternAType.SelectedIndex = 0;
                    picPatternSolidColour.BackColor = MadScience.Colours.convertColour(pDetails.Color);

                    picPatternThumb.Image = Patterns.makePatternThumb(pDetails);

                    break;
                case "HSV":
                    cmbPatternAType.SelectedIndex = 2;

                    Colours.HSVColor hsv = new Colours.HSVColor();
                    hsv.Hue = Convert.ToDouble(pDetails.HBg,CultureInfo.InvariantCulture) * 360 + Convert.ToDouble(pDetails.BaseHBg,CultureInfo.InvariantCulture) * 360;
                    hsv.Saturation = Convert.ToDouble(pDetails.SBg,CultureInfo.InvariantCulture) + Convert.ToDouble(pDetails.BaseSBg,CultureInfo.InvariantCulture);
                    hsv.Value = Convert.ToDouble(pDetails.VBg,CultureInfo.InvariantCulture) + Convert.ToDouble(pDetails.BaseVBg,CultureInfo.InvariantCulture);
                    picHSVColorBG.BackColor = hsv.Color;

                    if ((pDetails.ChannelEnabled[0] != null) && (pDetails.ChannelEnabled[0].ToLower() == "true"))
                    {
                        hsv.Hue = Convert.ToDouble(pDetails.H[0],CultureInfo.InvariantCulture) * 360 + Convert.ToDouble(pDetails.BaseH[0],CultureInfo.InvariantCulture) * 360;
                        hsv.Saturation = Convert.ToDouble(pDetails.S[0],CultureInfo.InvariantCulture) + Convert.ToDouble(pDetails.BaseS[0],CultureInfo.InvariantCulture);
                        hsv.Value = Convert.ToDouble(pDetails.V[0],CultureInfo.InvariantCulture) + Convert.ToDouble(pDetails.BaseV[0],CultureInfo.InvariantCulture);
                        picHSVColorChannel1.BackColor = hsv.Color;
                        picHSVColorChannel1.Visible = true;
                        label23.Visible = true;
                    }
                    else
                    {
                        picHSVColorChannel1.Visible = false;
                        label23.Visible = false;
                    }

                    if ((pDetails.ChannelEnabled[1] != null) && (pDetails.ChannelEnabled[1].ToLower() == "true"))
                    {
                        hsv.Hue = Convert.ToDouble(pDetails.H[1],CultureInfo.InvariantCulture) * 360 + Convert.ToDouble(pDetails.BaseH[1],CultureInfo.InvariantCulture) * 360;
                        hsv.Saturation = Convert.ToDouble(pDetails.S[1],CultureInfo.InvariantCulture) + Convert.ToDouble(pDetails.BaseS[1],CultureInfo.InvariantCulture);
                        hsv.Value = Convert.ToDouble(pDetails.V[1],CultureInfo.InvariantCulture) + Convert.ToDouble(pDetails.BaseV[1],CultureInfo.InvariantCulture);
                        picHSVColorChannel2.BackColor = hsv.Color;
                        picHSVColorChannel2.Visible = true;
                        label24.Visible = true;
                    }
                    else
                    {
                        picHSVColorChannel2.Visible = false;
                        label24.Visible = false;
                    }

                    if ((pDetails.ChannelEnabled[2] != null) && (pDetails.ChannelEnabled[2].ToLower() == "true"))
                    {
                        hsv.Hue = Convert.ToDouble(pDetails.H[2],CultureInfo.InvariantCulture) * 360 + Convert.ToDouble(pDetails.BaseH[2],CultureInfo.InvariantCulture) * 360;
                        hsv.Saturation = Convert.ToDouble(pDetails.S[2],CultureInfo.InvariantCulture) + Convert.ToDouble(pDetails.BaseS[2],CultureInfo.InvariantCulture);
                        hsv.Value = Convert.ToDouble(pDetails.V[2],CultureInfo.InvariantCulture) + Convert.ToDouble(pDetails.BaseV[2],CultureInfo.InvariantCulture);
                        picHSVColorChannel3.BackColor = hsv.Color;
                        picHSVColorChannel3.Visible = true;
                        label25.Visible = true;
                    }
                    else
                    {
                        picHSVColorChannel3.Visible = false;
                        label25.Visible = false;
                    }

                    picPatternThumb.Image = Patterns.makePatternThumb(pDetails);

                    break;
                case "Coloured":
                    cmbPatternAType.SelectedIndex = 1;

                    Color temp;
                    temp = MadScience.Colours.convertColour(pDetails.ColorP[0], true);
                    picPatternColourBg.BackColor = temp;
                    if (temp == Color.Empty)
                    {
                        picPatternColourBg.Tag = "empty";
                        picPatternColourBg.Visible = false;
                        label65.Visible = false;
                    }
                    else
                    {
                        picPatternColourBg.Tag = "color";
                        //picPatternColourBg.Visible = true;
                        //label65.Visible = true;
                        picPatternColourBg.Visible = false;
                        label65.Visible = false;
                    }

                    temp = MadScience.Colours.convertColour(pDetails.ColorP[1], true);
                    picPatternColour1.BackColor = temp;
                    if (temp == Color.Empty)
                    {
                        picPatternColour1.Tag = "empty";
                        picPatternColour1.Visible = false;
                        label64.Visible = false;
                    }
                    else
                    {
                        picPatternColour1.Tag = "color";
                        picPatternColour1.Visible = true;
                        label64.Visible = true;
                    }

                    temp = MadScience.Colours.convertColour(pDetails.ColorP[2], true);
                    picPatternColour2.BackColor = temp;
                    if (temp == Color.Empty)
                    {
                        picPatternColour2.Tag = "empty";
                        picPatternColour2.Visible = false;
                        label67.Visible = false;
                    }
                    else
                    {
                        picPatternColour2.Tag = "color";
                        picPatternColour2.Visible = true;
                        label67.Visible = true;
                    }

                    temp = MadScience.Colours.convertColour(pDetails.ColorP[3], true);
                    picPatternColour3.BackColor = temp;
                    if (temp == Color.Empty)
                    {
                        picPatternColour3.Tag = "empty";
                        picPatternColour3.Visible = false;
                        label66.Visible = false;
                    }
                    else
                    {
                        picPatternColour3.Tag = "color";
                        picPatternColour3.Visible = true;
                        label66.Visible = true;
                    }

                    temp = MadScience.Colours.convertColour(pDetails.ColorP[4], true);
                    picPatternColour4.BackColor = temp;
                    if (temp == Color.Empty)
                    {
                        picPatternColour4.Tag = "empty";
                        picPatternColour4.Visible = false;
                        label68.Visible = false;
                    }
                    else
                    {
                        picPatternColour4.Tag = "color";
                        picPatternColour4.Visible = true;
                        label68.Visible = true;
                    }

                    picPatternThumb.Image = Patterns.makePatternThumb(pDetails);

                    break;
            }

            if (doEnable)
            {
                if (pDetails.Enabled.ToLower() == "true") { chkPatternAEnabled.Checked = true; }
                else { chkPatternAEnabled.Checked = false; }
            }

            grpPatternA.Enabled = true;
        }
 private void showPatternDetails(Patterns.patternDetails pDetails)
 {
     showPatternDetails(pDetails, true);
 }