Facepunch.Steamworks/Generator/SteamApiDefinition.cs

150 lines
4.2 KiB
C#
Raw Normal View History

2016-10-18 18:34:28 +03:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Generator
{
public class SteamApiDefinition
{
2020-02-22 23:16:04 +03:00
public class Interface
2016-10-18 18:34:28 +03:00
{
2020-02-22 23:16:04 +03:00
[JsonProperty( PropertyName = "classname" )]
2016-10-18 18:34:28 +03:00
public string Name { get; set; }
2020-02-22 23:16:04 +03:00
[JsonProperty( PropertyName = "version_string" )]
public string VersionString { get; set; }
public class Method
{
public string Desc { get; set; }
public string ReturnType { get; set; }
public string CallResult { get; set; }
public class Param
{
public string ParamType { get; set; }
public string ParamName { get; set; }
}
public Param[] Params { get; set; }
[JsonProperty( PropertyName = "methodname" )]
public string Name { get; set; }
[JsonProperty( PropertyName = "methodname_flat" )]
public string FlatName { get; set; }
}
public Method[] Methods { get; set; }
public class Accessor
{
public string Kind { get; set; }
public string Name { get; set; }
public string Name_Flat { get; set; }
}
public Accessor[] Accessors { get; set; }
2016-10-18 18:34:28 +03:00
}
2020-02-22 23:16:04 +03:00
public Interface[] Interfaces { get; set; }
2016-10-18 18:34:28 +03:00
public class EnumDef
{
public class EnumValue
{
[JsonProperty( PropertyName = "name" )]
public string Name { get; set; }
[JsonProperty( PropertyName = "value" )]
public string Value { get; set; }
}
[JsonProperty( PropertyName = "enumname" )]
public string Name { get; set; }
[JsonProperty( PropertyName = "values" )]
public EnumValue[] Values { get; set; }
}
public EnumDef[] enums { get; set; }
2020-02-22 23:16:04 +03:00
public class TypeDef
{
[JsonProperty( PropertyName = "typedef" )]
public string Name { get; set; }
[JsonProperty( PropertyName = "type" )]
public string Type { get; set; }
}
public List<TypeDef> typedefs { get; set; }
2016-10-18 18:34:28 +03:00
public class StructDef
{
public class StructFields
{
[JsonProperty( PropertyName = "fieldname" )]
public string Name { get; set; }
[JsonProperty( PropertyName = "fieldtype" )]
public string Type { get; set; }
}
[JsonProperty( PropertyName = "struct" )]
public string Name { get; set; }
[JsonProperty( PropertyName = "fields" )]
public StructFields[] Fields { get; set; }
2016-10-29 22:28:16 +03:00
2020-02-22 23:16:04 +03:00
public bool IsPack4OnWindows
{
get
{
// 4/8 packing is irrevant to these classes
if ( Name.Contains( "MatchMakingKeyValuePair_t" ) ) return true;
2020-02-22 23:16:04 +03:00
if ( Fields.Any( x => x.Type.Contains( "CSteamID" ) ) )
return true;
2020-02-23 00:13:47 +03:00
if ( Fields.Any( x => x.Type.Contains( "CGameID" ) ) )
return true;
2020-02-22 23:16:04 +03:00
return false;
}
}
2020-02-22 23:16:04 +03:00
public EnumDef[] Enums { get; set; }
2016-10-18 18:34:28 +03:00
}
2016-10-30 23:52:42 +03:00
public List<StructDef> structs { get; set; }
2016-10-18 18:34:28 +03:00
2020-02-22 23:16:04 +03:00
public class CallbackStructDef : StructDef
2016-10-18 18:34:28 +03:00
{
2020-02-22 23:16:04 +03:00
[JsonProperty( PropertyName = "callback_id" )]
public int CallbackId { get; set; }
}
2016-10-18 18:34:28 +03:00
2020-02-22 23:16:04 +03:00
public List<CallbackStructDef> callback_structs { get; set; }
public class Const
{
[JsonProperty( PropertyName = "consttype" )]
public string Type { get; set; }
[JsonProperty( PropertyName = "constname" )]
2016-10-18 18:34:28 +03:00
public string Name { get; set; }
2016-10-25 12:29:35 +03:00
2016-10-31 14:46:53 +03:00
2020-02-22 23:16:04 +03:00
[JsonProperty( PropertyName = "constval" )]
public string Val { get; set; }
2016-10-18 18:34:28 +03:00
}
2020-02-22 23:16:04 +03:00
public List<Const> Consts { get; set; }
}
2016-10-29 22:28:16 +03:00
2016-10-18 18:34:28 +03:00
}