Facepunch.Steamworks/Generator/Cleanup.cs

92 lines
3.6 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 )
{
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" );
2019-05-02 17:57:57 +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-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-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 == "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";
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
}