Пример #1
0
 /// <summary>This removes a field with given name.</summary>
 public static void RemoveField(UniFields fields, string key)
 {
     if (fields == null || !fields.ContainsKey(key))
     {
         return;
     }
     fields.Remove(key);
 }
Пример #2
0
 /// <summary>This removes fields with given names.</summary>
 public static void RemoveFields(UniFields fields, IEnumerable <string> keys)
 {
     if (fields == null)
     {
         return;
     }
     foreach (string key in keys)
     {
         if (fields.ContainsKey(key))
         {
             fields.Remove(key);
         }
     }
 }
Пример #3
0
 // String
 public static void SetString(UniFields fields, string key, string value, string defaultvalue)
 {
     if (fields == null)
     {
         return;
     }
     if (value != defaultvalue)
     {
         if (!fields.ContainsKey(key))
         {
             fields.Add(key, new UniValue(UniversalType.String, value));
         }
         else
         {
             fields[key].Value = value;
         }
     }
     // Don't save default value
     else if (fields.ContainsKey(key))
     {
         fields.Remove(key);
     }
 }