//constructer, it determines a few things to get length.
 public Parameter(Int16 hsh, byte n, string nme, Int32 vlen, bbreader binr)
 {
     this.hash = hsh;
     this.nb = n;
     this.name = nme;
     this.valueLength = vlen;
     switch (vlen)
     {
         case 4:
             if (!this.name.Contains("Color"))
             {
                 this.flag = valueType.unk;
                 this.fourVal = binr.ReadBytes(4);
                 Array.Reverse(this.fourVal);
                 this.intValue = BitConverter.ToInt32(this.fourVal, 0);
                 this.dubValue = BitConverter.ToSingle(this.fourVal, 0);
                 Array.Reverse(this.fourVal);
             }
             else {
                 flag = valueType.color;
                 this.colorVal = binr.readRgba();
             }
             break;
         case 2:
             flag = valueType.integer;
             this.intValue = binr.ReadInt16();
             break;
         case 1:
             flag = valueType.integer;
             this.intValue = binr.ReadByte();
             break;
         case 12:
             flag = valueType.vec;
             this.vec = new math.vector(binr.ReadSingle(), binr.ReadSingle(), binr.ReadSingle());
             break;
         default:
             Console.Write("Unknown Value Length {0} at offset {1}", this.valueLength, binr.BaseStream.Position);
             break;
     }
 }
 private void openFile_Click(object sender, EventArgs e)
 {
     clear_editor();
     opParam.Filter = "LM Parameter Files (*.prm)|*.prm";
     opParam.ShowDialog();
     if (opParam.FileName != "")
     {
         path = opParam.FileName;
         using (FileStream fs = new FileStream(opParam.FileName, FileMode.OpenOrCreate))
         {
             using (bbreader binr = new bbreader(fs))
             {
                 parameterVal.Clear();
                 paramList.Nodes.Clear();
                 paramList.BeginUpdate();
                 paramNum = binr.ReadInt32();
                 for (int i = 0; i < paramNum; i++)
                 {
                     parameterVal.Add(new Parameter(binr.ReadInt16(), binr.ReadByte(), binr.ReadString(), binr.ReadInt32(), binr));
                     paramList.Nodes.Add(parameterVal[i].name);
                 }
                 paramList.EndUpdate();
             }
         }
     }
 }