修改用户头像数据类型

This commit is contained in:
Mattuy Lee
2018-12-24 17:54:50 +08:00
parent f28ad69067
commit 612a5b8645
4 changed files with 80 additions and 85 deletions
@@ -4,7 +4,6 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Drawing;
using System.IO;
//StormClient对数据的处理相关内容
@@ -100,8 +99,7 @@ namespace Interact
};
if (int.Parse(head[AttrNames.Photo].ToString()) > 0)
{
MemoryStream ms = new MemoryStream(data);
user.Photo = Image.FromStream(ms);
user.Photo = new MemoryStream(data);
} //用户头像数据
OnLoginDone?.Invoke(resultHead, user);
}
@@ -171,8 +169,7 @@ namespace Interact
}; //基础数据
if (int.Parse(head[AttrNames.Photo].ToString()) > 0)
{
MemoryStream ms = new MemoryStream(data);
user.Photo = Image.FromStream(ms);
user.Photo = new MemoryStream(data);
} //头像数据
//加入临时用户列表缓存
User[] users;
+3 -5
View File
@@ -222,11 +222,9 @@ namespace Interact
//将头像数据转换到字符数组
if (userInfo.Photo != null)
{
MemoryStream memStream = new MemoryStream();
userInfo.Photo.Save(memStream, userInfo.Photo.RawFormat);
photoData = new byte[memStream.Length];
memStream.Seek(0, SeekOrigin.Begin);
memStream.Read(photoData, 0, photoData.Length);
photoData = new byte[userInfo.Photo.Length];
userInfo.Photo.Seek(0, SeekOrigin.Begin);
userInfo.Photo.Read(photoData, 0, photoData.Length);
}
//构建数据包
JsonUserInfoHead jsonObj = new JsonUserInfoHead()
+5 -5
View File
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.IO;
namespace Interact
{
@@ -33,14 +33,14 @@ namespace Interact
}
internal static User[] Users; //用户列表。仅Interact内部访问
public static User Me; //当前用户
public static Image DefaultPhoto; //默认头像
public static User Me; //当前用户
public static Stream DefaultPhoto; //默认头像
public string Name; //用户名
public string NickName; //昵称
public string Motto; //个性签名
public UserGroup Group; //用户组
public Image Photo; //头像
public Stream Photo; //头像
}
//更新用户信息时新的用户信息。如果项值为null则不更改相应的信息
@@ -49,7 +49,7 @@ namespace Interact
public string Password = null; //新密码
public string NickName = null; //新昵称
public string Motto = null; //新签名
public Image Photo = null; //新头像
public Stream Photo = null; //新头像
}
//用户类型