コード例 #1
0
ファイル: Suffixed.cs プロジェクト: minorDeveloper/KOS
        public override void Execute(SharedObjects shared)
        {
            var amount       = PopValueAssert(shared);
            var transferTo   = PopValueAssert(shared);
            var transferFrom = PopValueAssert(shared);
            var resourceName = PopValueAssert(shared).ToString();

            AssertArgBottomAndConsume(shared);

            var resourceInfo = TransferManager.ParseResource(resourceName);

            if (resourceInfo == null)
            {
                throw new KOSInvalidArgumentException("TransferAll", "Resource",
                                                      resourceName + " was not found in the resource list");
            }

            double parsedAmount;

            if (Double.TryParse(amount.ToString(), out parsedAmount))
            {
                object toPush = shared.TransferManager.CreateTransfer(resourceInfo, transferTo, transferFrom, parsedAmount);
                ReturnValue = toPush;
            }
        }