public Parameter(APEIPC instance, string param) { Message *PtrMessage = instance.GetPointerToNextMessage(); if (param != null) { int length = param.Length * 2; //UTF16 charcter: For a 4 byte surrogate pair, length actually returns 2 somewhat confusingly although its convenient for us here, so we can just use length * 2 CheckSize(instance, length); fixed(void *PtrString = param) { NM.CopyMemory(instance.m_IntPtrMemoryMappedFileViewStringStore + instance.m_StringStoreOffset, (IntPtr)PtrString, (UIntPtr)(length)); } PtrMessage->Parameter.StringOffset[PtrMessage->NumberOfParameters] = instance.m_StringStoreOffset; PtrMessage->Parameter.StringLength[PtrMessage->NumberOfParameters] = param.Length; instance.m_StringStoreOffset = instance.m_StringStoreOffset + (param.Length * 2); } else { PtrMessage->Parameter.StringOffset[PtrMessage->NumberOfParameters] = -1; PtrMessage->Parameter.StringLength[PtrMessage->NumberOfParameters] = -1; } PtrMessage->Parameter.TypeCode[PtrMessage->NumberOfParameters] = (int)ApeTypeCode.String; PtrMessage->Parameter.ParameterType[PtrMessage->NumberOfParameters] = (int)ParameterType.In; PtrMessage->TypeCodeKey += ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + (int)ApeTypeCode.String) + ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + OneLargerThanApeTypeCodeEnumMax + (int)ParameterType.In); PtrMessage->NumberOfParameters++; }
public Parameter(APEIPC instance, UInt64 param, ParameterType apeParameterType) { Message *PtrMessage = instance.GetPointerToNextMessage(); PtrMessage->Parameter.UInt64[PtrMessage->NumberOfParameters] = param; PtrMessage->Parameter.TypeCode[PtrMessage->NumberOfParameters] = (int)ApeTypeCode.UInt64; PtrMessage->Parameter.ParameterType[PtrMessage->NumberOfParameters] = (int)apeParameterType; PtrMessage->TypeCodeKey += ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + (int)ApeTypeCode.UInt64) + ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + OneLargerThanApeTypeCodeEnumMax + (int)apeParameterType); PtrMessage->NumberOfParameters++; }
public Parameter(APEIPC instance, DataStores param) { Message *PtrMessage = instance.GetPointerToNextMessage(); PtrMessage->Parameter.Int32[PtrMessage->NumberOfParameters] = (Int32)param; PtrMessage->Parameter.TypeCode[PtrMessage->NumberOfParameters] = (int)ApeTypeCode.DataStore; PtrMessage->Parameter.ParameterType[PtrMessage->NumberOfParameters] = (int)ParameterType.In; PtrMessage->TypeCodeKey += ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + (int)ApeTypeCode.DataStore) + ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + OneLargerThanApeTypeCodeEnumMax + (int)ParameterType.In); PtrMessage->NumberOfParameters++; }
public Parameter(APEIPC instance, DataStores param, ParameterType apeParameterType) { if (apeParameterType == ParameterType.Out) { throw new Exception("Must specifiy the parameter type when using out datastore parameters"); } Message *PtrMessage = instance.GetPointerToNextMessage(); PtrMessage->Parameter.Int32[PtrMessage->NumberOfParameters] = (Int32)param; PtrMessage->Parameter.TypeCode[PtrMessage->NumberOfParameters] = (int)ApeTypeCode.DataStore; PtrMessage->Parameter.ParameterType[PtrMessage->NumberOfParameters] = (int)apeParameterType; PtrMessage->TypeCodeKey += ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + (int)ApeTypeCode.DataStore) + ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + OneLargerThanApeTypeCodeEnumMax + (int)apeParameterType); PtrMessage->NumberOfParameters++; }
public Parameter(APEIPC instance, Decimal param) { Message *PtrMessage = instance.GetPointerToNextMessage(); int[] DecimalBits = decimal.GetBits(param); PtrMessage->Parameter.DecimalBits0[PtrMessage->NumberOfParameters] = DecimalBits[0]; PtrMessage->Parameter.DecimalBits1[PtrMessage->NumberOfParameters] = DecimalBits[1]; PtrMessage->Parameter.DecimalBits2[PtrMessage->NumberOfParameters] = DecimalBits[2]; PtrMessage->Parameter.DecimalBits3[PtrMessage->NumberOfParameters] = DecimalBits[3]; PtrMessage->Parameter.TypeCode[PtrMessage->NumberOfParameters] = (int)ApeTypeCode.Decimal; PtrMessage->Parameter.ParameterType[PtrMessage->NumberOfParameters] = (int)ParameterType.In; PtrMessage->TypeCodeKey += ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + (int)ApeTypeCode.Decimal) + ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + OneLargerThanApeTypeCodeEnumMax + (int)ParameterType.In); PtrMessage->NumberOfParameters++; }
public Parameter(APEIPC instance, Image param) { Message *PtrMessage = instance.GetPointerToNextMessage(); if (param != null) { //Convert to byte array MemoryStream ms = new MemoryStream(); ImageFormat theImageFormat = param.RawFormat; if (theImageFormat.Guid == ImageFormat.MemoryBmp.Guid) //MemoryBmp don't seem to be able to be saved { theImageFormat = ImageFormat.Bmp; } param.Save(ms, theImageFormat); byte[] imageAsByteArray = ms.ToArray(); int length = imageAsByteArray.Length; CheckSize(instance, length); fixed(void *PtrByteArray = imageAsByteArray) { NM.CopyMemory(instance.m_IntPtrMemoryMappedFileViewStringStore + instance.m_StringStoreOffset, (IntPtr)PtrByteArray, (UIntPtr)(length)); } PtrMessage->Parameter.StringOffset[PtrMessage->NumberOfParameters] = instance.m_StringStoreOffset; PtrMessage->Parameter.StringLength[PtrMessage->NumberOfParameters] = imageAsByteArray.Length; instance.m_StringStoreOffset = instance.m_StringStoreOffset + imageAsByteArray.Length; } else { PtrMessage->Parameter.StringOffset[PtrMessage->NumberOfParameters] = -1; PtrMessage->Parameter.StringLength[PtrMessage->NumberOfParameters] = -1; } PtrMessage->Parameter.TypeCode[PtrMessage->NumberOfParameters] = (int)ApeTypeCode.Image; PtrMessage->Parameter.ParameterType[PtrMessage->NumberOfParameters] = (int)ParameterType.In; PtrMessage->TypeCodeKey += ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + (int)ApeTypeCode.Image) + ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + OneLargerThanApeTypeCodeEnumMax + (int)ParameterType.In); PtrMessage->NumberOfParameters++; }
public Parameter(APEIPC instance, DataStores param, ParameterType apeParameterType, string parameterType) { Message *PtrMessage = instance.GetPointerToNextMessage(); PtrMessage->Parameter.Int32[PtrMessage->NumberOfParameters] = (Int32)param; PtrMessage->Parameter.TypeCode[PtrMessage->NumberOfParameters] = (int)ApeTypeCode.DataStore; PtrMessage->Parameter.ParameterType[PtrMessage->NumberOfParameters] = (int)apeParameterType; PtrMessage->TypeCodeKey += ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + (int)ApeTypeCode.DataStore) + ((PtrMessage->NumberOfParameters * OneLargerThanApeTypeCodeEnumMax * 2) + OneLargerThanApeTypeCodeEnumMax + (int)apeParameterType); if (apeParameterType == ParameterType.Out) { fixed(void *PtrString = parameterType) { NM.CopyMemory(instance.m_IntPtrMemoryMappedFileViewStringStore + instance.m_StringStoreOffset, (IntPtr)PtrString, (UIntPtr)(parameterType.Length * 2)); //UTF16 charcter: For a 4 byte surrogate pair, length actually returns 2 somewhat confusingly although its convenient for us here, so we can just use length * 2 } PtrMessage->Parameter.StringOffset[PtrMessage->NumberOfParameters] = instance.m_StringStoreOffset; PtrMessage->Parameter.StringLength[PtrMessage->NumberOfParameters] = parameterType.Length; instance.m_StringStoreOffset = instance.m_StringStoreOffset + (parameterType.Length * 2); } PtrMessage->NumberOfParameters++; }
public Parameter(APEIPC instance, stdole.Picture param) { Image pictureAsImage = instance.OlePictureToImage(param); Parameter paramImage = new Parameter(instance, pictureAsImage); }