2017-03-13 23:05:32 +03:00
|
|
|
|
using System;
|
2019-04-12 23:30:13 +03:00
|
|
|
|
using System.Linq;
|
2017-03-13 23:05:32 +03:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
2019-04-13 00:53:46 +03:00
|
|
|
|
using System.Threading.Tasks;
|
2017-03-13 23:05:32 +03:00
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
|
2019-04-12 23:30:13 +03:00
|
|
|
|
namespace Steamworks
|
2017-03-13 23:05:32 +03:00
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
|
|
|
|
[DeploymentItem( "steam_api64.dll" )]
|
2019-04-12 23:30:13 +03:00
|
|
|
|
public class AppTest
|
2017-03-13 23:05:32 +03:00
|
|
|
|
{
|
2019-04-12 23:30:13 +03:00
|
|
|
|
[AssemblyInitialize]
|
|
|
|
|
public static void AssemblyInit( TestContext context )
|
|
|
|
|
{
|
2019-04-15 23:18:03 +03:00
|
|
|
|
//
|
|
|
|
|
// Init Client
|
|
|
|
|
//
|
2019-04-27 17:59:33 +03:00
|
|
|
|
Steamworks.SteamClient.Init( 252490 );
|
2019-04-15 23:18:03 +03:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Init Server
|
|
|
|
|
//
|
2019-04-27 17:59:33 +03:00
|
|
|
|
var serverInit = new SteamServerInit( "rust", "Rusty Mode" )
|
2019-04-15 23:18:03 +03:00
|
|
|
|
{
|
|
|
|
|
GamePort = 28015,
|
|
|
|
|
Secure = true,
|
|
|
|
|
QueryPort = 28016
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-27 17:59:33 +03:00
|
|
|
|
Steamworks.SteamServer.Init( 252490, serverInit );
|
2019-04-15 23:18:03 +03:00
|
|
|
|
|
2019-04-16 16:21:48 +03:00
|
|
|
|
SteamServer.LogOnAnonymous();
|
2019-04-15 23:18:03 +03:00
|
|
|
|
|
2019-04-12 23:30:13 +03:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-14 00:02:52 +03:00
|
|
|
|
static void OnNewUrlLaunchParameters()
|
|
|
|
|
{
|
|
|
|
|
// Wow!
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-12 23:30:13 +03:00
|
|
|
|
[TestMethod]
|
|
|
|
|
public void GameLangauge()
|
2017-03-13 23:05:32 +03:00
|
|
|
|
{
|
2019-04-16 16:21:48 +03:00
|
|
|
|
var gl = SteamApps.GameLanguage;
|
2019-04-12 23:30:13 +03:00
|
|
|
|
Assert.IsNotNull( gl );
|
|
|
|
|
Assert.IsTrue( gl.Length > 3 );
|
2017-03-13 23:05:32 +03:00
|
|
|
|
|
2019-04-12 23:30:13 +03:00
|
|
|
|
Console.WriteLine( $"{gl}" );
|
|
|
|
|
}
|
2017-03-13 23:05:32 +03:00
|
|
|
|
|
2019-04-12 23:47:02 +03:00
|
|
|
|
[TestMethod]
|
|
|
|
|
public void AppInstallDir()
|
|
|
|
|
{
|
2019-04-27 17:59:33 +03:00
|
|
|
|
var str = SteamApps.AppInstallDir();
|
2019-04-12 23:47:02 +03:00
|
|
|
|
Assert.IsNotNull( str );
|
|
|
|
|
Assert.IsTrue( str.Length > 3 );
|
|
|
|
|
|
|
|
|
|
Console.WriteLine( $"{str}" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void AppOwner()
|
|
|
|
|
{
|
2019-04-16 16:21:48 +03:00
|
|
|
|
var steamid = SteamApps.AppOwner;
|
2019-04-12 23:47:02 +03:00
|
|
|
|
Assert.IsTrue( steamid.Value > 70561197960279927 );
|
|
|
|
|
Assert.IsTrue( steamid.Value < 80561197960279927 );
|
|
|
|
|
|
|
|
|
|
Console.WriteLine( $"{steamid.Value}" );
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-12 23:30:13 +03:00
|
|
|
|
[TestMethod]
|
|
|
|
|
public void InstalledDepots()
|
|
|
|
|
{
|
2019-04-27 17:59:33 +03:00
|
|
|
|
var depots = SteamApps.InstalledDepots().ToArray();
|
2017-03-13 23:05:32 +03:00
|
|
|
|
|
2019-04-12 23:30:13 +03:00
|
|
|
|
Assert.IsNotNull( depots );
|
|
|
|
|
Assert.IsTrue( depots.Length > 0 );
|
2017-03-13 23:05:32 +03:00
|
|
|
|
|
2019-04-12 23:30:13 +03:00
|
|
|
|
foreach ( var depot in depots )
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine( $"{depot.Value}" );
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-13 00:53:46 +03:00
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public async Task GetFileDetails()
|
|
|
|
|
{
|
2019-04-16 16:21:48 +03:00
|
|
|
|
var fileinfo = await SteamApps.GetFileDetailsAsync( "hl2.exe" );
|
2019-04-13 20:47:36 +03:00
|
|
|
|
|
2019-04-16 23:57:55 +03:00
|
|
|
|
Console.WriteLine( $"fileinfo.SizeInBytes: {fileinfo?.SizeInBytes}" );
|
|
|
|
|
Console.WriteLine( $"fileinfo.Sha1: {fileinfo?.Sha1}" );
|
|
|
|
|
Console.WriteLine( $"fileinfo.Flags: {fileinfo?.Flags}" );
|
2019-04-13 00:53:46 +03:00
|
|
|
|
}
|
2019-04-13 23:26:10 +03:00
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2019-04-15 13:06:32 +03:00
|
|
|
|
public void CommandLine()
|
2019-04-13 23:26:10 +03:00
|
|
|
|
{
|
2019-04-16 16:21:48 +03:00
|
|
|
|
var cl = SteamApps.CommandLine;
|
2019-04-13 23:26:10 +03:00
|
|
|
|
|
|
|
|
|
Console.WriteLine( $"CommandLine: {cl}" );
|
|
|
|
|
}
|
2019-04-12 23:30:13 +03:00
|
|
|
|
}
|
2018-02-15 14:53:49 +03:00
|
|
|
|
|
2017-03-13 23:05:32 +03:00
|
|
|
|
}
|