Simplify GetBytesFromObject
This commit is contained in:
@ -46,7 +46,7 @@ namespace RageCoop.Client
|
|||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Main()
|
public Main()
|
||||||
{Game.Player.Character.Task.LeaveVehicle()
|
{
|
||||||
Worker = new Worker("RageCoop.Client.Main.Worker", Logger);
|
Worker = new Worker("RageCoop.Client.Main.Worker", Logger);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ using System.Resources;
|
|||||||
|
|
||||||
|
|
||||||
// Version informationr(
|
// Version informationr(
|
||||||
[assembly: AssemblyVersion("1.5.3.146")]
|
[assembly: AssemblyVersion("1.5.3.147")]
|
||||||
[assembly: AssemblyFileVersion("1.5.3.146")]
|
[assembly: AssemblyFileVersion("1.5.3.147")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
||||||
|
|
||||||
|
@ -38,34 +38,36 @@ namespace RageCoop.Core
|
|||||||
{
|
{
|
||||||
switch (obj)
|
switch (obj)
|
||||||
{
|
{
|
||||||
case byte _:
|
case byte value:
|
||||||
return (0x01, new byte[] { (byte)obj });
|
return (0x01, new byte[] { value });
|
||||||
case short _:
|
case short value:
|
||||||
return (0x02, BitConverter.GetBytes((short)obj));
|
return (0x02, BitConverter.GetBytes(value));
|
||||||
case ushort _:
|
case ushort value:
|
||||||
return (0x03, BitConverter.GetBytes((ushort)obj));
|
return (0x03, BitConverter.GetBytes(value));
|
||||||
case int _:
|
case int value:
|
||||||
return (0x04, BitConverter.GetBytes((int)obj));
|
return (0x04, BitConverter.GetBytes(value));
|
||||||
case uint _:
|
case uint value:
|
||||||
return (0x05, BitConverter.GetBytes((uint)obj));
|
return (0x05, BitConverter.GetBytes(value));
|
||||||
case long _:
|
case long value:
|
||||||
return (0x06, BitConverter.GetBytes((long)obj));
|
return (0x06, BitConverter.GetBytes(value));
|
||||||
case ulong _:
|
case ulong value:
|
||||||
return (0x07, BitConverter.GetBytes((ulong)obj));
|
return (0x07, BitConverter.GetBytes(value));
|
||||||
case float _:
|
case float value:
|
||||||
return (0x08, BitConverter.GetBytes((float)obj));
|
return (0x08, BitConverter.GetBytes(value));
|
||||||
case bool _:
|
case bool value:
|
||||||
return (0x09, BitConverter.GetBytes((bool)obj));
|
return (0x09, BitConverter.GetBytes(value));
|
||||||
case string _:
|
case string value:
|
||||||
return (0x10, ((string)obj).GetBytesWithLength());
|
return (0x10, value.GetBytesWithLength());
|
||||||
case Vector3 _:
|
case Vector3 value:
|
||||||
return (0x11,((Vector3)obj).GetBytes());
|
return (0x11, value.GetBytes());
|
||||||
case Quaternion _:
|
case Quaternion value:
|
||||||
return (0x12, ((Quaternion)obj).GetBytes());
|
return (0x12, value.GetBytes());
|
||||||
case GTA.Model _:
|
case GTA.Model value:
|
||||||
return (0x13, BitConverter.GetBytes((GTA.Model)obj));
|
return (0x13, BitConverter.GetBytes(value));
|
||||||
case Vector2 _:
|
case Vector2 value:
|
||||||
return (0x14, ((Vector2)obj).GetBytes());
|
return (0x14, value.GetBytes());
|
||||||
|
case byte[] value:
|
||||||
|
return (0x15, value);
|
||||||
case Tuple<byte, byte[]> _:
|
case Tuple<byte, byte[]> _:
|
||||||
var tup = (Tuple<byte, byte[]>)obj;
|
var tup = (Tuple<byte, byte[]>)obj;
|
||||||
return (tup.Item1, tup.Item2);
|
return (tup.Item1, tup.Item2);
|
||||||
|
@ -15,7 +15,7 @@ using System.Resources;
|
|||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// Version information
|
// Version information
|
||||||
[assembly: AssemblyVersion("1.5.3.126")]
|
[assembly: AssemblyVersion("1.5.3.128")]
|
||||||
[assembly: AssemblyFileVersion("1.5.3.126")]
|
[assembly: AssemblyFileVersion("1.5.3.128")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user