Terraria 1.3.5.3 Source Code
This commit is contained in:
commit
4b21dac4b6
503 changed files with 409032 additions and 0 deletions
32
Chat/ChatCommandId.cs
Normal file
32
Chat/ChatCommandId.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Chat.ChatCommandId
|
||||
// Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 68659D26-2BE6-448F-8663-74FA559E6F08
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using ReLogic.Utilities;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Terraria.Chat.Commands;
|
||||
|
||||
namespace Terraria.Chat
|
||||
{
|
||||
public struct ChatCommandId
|
||||
{
|
||||
private readonly string _name;
|
||||
|
||||
private ChatCommandId(string name) => this._name = name;
|
||||
|
||||
public static ChatCommandId FromType<T>() where T : IChatCommand
|
||||
{
|
||||
ChatCommandAttribute cacheableAttribute = AttributeUtilities.GetCacheableAttribute<T, ChatCommandAttribute>();
|
||||
return cacheableAttribute != null ? new ChatCommandId(cacheableAttribute.Name) : new ChatCommandId((string) null);
|
||||
}
|
||||
|
||||
public void Serialize(BinaryWriter writer) => writer.Write(this._name ?? "");
|
||||
|
||||
public static ChatCommandId Deserialize(BinaryReader reader) => new ChatCommandId(reader.ReadString());
|
||||
|
||||
public int GetMaxSerializedSize() => 4 + Encoding.UTF8.GetByteCount(this._name ?? "");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue