private ISFSArray UnrollArray(ArrayList arr) { ISFSArray iSFSArray = SFSArray.NewInstance(); IEnumerator enumerator = arr.GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; SFSDataWrapper sFSDataWrapper = WrapField(current); if (sFSDataWrapper == null) { throw new SFSCodecError(string.Concat("Cannot serialize field of array: ", current, " -- unsupported type!")); } iSFSArray.Add(sFSDataWrapper); } return(iSFSArray); } finally { IDisposable disposable; if ((disposable = enumerator as IDisposable) != null) { disposable.Dispose(); } } }
private ISFSArray DecodeSFSArray(ByteArray buffer) { //Discarded unreachable code: IL_00c1 ISFSArray iSFSArray = SFSArray.NewInstance(); SFSDataType sFSDataType = (SFSDataType)Convert.ToInt32(buffer.ReadByte()); if (sFSDataType != SFSDataType.SFS_ARRAY) { throw new SFSCodecError(string.Concat("Invalid SFSDataType. Expected: ", SFSDataType.SFS_ARRAY, ", found: ", sFSDataType)); } int num = buffer.ReadShort(); if (num < 0) { throw new SFSCodecError("Can't decode SFSArray. Size is negative: " + num); } try { for (int i = 0; i < num; i++) { SFSDataWrapper sFSDataWrapper = DecodeObject(buffer); if (sFSDataWrapper != null) { iSFSArray.Add(sFSDataWrapper); continue; } throw new SFSCodecError("Could not decode SFSArray item at index: " + i); } return(iSFSArray); } catch (SFSCodecError sFSCodecError) { throw sFSCodecError; } }
private ISFSArray decodeSFSArray(JsonData jdo) { ISFSArray iSFSArray = SFSArrayLite.NewInstance(); for (int i = 0; i < jdo.Count; i++) { JsonData jsonData = jdo[i]; SFSDataWrapper sFSDataWrapper = decodeJsonObject(jsonData); if (sFSDataWrapper != null) { iSFSArray.Add(sFSDataWrapper); continue; } throw new InvalidOperationException("JSON > ISFSArray error: could not decode value for object: " + jsonData); } return(iSFSArray); }