예제 #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;
            }
        }
예제 #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);
 }
예제 #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);
 }
예제 #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);
 }
예제 #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);
 }
예제 #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);
 }
예제 #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);
 }
예제 #8
0
 /// <summary>
 /// Cleans up the existing data and sets the type to Empty
 /// </summary>
 public void Empty()
 {
     Type = EOnlineKeyValuePairDataType.Empty;
     Data = null;
 }
예제 #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);
 }
예제 #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);
 }