Facepunch.Steamworks/Generator/SteamApiDefinition.cs

136 lines
3.8 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-12 17:55:36 +03:00
public class Interface
2016-10-18 18:34:28 +03:00
{
2020-02-12 17:55:36 +03:00
[JsonProperty( PropertyName = "classname" )]
2016-10-18 18:34:28 +03:00
public string Name { get; set; }
2020-02-12 17:55:36 +03:00
[JsonProperty( PropertyName = "version_string" )]
public string VersionString { get; set; }
public class Method
{
public string ReturnType { get; set; }
2020-02-12 18:27:30 +03:00
public string CallResult { get; set; }
2020-02-12 17:55:36 +03:00
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 = "flat_name" )]
public string FlatName { get; set; }
}
public Method[] Methods { get; set; }
2016-10-18 18:34:28 +03:00
}
2020-02-12 17:55:36 +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-12 17:55:36 +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-12 17:55:36 +03:00
public bool IsPack4OnWindows
{
get
{
// 4/8 packing is irrevant to these classes
if ( Name.Contains( "MatchMakingKeyValuePair_t" ) ) return true;
2020-02-12 17:55:36 +03:00
if ( Fields.Any( x => x.Type.Contains( "CSteamID" ) ) )
return true;
2020-02-12 17:55:36 +03:00
return false;
}
}
2020-02-19 12:00:23 +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-12 17:55:36 +03:00
public class CallbackStructDef : StructDef
2016-10-18 18:34:28 +03:00
{
2020-02-12 17:55:36 +03:00
[JsonProperty( PropertyName = "callback_id" )]
public int CallbackId { get; set; }
2016-10-18 18:34:28 +03:00
}
2020-02-12 17:55:36 +03:00
public List<CallbackStructDef> callback_structs { get; set; }
2020-02-13 13:54:31 +03:00
public class Const
{
[JsonProperty( PropertyName = "consttype" )]
public string Type { get; set; }
[JsonProperty( PropertyName = "constname" )]
public string Name { get; set; }
[JsonProperty( PropertyName = "constval" )]
public string Val { get; set; }
}
public List<Const> Consts { get; set; }
2016-10-18 18:34:28 +03:00
}
2020-02-13 13:54:31 +03:00
2016-10-18 18:34:28 +03:00
}