Ejemplo n.º 1
0
        protected override void ProcessRecord()
        {
            var extensions = client.Extensions.Search(MinExtension, MaxExtension, MinCreationDate, MaxCreationDate, 100000, 1, Type);

            if (Extension != null && Extension.Length > 0)
            {
                extensions = extensions.Where(e => Extension.Any(ex => ex == e.Extension)).ToList();
            }

            if (AccountID != null && AccountID.Length > 0)
            {
                extensions = extensions.Where(e => AccountID.Any(ex => ex == e.AccountId)).ToList();
            }

            if (Name != null)
            {
                WildcardPattern pattern = new WildcardPattern(Name, WildcardOptions.IgnoreCase);

                extensions = extensions.Where(e => pattern.IsMatch(e.DisplayName) || pattern.IsMatch(e.Extension)).ToList();
            }

            WriteObject(extensions, true);

            //todo -- remove item/count parameters for logs
            //todo -- implement count parameter with streaming implementation
        }