Click here to Skip to main content
15,896,439 members
Articles / Programming Languages / C#

WS-Enumeration for WCF/WF

Rate me:
Please Sign up or sign in to vote.
4.86/5 (5 votes)
4 Feb 2011CPOL5 min read 25.9K   220   10  
In this article, I describe the design and implementation of a WS-Enumeration for WCF.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ws = WSEnumeration;
using fs = WSEnumeration.Descriptors.FileSystem;


namespace TestApp
{
    public class DataDisplayObject
    {
        fs.FileInfoDescriptor _inner;

        public System.Drawing.Image IsFile { get { return _inner.Type == fs.ItemType.File ? Properties.Resources.blank.ToBitmap() : Properties.Resources.folder.ToBitmap(); } }
        public string Name { get { return _inner.Name; } }
        public string Size 
        { 
            get 
            {
                double k, m;
                string size = String.Empty;

                if(_inner.Size > 0 && _inner.Size < 1024)
                    size = _inner.Size.ToString() + " bytes";
                else if (_inner.Size >= 1024)
                {
                    k = _inner.Size / 1024f;

                    if (k > 1024)
                    {
                        m = k / 1024f;
                        size = Convert.ToInt32(m).ToString() + " MB";
                    }
                    else
                    {
                        size = Convert.ToInt32(k).ToString() + " KB";
                    }
                }

                return size; 
            } 
        }
        public string Extension { get { return _inner.Extension; } }
        public DateTime LastWriteTime { get { return _inner.LastWriteTime; } }

        public DataDisplayObject(fs.FileInfoDescriptor aDescriptor)
        {
            _inner = aDescriptor;
        }
        public fs.FileInfoDescriptor Inner { get { return _inner; } }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Russian Federation Russian Federation
I have Master degree in Particle Physics. During my last several years I work as software developer.

Primary Interests
- c#, c++, php, java.
- scientific programming

Comments and Discussions