⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 avatar.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web;
using System.IO;

namespace CommunityServer.Components {

    public class Avatar {
        int length = 0;
        int imageID = 0;
        int userID = 0;
        DateTime created;
        string contentType;
		string fileName = "";
		byte[] content = {byte.MinValue}; // 修改默认属性

        public Avatar() 
		{
        }

        public Avatar (Stream stream) {
            length = (int) stream.Length;
            content = new Byte[length];

            stream.Position = 0;
            stream.Read(content, 0, length);
        }

        public Avatar (HttpPostedFile postedFile) {

            // Get the file length and content type
            //
            length = postedFile.ContentLength;
            contentType = postedFile.ContentType;

            // Get the filename
            //
            fileName = postedFile.FileName.Substring(postedFile.FileName.LastIndexOf("\\") + 1);

            // Setup the byte array
            //
            content = new Byte[length];

            // Read in the attachment into a byte array
            //
            postedFile.InputStream.Read(content, 0, length);

        }

        public int ImageID {
            get {
                return imageID;
            }
            set {
                imageID = value;
            }
        }

        public int Length {
            get {
                return length;
            }
            set {
                length = value;
            }
        }

        public string ContentType {
            get {
                return contentType;
            }
            set {
                contentType = value;
            }
        }

        public string FileName {
            get {
                return fileName;
            }
            set {
                fileName = value;
            }

        }

        public Byte[] Content {
            get {
                return content;
            }
            set {
                content = value;
            }
        }

        public int UserID {
            get { return userID; }
            set { userID = value; }
        }

        public DateTime DateCreated {
            get {
                return created;
            }
            set {
                created = value;
            }
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -