private StoreTransactionOperation[] GenerateStoreOpsList()
{
StoreTransactionOperation[] operationArray = new StoreTransactionOperation[this._list.Count];
for (int i = 0; i != this._list.Count; i++)
{
object structure = this._list[i];
Type type = structure.GetType();
operationArray[i].Data.DataPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(structure));
Marshal.StructureToPtr(structure, operationArray[i].Data.DataPtr, false);
if (type == typeof(StoreOperationSetCanonicalizationContext))
{
operationArray[i].Operation = StoreTransactionOperationType.SetCanonicalizationContext;
}
else if (type == typeof(StoreOperationStageComponent))
{
operationArray[i].Operation = StoreTransactionOperationType.StageComponent;
}
else if (type == typeof(StoreOperationPinDeployment))
{
operationArray[i].Operation = StoreTransactionOperationType.PinDeployment;
}
else if (type == typeof(StoreOperationUnpinDeployment))
{
operationArray[i].Operation = StoreTransactionOperationType.UnpinDeployment;
}
else if (type == typeof(StoreOperationStageComponentFile))
{
operationArray[i].Operation = StoreTransactionOperationType.StageComponentFile;
}
else if (type == typeof(StoreOperationInstallDeployment))
{
operationArray[i].Operation = StoreTransactionOperationType.InstallDeployment;
}
else if (type == typeof(StoreOperationUninstallDeployment))
{
operationArray[i].Operation = StoreTransactionOperationType.UninstallDeployment;
}
else if (type == typeof(StoreOperationSetDeploymentMetadata))
{
operationArray[i].Operation = StoreTransactionOperationType.SetDeploymentMetadata;
}
else
{
if (type != typeof(StoreOperationScavenge))
{
throw new Exception("How did you get here?");
}
operationArray[i].Operation = StoreTransactionOperationType.Scavenge;
}
}
return operationArray;
}