public BasicHistoryItem(string data) { string[] arr = data.Substring(1, data.Length - 2).Trim('[', ']').Split(new string[] { "\\\"" }, StringSplitOptions.RemoveEmptyEntries); //cid, iid, hashname for (int i = 0; i < arr.Length; ++i) { arr[i] = Encode.DecodeEncodedNonAsciiCharacters(arr[i]); } if (arr.Length == 15) { long.Parse(arr[0]); long.Parse(arr[2]); price = int.Parse(arr[8]); if (arr[14] != "RUB") { throw new ArgumentException($"Currencies other than rub are not supported {data}"); } return; } else { throw new ArgumentException($"Can't construct newhistory item from {data}"); } //cid - iid }
public NewHistoryItem(string data) { string[] arr = data.Substring(1, data.Length - 2).Trim('[', ']').Split(new string[] { "\\\"" }, StringSplitOptions.RemoveEmptyEntries); //cid, iid, hashname for (int i = 0; i < arr.Length; ++i) { arr[i] = Encode.DecodeEncodedNonAsciiCharacters(arr[i]); } if (arr.Length == 15) { //0 - cid //2 - iid //4 - market_hashname //6 - date //8 - price //10 - market_name //12 - color //14 - currency //rest are ',' i_classid = long.Parse(arr[0]); i_instanceid = long.Parse(arr[2]); price = Int32.Parse(arr[8]); i_market_name = arr[10]; if (arr[14] != "RUB") { throw new ArgumentException($"Currencies other than rub are not supported {data}"); } return; } else { throw new ArgumentException($"Can't construct newhistory item from {data}"); } //cid - iid }