Beispiel #1
0
        public static void SetVector(this KeyValuePairs kvp, string key, Vector3 value)
        {
            var vectorString =
                value.X.ToString(CultureInfo.InvariantCulture) + "," +
                value.Y.ToString(CultureInfo.InvariantCulture) + "," +
                value.Z.ToString(CultureInfo.InvariantCulture);

            kvp.Set(key, vectorString);
        }
Beispiel #2
0
 public static void SetStringArray(this KeyValuePairs kvp, string key, string[] value)
 {
     if (value != null)
     {
         kvp.Set(key, string.Join(",", value));
     }
     else
     {
         kvp.Remove(key);
     }
 }
Beispiel #3
0
        public static void SetColour(this KeyValuePairs kvp, string key, Vector3 value)
        {
            int colourHex =
                (((int)(value.X * 255.0f) & 0xff) << 16) +
                (((int)(value.Y * 255.0f) & 0xff) << 8) +
                ((int)(value.Z * 255.0f) & 0xff);

            var colourString =
                "#" + colourHex.ToString("X6");

            kvp.Set(key, colourString);
        }
Beispiel #4
0
 public static void SetIntegerArray(this KeyValuePairs kvp, string key, int[] value)
 {
     if (value != null)
     {
         var joined = new StringBuilder();
         for (int i = 0; i < value.Length; ++i)
         {
             joined.Append(value[i].ToString(CultureInfo.InvariantCulture));
             if (i < value.Length - 1)
             {
                 joined.Append(',');
             }
         }
         kvp.Set(key, joined.ToString());
     }
     else
     {
         kvp.Remove(key);
     }
 }
Beispiel #5
0
 public static void SetGUID(this KeyValuePairs kvp, string key, Guid value)
 {
     kvp.Set(key, value.ToString());
 }