mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Nice name deduplucate
This commit is contained in:
parent
99e85e9a98
commit
eb16bebae9
@ -182,8 +182,9 @@ public async Task GetStatGlobalHistoryInt()
|
|||||||
var startups = new Stat( "GMA_X_STARTUPS_STAT" );
|
var startups = new Stat( "GMA_X_STARTUPS_STAT" );
|
||||||
|
|
||||||
var history = await startups.GetGlobalIntDays( 60 );
|
var history = await startups.GetGlobalIntDays( 60 );
|
||||||
|
Assert.AreNotEqual( 0, history.Length );
|
||||||
|
|
||||||
for( int i=0; i< history.Length; i++ )
|
for ( int i=0; i< history.Length; i++ )
|
||||||
{
|
{
|
||||||
Console.WriteLine( $"{i} : {history[i]}" );
|
Console.WriteLine( $"{i} : {history[i]}" );
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@ public ISteamUserStats( bool server = false ) : base( server )
|
|||||||
public override void InitInternals()
|
public override void InitInternals()
|
||||||
{
|
{
|
||||||
RequestCurrentStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestCurrentStatsDelegate>( Marshal.ReadIntPtr( VTable, 0) );
|
RequestCurrentStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestCurrentStatsDelegate>( Marshal.ReadIntPtr( VTable, 0) );
|
||||||
GetStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetStatDelegate>( Marshal.ReadIntPtr( VTable, 8) );
|
GetStat1DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetStat1Delegate>( Marshal.ReadIntPtr( VTable, 8) );
|
||||||
GetStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetStat2Delegate>( Marshal.ReadIntPtr( VTable, 16) );
|
GetStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetStat2Delegate>( Marshal.ReadIntPtr( VTable, 16) );
|
||||||
SetStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<SetStatDelegate>( Marshal.ReadIntPtr( VTable, 24) );
|
SetStat1DelegatePointer = Marshal.GetDelegateForFunctionPointer<SetStat1Delegate>( Marshal.ReadIntPtr( VTable, 24) );
|
||||||
SetStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<SetStat2Delegate>( Marshal.ReadIntPtr( VTable, 32) );
|
SetStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<SetStat2Delegate>( Marshal.ReadIntPtr( VTable, 32) );
|
||||||
UpdateAvgRateStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<UpdateAvgRateStatDelegate>( Marshal.ReadIntPtr( VTable, 40) );
|
UpdateAvgRateStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<UpdateAvgRateStatDelegate>( Marshal.ReadIntPtr( VTable, 40) );
|
||||||
GetAchievementDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementDelegate>( Marshal.ReadIntPtr( VTable, 48) );
|
GetAchievementDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementDelegate>( Marshal.ReadIntPtr( VTable, 48) );
|
||||||
@ -34,7 +34,7 @@ public override void InitInternals()
|
|||||||
GetNumAchievementsDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNumAchievementsDelegate>( Marshal.ReadIntPtr( VTable, 112) );
|
GetNumAchievementsDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNumAchievementsDelegate>( Marshal.ReadIntPtr( VTable, 112) );
|
||||||
GetAchievementNameDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementNameDelegate>( Marshal.ReadIntPtr( VTable, 120) );
|
GetAchievementNameDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementNameDelegate>( Marshal.ReadIntPtr( VTable, 120) );
|
||||||
RequestUserStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestUserStatsDelegate>( Marshal.ReadIntPtr( VTable, 128) );
|
RequestUserStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestUserStatsDelegate>( Marshal.ReadIntPtr( VTable, 128) );
|
||||||
GetUserStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserStatDelegate>( Marshal.ReadIntPtr( VTable, 136) );
|
GetUserStat1DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserStat1Delegate>( Marshal.ReadIntPtr( VTable, 136) );
|
||||||
GetUserStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserStat2Delegate>( Marshal.ReadIntPtr( VTable, 144) );
|
GetUserStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserStat2Delegate>( Marshal.ReadIntPtr( VTable, 144) );
|
||||||
GetUserAchievementDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserAchievementDelegate>( Marshal.ReadIntPtr( VTable, 152) );
|
GetUserAchievementDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserAchievementDelegate>( Marshal.ReadIntPtr( VTable, 152) );
|
||||||
GetUserAchievementAndUnlockTimeDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserAchievementAndUnlockTimeDelegate>( Marshal.ReadIntPtr( VTable, 160) );
|
GetUserAchievementAndUnlockTimeDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserAchievementAndUnlockTimeDelegate>( Marshal.ReadIntPtr( VTable, 160) );
|
||||||
@ -56,9 +56,9 @@ public override void InitInternals()
|
|||||||
GetNextMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNextMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 288) );
|
GetNextMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNextMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 288) );
|
||||||
GetAchievementAchievedPercentDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementAchievedPercentDelegate>( Marshal.ReadIntPtr( VTable, 296) );
|
GetAchievementAchievedPercentDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementAchievedPercentDelegate>( Marshal.ReadIntPtr( VTable, 296) );
|
||||||
RequestGlobalStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalStatsDelegate>( Marshal.ReadIntPtr( VTable, 304) );
|
RequestGlobalStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalStatsDelegate>( Marshal.ReadIntPtr( VTable, 304) );
|
||||||
GetGlobalStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatDelegate>( Marshal.ReadIntPtr( VTable, 312) );
|
GetGlobalStat1DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStat1Delegate>( Marshal.ReadIntPtr( VTable, 312) );
|
||||||
GetGlobalStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStat2Delegate>( Marshal.ReadIntPtr( VTable, 320) );
|
GetGlobalStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStat2Delegate>( Marshal.ReadIntPtr( VTable, 320) );
|
||||||
GetGlobalStatHistoryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistoryDelegate>( Marshal.ReadIntPtr( VTable, 328) );
|
GetGlobalStatHistory1DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistory1Delegate>( Marshal.ReadIntPtr( VTable, 328) );
|
||||||
GetGlobalStatHistory2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistory2Delegate>( Marshal.ReadIntPtr( VTable, 336) );
|
GetGlobalStatHistory2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistory2Delegate>( Marshal.ReadIntPtr( VTable, 336) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,13 +77,13 @@ internal bool RequestCurrentStats()
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
private delegate bool GetStatDelegate( IntPtr self, string pchName, ref int pData );
|
private delegate bool GetStat1Delegate( IntPtr self, string pchName, ref int pData );
|
||||||
private GetStatDelegate GetStatDelegatePointer;
|
private GetStat1Delegate GetStat1DelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal bool GetStat( string pchName, ref int pData )
|
internal bool GetStat1( string pchName, ref int pData )
|
||||||
{
|
{
|
||||||
return GetStatDelegatePointer( Self, pchName, ref pData );
|
return GetStat1DelegatePointer( Self, pchName, ref pData );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
@ -101,13 +101,13 @@ internal bool GetStat2( string pchName, ref float pData )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
private delegate bool SetStatDelegate( IntPtr self, string pchName, int nData );
|
private delegate bool SetStat1Delegate( IntPtr self, string pchName, int nData );
|
||||||
private SetStatDelegate SetStatDelegatePointer;
|
private SetStat1Delegate SetStat1DelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal bool SetStat( string pchName, int nData )
|
internal bool SetStat1( string pchName, int nData )
|
||||||
{
|
{
|
||||||
return SetStatDelegatePointer( Self, pchName, nData );
|
return SetStat1DelegatePointer( Self, pchName, nData );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
@ -264,13 +264,13 @@ internal string GetAchievementName( uint iAchievement )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
private delegate bool GetUserStatDelegate( IntPtr self, SteamId steamIDUser, string pchName, ref int pData );
|
private delegate bool GetUserStat1Delegate( IntPtr self, SteamId steamIDUser, string pchName, ref int pData );
|
||||||
private GetUserStatDelegate GetUserStatDelegatePointer;
|
private GetUserStat1Delegate GetUserStat1DelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal bool GetUserStat( SteamId steamIDUser, string pchName, ref int pData )
|
internal bool GetUserStat1( SteamId steamIDUser, string pchName, ref int pData )
|
||||||
{
|
{
|
||||||
return GetUserStatDelegatePointer( Self, steamIDUser, pchName, ref pData );
|
return GetUserStat1DelegatePointer( Self, steamIDUser, pchName, ref pData );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
@ -513,13 +513,13 @@ internal bool GetAchievementAchievedPercent( string pchName, ref float pflPercen
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
private delegate bool GetGlobalStatDelegate( IntPtr self, string pchStatName, ref long pData );
|
private delegate bool GetGlobalStat1Delegate( IntPtr self, string pchStatName, ref long pData );
|
||||||
private GetGlobalStatDelegate GetGlobalStatDelegatePointer;
|
private GetGlobalStat1Delegate GetGlobalStat1DelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal bool GetGlobalStat( string pchStatName, ref long pData )
|
internal bool GetGlobalStat1( string pchStatName, ref long pData )
|
||||||
{
|
{
|
||||||
return GetGlobalStatDelegatePointer( Self, pchStatName, ref pData );
|
return GetGlobalStat1DelegatePointer( Self, pchStatName, ref pData );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
@ -536,13 +536,13 @@ internal bool GetGlobalStat2( string pchStatName, ref double pData )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
private delegate int GetGlobalStatHistoryDelegate( IntPtr self, string pchStatName, [In,Out] long[] pData, uint cubData );
|
private delegate int GetGlobalStatHistory1Delegate( IntPtr self, string pchStatName, [In,Out] long[] pData, uint cubData );
|
||||||
private GetGlobalStatHistoryDelegate GetGlobalStatHistoryDelegatePointer;
|
private GetGlobalStatHistory1Delegate GetGlobalStatHistory1DelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal int GetGlobalStatHistory( string pchStatName, [In,Out] long[] pData, uint cubData )
|
internal int GetGlobalStatHistory1( string pchStatName, [In,Out] long[] pData, uint cubData )
|
||||||
{
|
{
|
||||||
return GetGlobalStatHistoryDelegatePointer( Self, pchStatName, pData, cubData );
|
return GetGlobalStatHistory1DelegatePointer( Self, pchStatName, pData, cubData );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
|
@ -45,7 +45,7 @@ public double GetGlobalFloat()
|
|||||||
public long GetGlobalInt()
|
public long GetGlobalInt()
|
||||||
{
|
{
|
||||||
long val = 0;
|
long val = 0;
|
||||||
SteamUserStats.Internal.GetGlobalStat( Name, ref val );
|
SteamUserStats.Internal.GetGlobalStat1( Name, ref val );
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public async Task<long[]> GetGlobalIntDays( int days )
|
|||||||
|
|
||||||
var r = new long[days];
|
var r = new long[days];
|
||||||
|
|
||||||
var rows = SteamUserStats.Internal.GetGlobalStatHistory( Name, r, (uint) r.Length );
|
var rows = SteamUserStats.Internal.GetGlobalStatHistory1( Name, r, (uint) r.Length );
|
||||||
|
|
||||||
if ( days != rows )
|
if ( days != rows )
|
||||||
r = r.Take( rows ).ToArray();
|
r = r.Take( rows ).ToArray();
|
||||||
@ -101,11 +101,11 @@ public int GetInt()
|
|||||||
|
|
||||||
if ( UserId > 0 )
|
if ( UserId > 0 )
|
||||||
{
|
{
|
||||||
SteamUserStats.Internal.GetUserStat( UserId, Name, ref val );
|
SteamUserStats.Internal.GetUserStat1( UserId, Name, ref val );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SteamUserStats.Internal.GetStat( Name, ref val );
|
SteamUserStats.Internal.GetStat1( Name, ref val );
|
||||||
}
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
@ -114,7 +114,7 @@ public int GetInt()
|
|||||||
public bool Set( int val )
|
public bool Set( int val )
|
||||||
{
|
{
|
||||||
LocalUserOnly();
|
LocalUserOnly();
|
||||||
return SteamUserStats.Internal.SetStat( Name, val );
|
return SteamUserStats.Internal.SetStat1( Name, val );
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Set( float val )
|
public bool Set( float val )
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Generator
|
namespace Generator
|
||||||
@ -14,6 +15,7 @@ public class Class
|
|||||||
public class Function
|
public class Function
|
||||||
{
|
{
|
||||||
public string Name;
|
public string Name;
|
||||||
|
public string DuplicateName;
|
||||||
public Dictionary<string, string> Arguments = new Dictionary<string, string>();
|
public Dictionary<string, string> Arguments = new Dictionary<string, string>();
|
||||||
|
|
||||||
public string ReturnType;
|
public string ReturnType;
|
||||||
@ -51,24 +53,18 @@ internal Function AddFunction( string funcName, string returnType, string args )
|
|||||||
|
|
||||||
public void PostProcess()
|
public void PostProcess()
|
||||||
{
|
{
|
||||||
var LastName = "";
|
var duplicateFunctions = Functions
|
||||||
var DuplicateCount = 0;
|
.GroupBy( x => x.Name )
|
||||||
|
.Where( x => x.Count() > 1 );
|
||||||
|
|
||||||
for (int i=0; i< Functions.Count; i++ )
|
foreach ( var group in duplicateFunctions )
|
||||||
{
|
{
|
||||||
var ThisName = Functions[i].Name;
|
var g = group.ToArray();
|
||||||
|
for ( int i=0; i< g.Count(); i++ )
|
||||||
if ( Functions[i].Name == LastName)
|
|
||||||
{
|
{
|
||||||
DuplicateCount++;
|
g[i].DuplicateName = g[i].Name;
|
||||||
Functions[i].Name += $"{DuplicateCount + 1}";
|
g[i].Name = $"{g[i].Name}{i+1}";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
DuplicateCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
LastName = ThisName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user