Ejemplo n.º 1
0
        public void FromStringEx(string str)
        {
            int index = str.IndexOf('|');

            Type = (EOnlineKeyValuePairDataType)int.Parse(str.Substring(0, index));
            str  = str.Substring(index + 1);

            switch (Type)
            {
            case EOnlineKeyValuePairDataType.Blob:
                string[] splitted = str.Split(',');
                byte[]   buffer   = new byte[splitted.Length];
                for (int j = 0; j < splitted.Length; j++)
                {
                    buffer[j] = byte.Parse(splitted[j]);
                }
                SetValue(buffer);
                break;

            default:
                FromString(str);
                break;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Copies the data and sets the type
 /// </summary>
 /// <param name="data">The new data to assign</param>
 public unsafe void SetValue(byte[] data)
 {
     Type = EOnlineKeyValuePairDataType.Blob;
     Data = new byte[data.Length];
     Buffer.BlockCopy(data, 0, Data, 0, data.Length);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Copies the data and sets the type
 /// </summary>
 /// <param name="data">The new data to assign</param>
 public void SetValue(float data)
 {
     Type = EOnlineKeyValuePairDataType.Float;
     Data = BitConverter.GetBytes(data);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Copies the data and sets the type
 /// </summary>
 /// <param name="data">The new data to assign</param>
 public void SetValue(double data)
 {
     Type = EOnlineKeyValuePairDataType.Double;
     Data = BitConverter.GetBytes(data);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Copies the data and sets the type
 /// </summary>
 /// <param name="data">The new data to assign</param>
 public void SetValue(bool data)
 {
     Type = EOnlineKeyValuePairDataType.Bool;
     Data = BitConverter.GetBytes(data);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Copies the data and sets the type
 /// </summary>
 /// <param name="data">The new data to assign</param>
 public void SetValue(uint data)
 {
     Type = EOnlineKeyValuePairDataType.UInt32;
     Data = BitConverter.GetBytes(data);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Copies the data and sets the type
 /// </summary>
 /// <param name="data">The new data to assign</param>
 public void SetValue(string data)
 {
     Type = EOnlineKeyValuePairDataType.String;
     Data = Encoding.Unicode.GetBytes(data);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Cleans up the existing data and sets the type to Empty
 /// </summary>
 public void Empty()
 {
     Type = EOnlineKeyValuePairDataType.Empty;
     Data = null;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Copies the data and sets the type
 /// </summary>
 /// <param name="data">The new data to assign</param>
 public void SetJsonValueFromString(string data)
 {
     Type = EOnlineKeyValuePairDataType.Json;
     Data = Encoding.Unicode.GetBytes(data);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Copies the data and sets the type
 /// </summary>
 /// <param name="data">The new data to assign</param>
 public void SetValue(long data)
 {
     Type = EOnlineKeyValuePairDataType.Int64;
     Data = BitConverter.GetBytes(data);
 }