private void WriteRLAbstractType(RLAbstractType rlAbstractType) { int intCount = 0; int doubleCount = 0; int charCount = 0; if (rlAbstractType != null) { intCount = rlAbstractType.IntCount; doubleCount = rlAbstractType.DoubleCount; charCount = rlAbstractType.CharCount; } writer.Write(intCount); writer.Write(doubleCount); writer.Write(charCount); if (rlAbstractType != null) { foreach (int v in rlAbstractType.IntArray) { writer.Write(v); } foreach (double v in rlAbstractType.DoubleArray) { writer.Write(v); } foreach (char v in rlAbstractType.CharArray) { writer.Write(v); } } writer.Flush(); }
private int GetSizeOf(RLAbstractType abstractType) { int result = IntSize * 3; if (abstractType != null) { result += IntSize * abstractType.IntCount + DoubleSize * abstractType.DoubleCount + CharSize * abstractType.CharCount; } return(result); }
private void ReadRLAbstractType(RLAbstractType rlAbstractType) { int intCount = reader.ReadInt32(); int doubleCount = reader.ReadInt32(); int charCount = reader.ReadInt32(); int[] intArray = Enumerable.Range(0, intCount).Select(i => reader.ReadInt32()).ToArray(); double[] doubleArray = Enumerable.Range(0, doubleCount).Select(i => reader.ReadDouble()).ToArray(); char[] charArray = Enumerable.Range(0, charCount).Select(i => ReadChar()).ToArray(); rlAbstractType.SetIntArray(intArray); rlAbstractType.SetDoubleArray(doubleArray); rlAbstractType.SetCharArray(charArray); }