Facepunch.Steamworks/Generator/Cleanup.cs

129 lines
5.5 KiB
C#
Raw Normal View History

2019-04-16 13:45:44 +03:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
public static class Cleanup
2019-04-27 16:25:54 +03:00
{
2019-04-16 13:45:44 +03:00
public static string ConvertType( string type )
{
2020-02-10 22:21:52 +03:00
type = type.Replace( "class ", "" );
type = type.Replace( "struct ", "" );
2020-02-12 18:27:30 +03:00
type = type.Replace( "unsigned long long", "uint64" );
2019-04-16 13:45:44 +03:00
type = type.Replace( "CSteamID", "SteamId" );
type = type.Replace( "CGameID", "GameId" );
2019-04-16 14:17:24 +03:00
type = type.Replace( "PersonaState", "FriendState" );
type = type.Replace( "AudioPlayback_Status", "MusicStatus" );
type = type.Replace( "AuthSessionResponse", "AuthResponse" );
type = type.Replace( "FriendRelationship", "Relationship" );
type = type.Replace( "BeginAuthSessionResult", "BeginAuthResult" );
2019-04-16 18:37:49 +03:00
type = type.Replace( "PublishedFileId_t", "PublishedFileId" );
2019-04-17 10:40:58 +03:00
type = type.Replace( "PublishedFileId_t", "PublishedFileId" );
2019-04-26 16:29:36 +03:00
type = type.Replace( "AppId_t", "AppId" );
2019-04-17 10:40:58 +03:00
type = type.Replace( "LeaderboardSortMethod", "LeaderboardSort" );
type = type.Replace( "LeaderboardDisplayType", "LeaderboardDisplay" );
2019-04-26 15:46:12 +03:00
type = type.Replace( "UGCMatchingUGCType", "UgcType" );
2019-04-29 12:41:40 +03:00
type = type.Replace( "SteamItemInstanceID_t", "InventoryItemId" );
type = type.Replace( "SteamItemDef_t", "InventoryDefId" );
type = type.Replace( "ChatRoomEnterResponse", "RoomEnter" );
2019-05-02 17:23:47 +03:00
type = type.Replace( "SteamNetworkPingLocation_t", "PingLocation" );
2020-02-12 19:17:44 +03:00
//type = type.Replace( "SteamNetworkingConfigValue", "NetConfig" );
//type = type.Replace( "SteamNetworkingConfigScope", "NetScope" );
//type = type.Replace( "SteamNetworkingConfigDataType", "NetConfigType" );
2019-05-06 15:34:41 +03:00
type = type.Replace( "HSteamNetConnection", "Connection" );
2019-05-02 22:41:45 +03:00
type = type.Replace( "HSteamListenSocket", "Socket" );
2019-05-06 15:34:41 +03:00
type = type.Replace( "SteamNetworkingIPAddr", "NetAddress" );
type = type.Replace( "SteamNetworkingIdentity", "NetIdentity" );
2019-05-02 23:40:39 +03:00
type = type.Replace( "SteamNetConnectionInfo_t", "ConnectionInfo" );
type = type.Replace( "SteamNetworkingConnectionState", "ConnectionState" );
2019-05-06 15:26:37 +03:00
type = type.Replace( "SteamNetworkingMicroseconds", "long" );
2019-05-06 15:38:37 +03:00
type = type.Replace( "SteamNetworkingSocketsDebugOutputType", "DebugOutputType" );
type = type.Replace( "SteamNetworkingGetConfigValueResult", "NetConfigResult" );
2019-06-19 18:18:12 +03:00
type = type.Replace( "SteamInputType", "InputType" );
2019-06-20 12:41:57 +03:00
type = type.Replace( "InputDigitalActionData_t", "DigitalState" );
type = type.Replace( "InputAnalogActionData_t", "AnalogState" );
type = type.Replace( "InputMotionData_t", "MotionState" );
2019-07-02 14:08:02 +03:00
type = type.Replace( "MatchMakingKeyValuePair_t", "MatchMakingKeyValuePair" );
2020-02-12 19:17:44 +03:00
type = type.Replace( "ISteamNetworkingMessage", "NetMsg" );
type = type.Replace( "SteamNetworkingMessage_t", "NetMsg" );
type = type.Replace( "RequestPlayersForGameResultCallback_t_PlayerAcceptState_t", "PlayerAcceptState_t" );
2019-04-16 13:45:44 +03:00
return type;
}
public static bool ShouldCreate( string type )
{
if ( type == "SteamId" ) return false;
2019-04-17 10:40:58 +03:00
if ( type == "LeaderboardSort" ) return false;
if ( type == "LeaderboardDisplay" ) return false;
2019-04-26 16:29:36 +03:00
if ( type == "AppId" ) return false;
2019-06-20 12:41:57 +03:00
if ( type == "AnalogState" ) return false;
if ( type == "DigitalState" ) return false;
if ( type == "MotionState" ) return false;
2019-07-02 14:08:02 +03:00
if ( type == "MatchMakingKeyValuePair" ) return false;
2020-02-12 18:27:30 +03:00
if ( type == "Connection" ) return false;
if ( type == "Socket" ) return false;
if ( type == "SteamNetworkingErrMsg" ) return false;
if ( type == "SteamNetworkingMicroseconds" ) return false;
if ( type == "FSteamNetworkingSocketsDebugOutput" ) return false;
2020-02-12 19:17:44 +03:00
if ( type == "NetMsg" ) return false;
2020-02-12 18:27:30 +03:00
if ( type == "SteamDatagramErrMsg" ) return false;
2020-02-12 18:51:39 +03:00
if ( type == "ConnectionInfo" ) return false;
if ( type == "SteamNetworkingIPAddr" ) return false;
2020-02-12 19:17:44 +03:00
if ( type == "NetAddress" ) return false;
2020-02-12 19:00:26 +03:00
if ( type == "NetIdentity" ) return false;
if ( type == "SteamNetworkingQuickConnectionStatus" ) return false;
2019-04-16 13:45:44 +03:00
return true;
}
2019-04-16 14:17:24 +03:00
internal static string Expose( string name )
{
if ( name == "FriendState" ) return "public";
if (name == "FriendFlags") return "public";
2019-04-16 14:17:24 +03:00
if ( name == "MusicStatus" ) return "public";
if ( name == "ParentalFeature" ) return "public";
if ( name == "AuthResponse" ) return "public";
if ( name == "Relationship" ) return "public";
if ( name == "BeginAuthResult" ) return "public";
if ( name == "Universe" ) return "public";
if ( name == "NotificationPosition" ) return "public";
if ( name == "GamepadTextInputMode" ) return "public";
if ( name == "GamepadTextInputLineMode" ) return "public";
if ( name == "CheckFileSignature" ) return "public";
if ( name == "BroadcastUploadResult" ) return "public";
2019-04-16 18:37:49 +03:00
if ( name == "PublishedFileId" ) return "public";
if ( name == "Result" ) return "public";
2019-04-26 15:46:12 +03:00
if ( name == "UgcType" ) return "public";
2019-04-29 12:41:40 +03:00
if ( name == "InventoryItemId" ) return "public";
if ( name == "InventoryDefId" ) return "public";
2019-05-01 00:45:37 +03:00
if ( name == "P2PSend" ) return "public";
if ( name == "RoomEnter" ) return "public";
if ( name == "P2PSessionError" ) return "public";
2019-06-19 18:18:12 +03:00
if ( name == "InputType" ) return "public";
2019-06-20 12:41:57 +03:00
if ( name == "InputSourceMode" ) return "public";
2019-12-04 14:15:58 +03:00
if ( name == "UserHasLicenseForAppResult" ) return "public";
2019-04-16 14:17:24 +03:00
return "internal";
}
2019-04-27 16:25:54 +03:00
internal static bool IsDeprecated( string name )
{
if ( name.StartsWith( "ISteamRemoteStorage." ) )
{
if ( name.Contains( "Publish" ) ) return true;
if ( name.Contains( "ResetFileRequestState" ) ) return true;
if ( name.Contains( "EnumerateUserSubscribedFiles" ) ) return true;
if ( name.Contains( "EnumerateUserSharedWorkshopFile" ) ) return true;
}
return false;
}
2019-04-16 13:45:44 +03:00
}