public static void setPurchase(Purchase purchase) { int productCount = null == purchase.getProductList() ? 0 : purchase.getProductList().Count; PurchaseIos purchaseIos = new PurchaseIos(purchase); if (productCount > 0) { ProductIos[] productList = new ProductIos[productCount]; string[] optAmtKeys; double[] optAmtValues; for (int i = 0; i < productCount; i++) { productList[i] = new ProductIos((purchase.getProductList())[i]); optAmtKeys = new string[(purchase.getProductList())[i].optionalAmount.Count]; optAmtValues = new double[(purchase.getProductList())[i].optionalAmount.Count]; for (int j = 0; j < (purchase.getProductList())[i].optionalAmount.Count; j++) { var pair = (purchase.getProductList())[i].optionalAmount.ElementAt(j); optAmtKeys[j] = pair.Key; optAmtValues[j] = pair.Value; } ProductIos productIos = new ProductIos((purchase.getProductList())[i]); MakeProductList(productIos, optAmtKeys, optAmtValues, optAmtKeys.Length); } } else if (productCount == 0) { ProductIos productIos = new ProductIos(purchase.getProduct()); string[] optAmtKeys = new string[purchase.getProduct().optionalAmount.Count]; double[] optAmtValues = new double[purchase.getProduct().optionalAmount.Count]; for (int j = 0; j < purchase.getProduct().optionalAmount.Count; j++) { var pair = purchase.getProduct().optionalAmount.ElementAt(j); optAmtKeys[j] = pair.Key; optAmtValues[j] = pair.Value; } MakeProduct(productIos, optAmtKeys, optAmtValues, optAmtKeys.Length); } CallSetPurchase(purchaseIos); }
extern static public void CallSetPurchase(PurchaseIos purchase);