private string getCurrentValue(Game game, GameVariableAttribute gva, PropertyInfo pi)
 {
     if (pi.PropertyType == typeof(bool))
     {
         bool val = (bool)pi.GetValue(game);
         return(val ? "true" : "false");
     }
     else if (pi.PropertyType == typeof(string))
     {
         string val = (string)pi.GetValue(game);
         if (val == null)
         {
             return("<i>dynamic</i>");
         }
         else
         {
             return("\"" + val + "\"");
         }
     }
     else if (pi.PropertyType == typeof(int))
     {
         int val = (int)pi.GetValue(game);
         return(val.ToString());
     }
     else if (pi.PropertyType == typeof(ChoiceVariable))
     {
         ChoiceVariable val = (ChoiceVariable)pi.GetValue(game);
         return(val.Value);
     }
     else if (pi.PropertyType == typeof(IntRangeVariable))
     {
         IntRangeVariable val = (IntRangeVariable)pi.GetValue(game);
         return("<i>integer</i> between " + val.MinValue.ToString() + " and " + val.MaxValue.ToString());
     }
     else if (pi.PropertyType == typeof(PieceType))
     {
         PieceType pt = (PieceType)pi.GetValue(game);
         if (pt != null)
         {
             return(pt.Name + (pt.Name != pt.InternalName ? " (" + pt.InternalName + ")" : ""));
         }
         else
         {
             return("null");
         }
     }
     return("");
 }
 private string getPotentialValues(Game game, GameVariableAttribute gva, PropertyInfo pi, out bool paragraph, bool fullDescription = false)
 {
     paragraph = false;
     if (pi.PropertyType == typeof(bool))
     {
         return("<i>boolean</i>");
     }
     else if (pi.PropertyType == typeof(string))
     {
         string val = (string)pi.GetValue(game);
         if (val == null)
         {
             return("<i>dynamic</i>");
         }
         else
         {
             return("<i>string</i>");                    //"\"" + val + "\"";
         }
     }
     else if (pi.PropertyType == typeof(int))
     {
         return("<i>integer</i>");
     }
     else if (pi.PropertyType == typeof(ChoiceVariable))
     {
         ChoiceVariable val = (ChoiceVariable)pi.GetValue(game);
         if (val.HasDescriptions)
         {
             paragraph = true;
             string s = "choice of: <blockquote><ul>";
             foreach (string choice in val.Choices)
             {
                 s += "<li><b>" + choice + "</b>";
                 string desc = val.DescribeChoice(choice);
                 if (desc != null)
                 {
                     s += ": " + desc;
                 }
                 s += "</li>";
             }
             s += "</ul></blockquote>";
             return(s);
         }
         else
         {
             string s     = "choice of { ";
             bool   first = true;
             foreach (string choice in val.Choices)
             {
                 if (first)
                 {
                     first = false;
                 }
                 else
                 {
                     s += ", ";
                 }
                 s += choice;
             }
             s += " }";
             if (val.DefaultValue != null)
             {
                 s += " default: " + val.DefaultValue;
             }
             return(s);
         }
     }
     else if (pi.PropertyType == typeof(PieceType))
     {
         return("<i>PieceType</i>");
     }
     else if (pi.PropertyType == typeof(IntRangeVariable))
     {
         IntRangeVariable val = (IntRangeVariable)pi.GetValue(game);
         return("<i>integer</i> between " + val.MinValue.ToString() + " and " + val.MaxValue.ToString());
     }
     return("");
 }