Exemplo n.º 1
0
        public override object Execute(IReadOnlyList <object> args)
        {
            var text      = ArgUtil.GetStrArg(args[0], "text", Name);
            var separator = ArgUtil.GetStrArg(args[1], "separator", Name);

            if (separator.Length == 0)
            {
                throw new Exception($"{Name.ToUpper()}: The argument \"separator\" must not be an empty string.");
            }
            var splitted = text.Split(new[] { separator }, StringSplitOptions.None);

            return(ArrayUtil.ConvertToSqlArray(splitted));
        }
Exemplo n.º 2
0
        private void UpdateConsoleState()
        {
            var list = _manager.Notebook.UserData.ConsoleStates;

            list.RemoveWhere(x => x.ConsoleName == ConsoleName);
            var data    = ArrayUtil.ConvertToSqlArray(_variables.Values.ToList());
            var dataB64 = Convert.ToBase64String(data);

            list.Add(new ConsoleStateRecord {
                ConsoleName = ConsoleName,
                VarNames    = _variables.Keys.ToList(),
                VarDataB64  = dataB64
            });
        }
Exemplo n.º 3
0
        public override object Execute(IReadOnlyList <object> args)
        {
            if (args.Count < 2)
            {
                throw new Exception($"{Name.ToUpper()}: At least 2 arguments are required.");
            }
            var values = new List <object>();

            for (int i = 0; i < args.Count; i++)
            {
                var blob       = ArgUtil.GetBlobArg(args[i], $"array #{i+1}", Name);
                var blobValues = ArrayUtil.GetArrayElements(blob);
                values.AddRange(blobValues);
            }
            return(ArrayUtil.ConvertToSqlArray(values));
        }
Exemplo n.º 4
0
        public override object Execute(IReadOnlyList <object> args)
        {
            var text           = ArgUtil.GetStrArg(args[0], "text", Name);
            var separator      = ArgUtil.GetStrArg(args[1], "separator", Name);
            var whichSubstring = ArgUtil.GetInt32Arg(args[2], "which-substring", Name);

            if (separator.Length == 0)
            {
                throw new Exception($"{Name.ToUpper()}: The argument \"separator\" must not be an empty string.");
            }
            if (whichSubstring < 0)
            {
                throw new Exception($"{Name.ToUpper()}: The argument \"which-substring\" must not be negative.");
            }
            var splitted = text.Split(new[] { separator }, StringSplitOptions.None);

            return(whichSubstring < splitted.Length ? ArrayUtil.ConvertToSqlArray(splitted) : null);
        }
Exemplo n.º 5
0
 public override object Execute(IReadOnlyList <object> args) => ArrayUtil.ConvertToSqlArray(args);