예제 #1
0
        protected override bool Parse(ArgumentsParser arguments)
        {
            keytype     = arguments.String(nameof(keytype), null);
            keypassword = arguments.String(nameof(keypassword), null);
            accountid   = arguments.Long(nameof(accountid), -1);
            chainid     = arguments.Integer(nameof(chainid), -1);
            keyindex    = arguments.Integer(nameof(keyindex), -1);

            return((keytype == "coreaccount" || keytype == "serviceaccount" || keytype == "chainkey") && WalletApp.IsValidPassword(keypassword));
        }
예제 #2
0
        protected override bool Parse(ArgumentsParser arguments)
        {
            targetaccount = arguments.Long(nameof(targetaccount), -1);
            reason        = arguments.String(nameof(reason), null);
            password      = arguments.String(nameof(password), null);

            var amountstr = arguments.String(nameof(amount), null);

            if (targetaccount < 0 || string.IsNullOrWhiteSpace(amountstr) || !WalletApp.IsValidPassword(password) || !AccountUpdateOperation.IsReasonValid(reason))
            {
                return(false);
            }

            var hasDot = false;

            foreach (var c in amountstr)
            {
                if (c == '.' && !hasDot)
                {
                    hasDot = true;
                    continue;
                }

                if (!(c >= '0' && c <= '9'))
                {
                    SetError("Amount invalid");
                    return(false);
                }
            }

            if (!decimal.TryParse(amountstr, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var d))
            {
                SetError("Amount invalid");
                return(false);
            }

            amount = Currency.ToHel(d);

            return(amount > 0);
        }
예제 #3
0
        protected override bool Parse(ArgumentsParser arguments)
        {
            if (!base.Parse(arguments))
            {
                return(false);
            }

            id   = arguments.Long(nameof(id), -1);
            file = arguments.String(nameof(file), null);

            if (string.IsNullOrEmpty(file) || id < 0)
            {
                return(false);
            }

            if (!File.Exists(file))
            {
                SetError($"File ({file}) not found");
                return(false);
            }

            return(true);
        }