public static void setData <T>(object value, Array buff, int offset, bool isSwap) //variable이 아닌 경우 값 setting.. { if (buff != null) { if (typeof(T) == typeof(int)) { TypeArrayConverter.FillBufferUnitsFrom <int>(Convert.ToInt32(value), buff, offset, isSwap); } else if (typeof(T) == typeof(byte)) { TypeArrayConverter.FillBufferUnitsFrom <byte>(Convert.ToByte(value), buff, offset, isSwap); } else if (typeof(T) == typeof(short)) { TypeArrayConverter.FillBufferUnitsFrom <short>(Convert.ToInt16(value), buff, offset, isSwap); } else if (typeof(T) == typeof(long)) { TypeArrayConverter.FillBufferUnitsFrom <long>(Convert.ToInt64(value), buff, offset, isSwap); } else if (typeof(T) == typeof(uint)) { TypeArrayConverter.FillBufferUnitsFrom <uint>(Convert.ToUInt32(value), buff, offset, isSwap); } else if (typeof(T) == typeof(sbyte)) { TypeArrayConverter.FillBufferUnitsFrom <sbyte>(Convert.ToSByte(value), buff, offset, isSwap); } else if (typeof(T) == typeof(ulong)) { TypeArrayConverter.FillBufferUnitsFrom <ulong>(Convert.ToUInt64(value), buff, offset, isSwap); } else if (typeof(T) == typeof(ushort)) { TypeArrayConverter.FillBufferUnitsFrom <ushort>(Convert.ToUInt16(value), buff, offset, isSwap); } else if (typeof(T) == typeof(float)) { TypeArrayConverter.FillBufferUnitsFrom <float>(Convert.ToSingle(value), buff, offset, isSwap); } else if (typeof(T) == typeof(double)) { TypeArrayConverter.FillBufferUnitsFrom <double>(Convert.ToDouble(value), buff, offset, isSwap); } else { TypeArrayConverter.FillBufferUnitsFrom <int>(Convert.ToInt32(value), buff, offset, isSwap); } } }
public static void setData(object value, Array buff, int offset, bool isSwap) //variable이 아닌 경우 값 setting.. { if (buff != null) { if (buff.GetValue(0) is int) { TypeArrayConverter.FillBufferUnitsFrom <int>(Convert.ToInt32(value), buff, offset, isSwap); } else if (buff.GetValue(0) is byte) { TypeArrayConverter.FillBufferUnitsFrom <byte>(Convert.ToByte(value), buff, offset, isSwap); } else if (buff.GetValue(0) is short) { TypeArrayConverter.FillBufferUnitsFrom <short>(Convert.ToInt16(value), buff, offset, isSwap); } else if (buff.GetValue(0) is long) { TypeArrayConverter.FillBufferUnitsFrom <long>(Convert.ToInt64(value), buff, offset, isSwap); } else if (buff.GetValue(0) is uint) { TypeArrayConverter.FillBufferUnitsFrom <uint>(Convert.ToUInt32(value), buff, offset, isSwap); } else if (buff.GetValue(0) is sbyte) { TypeArrayConverter.FillBufferUnitsFrom <sbyte>(Convert.ToSByte(value), buff, offset, isSwap); } else if (buff.GetValue(0) is ulong) { TypeArrayConverter.FillBufferUnitsFrom <ulong>(Convert.ToUInt64(value), buff, offset, isSwap); } else if (buff.GetValue(0) is ushort) { TypeArrayConverter.FillBufferUnitsFrom <ushort>(Convert.ToUInt16(value), buff, offset, isSwap); } else if (buff.GetValue(0) is float) { TypeArrayConverter.FillBufferUnitsFrom <float>(Convert.ToSingle(value), buff, offset, isSwap); } else if (buff.GetValue(0) is double) { TypeArrayConverter.FillBufferUnitsFrom <double>(Convert.ToDouble(value), buff, offset, isSwap); } else { TypeArrayConverter.FillBufferUnitsFrom <int>(Convert.ToInt32(value), buff, offset, isSwap); } } }