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