您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

49 行
1.5 KiB

using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
namespace ChatComponents
{
public static class ChatRoomUtils
{
public static Status? getStatusFromString(string stringStatus) {
foreach( var status in Enum.GetValues(typeof(Status))) {
if (status.ToString() == stringStatus) {
return status is Status ? (Status) status : (Status?) null;
}
}
return null;
}
/// Converts [stringRole] to the [Role] enum.
public static Role? getRoleFromString(string stringRole) {
foreach( var role in Enum.GetValues(typeof(Role))) {
if (role.ToString() == stringRole) {
return role is Role ? (Role) role : (Role?) null;
}
}
return null;
}
/// Converts [stringRoomType] to the [RoomType] enum.
public static RoomType getRoomTypeFromString(string stringRoomType) {
foreach( var roomType in Enum.GetValues(typeof(RoomType))) {
if (roomType.ToString() == stringRoomType) {
return (RoomType) (roomType is RoomType ? (RoomType) roomType : (RoomType?) null);
}
}
return RoomType.unsupported;
}
public static string toShortString(object _object = null)
{
return _object.ToString().Split('.').last();
}
}
}