Exemplo n.º 1
0
        public IOutputInfo OnWrite()
        {
            List <IEnumerable <string> > result = new List <IEnumerable <string> >();

            result.Add(new string[] { nameof(Count), nameof(Sum), nameof(Max), nameof(Min) });
            result.Add(new string[] { Count.ToString(), Sum?.ToString(), Max?.ToString(), Min?.ToString() });
            List <IOutputBody> body = OutputInfo.CreateBodies(result);

            body.Insert(1, OutputInfo.CreateColumnLineSeperator());
            return(OutputInfo.Create(null, body, ""));
        }
Exemplo n.º 2
0
        public IOutputInfo OnWrite()
        {
            List <IEnumerable <string> > bodyContents = new List <IEnumerable <string> >();

            bodyContents.Add(new string[] { "Name", "Type", "Length", "Last Modified" });
            if (Item is DirectoryInfo dirInfo)
            {
                bodyContents.Add(new string[] { dirInfo.Name, "Directory", "", dirInfo.LastWriteTime.ToString("yyyy/MM/dd hh:mm:ss") });
            }
            else if (Item is FileInfo fileInfo)
            {
                bodyContents.Add(new string[] { fileInfo.Name, "File", fileInfo.Length.ToString(), fileInfo.LastWriteTime.ToString("yyyy/MM/dd hh:mm:ss") });
            }
            List <IOutputBody> bodies = OutputInfo.CreateBodies(bodyContents);

            bodies.Insert(1, OutputInfo.CreateColumnLineSeperator());
            return(OutputInfo.Create(null, bodies, ""));
        }
Exemplo n.º 3
0
        public IOutputInfo OnWrite()
        {
            List <IEnumerable <string> > contents = new List <IEnumerable <string> >();

            if (Objects.Count > 0)
            {
                string[] properties = Objects[0].Properties.Select(p => p.Name).ToArray();
                contents.Add(properties);
                string[] values;
                foreach (ObjectPropertySet obj in Objects)
                {
                    values = obj.Properties.Select(p => p.Value?.ToString()).ToArray();
                    contents.Add(values);
                }
            }
            List <IOutputBody> bodies = OutputInfo.CreateBodies(contents);

            if (bodies.Count > 0)
            {
                bodies.Insert(1, OutputInfo.CreateColumnLineSeperator());
            }
            return(OutputInfo.Create(null, bodies, ""));
        }